Exemple #1
0
        public void UserViewField_DetailsWithType()
        {
            m_inMemoryCache.InitializeUserViews();

            UserViewRec rec = new UserViewRec();

            Cache.UserViewSpecs.Item(0).RecordsOC.Add(rec);
            UserViewField field = new UserViewField();

            rec.FieldsOS.Append(field);
            field.HideLabel           = true;
            field.Type                = (int)FldType.kftExpandable;
            field.ExpandOutline       = true;
            field.IsHierarchy         = true;
            field.PossibilityNameType = PossNameType.kpntNameAndAbbrev;

            byte[] expected = new byte[] { 0x64, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xC0 };
            Assert.AreEqual(expected.Length, field.Details.Length);
            for (int i = 0; i < field.Details.Length; i++)
            {
                Assert.AreEqual(expected[i], field.Details[i], "Byte " + i + " is wrong.");
            }
            Assert.AreEqual(true, field.HideLabel);
            Assert.AreEqual(0x64, field.BrowseColumnWidth);
            Assert.AreEqual((int)FldType.kftExpandable, field.Type);
            Assert.AreEqual(true, field.ExpandOutline);
            Assert.AreEqual(true, field.IsHierarchy);
            Assert.AreEqual(PossNameType.kpntNameAndAbbrev, field.PossibilityNameType);
        }
Exemple #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Create a single user view for testing
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void CreateTestUserView()
        {
            m_inMemoryCache.InitializeUserViews();
            IEnumerator userViews = Cache.UserViewSpecs.GetEnumerator();

            userViews.MoveNext();
            m_userView = (UserView)userViews.Current;

            // Scripture is displayed by showing it's Book Annotations (which are ScrScriptureNotes)
            UserViewRec rec = new UserViewRec();

            m_userView.RecordsOC.Add(rec);
            rec.Clsid = Scripture.Scripture.kClassId;

            UserViewField field = new UserViewField();

            rec.FieldsOS.Append(field);
            field.Flid = (int)Scripture.Scripture.ScriptureTags.kflidBookAnnotations;

            // Each ScrBookAnnotations record is displayed by showing its Notes (which are ScrScriptureNotes).
            rec = new UserViewRec();
            m_userView.RecordsOC.Add(rec);
            rec.Clsid = ScrBookAnnotations.kClassId;

            field = new UserViewField();
            rec.FieldsOS.Append(field);
            field.Flid = (int)ScrBookAnnotations.ScrBookAnnotationsTags.kflidNotes;

            // Each ScrScriptureNote record is displayed by showing its status, references, categories, etc.
            rec = new UserViewRec();
            m_userView.RecordsOC.Add(rec);
            rec.Clsid = ScrScriptureNote.kClassId;

            field = new UserViewField();
            rec.FieldsOS.Append(field);
            field.Flid = (int)ScrScriptureNote.ScrScriptureNoteTags.kflidResolutionStatus;

            field = new UserViewField();
            rec.FieldsOS.Append(field);
            field.Flid          = (int)CmAnnotation.CmAnnotationTags.kflidAnnotationType;
            field.PossListRAHvo = Cache.LangProject.AnnotationDefsOAHvo;

            field = new UserViewField();
            rec.FieldsOS.Append(field);
            field.Flid          = (int)ScrScriptureNote.ScrScriptureNoteTags.kflidCategories;
            field.PossListRAHvo = m_scr.NoteCategoriesOAHvo;
        }
        protected UserViewField m_FieldSpec;         // was: FldSpec m_qfsp
        #endregion

        #region Construction and initialization

        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="hvoObj">Id of object we are editing (object that has m_flid).</param>
        /// <param name="flid">Id of the field we are editing.</param>
        /// <param name="nIndent">Level of nesting in the tree. 0 is top.</param>
        /// <param name="tssLabel">The label to show in the tree for this field.</param>
        /// <param name="tssHelp">The "What's this" help string for with this field.</param>
        /// <param name="parent">The owning form.</param>
        /// <param name="fieldSpec">The field specification that defines this field
        /// (null is acceptable, but not recommended).</param>
        /// ------------------------------------------------------------------------------------
        public FwDataEntryFieldEditor(int hvoObj, int flid, int nIndent, ITsString tssLabel,
                                      ITsString tssHelp, FwDataEntryForm parent, UserViewField fieldSpec)
        {
            m_dypFontHeight = 0;
            Debug.Assert(parent != null);
            Debug.Assert(hvoObj != 0);
            Debug.Assert(flid != 0);

            // Store member variables.
            m_hvoObj   = hvoObj;
            m_flid     = flid;
            m_nIndent  = nIndent;
            m_tssLabel = tssLabel;
            m_tssHelp  = tssHelp;
            m_Parent   = parent;
            // Make a dummy FldSpec if one wasn't supplied.
            if (fieldSpec != null)
            {
                m_FieldSpec = fieldSpec;
            }
            else
            {
                m_FieldSpec = new UserViewField();
            }

            // Get writing system.
            int wsReal  = m_FieldSpec.WritingSystemRAHvo;
            int wsMagic = m_FieldSpec.WsSelector;

            if (wsMagic != 0)
            {
                m_wsMagic = wsMagic;
            }
            else if (wsReal != 0)
            {
                m_wsMagic = wsReal;
            }
            else
            {
                m_wsMagic = LangProject.kwsAnal;
            }
            m_ws = parent.LangProj.ActualWs(m_wsMagic, m_hvoObj, m_flid);

            MakeCharProps();
        }
Exemple #4
0
        public void UserViewField_DetailsWithoutType()
        {
            m_inMemoryCache.InitializeUserViews();

            UserViewRec rec = new UserViewRec();

            Cache.UserViewSpecs.Item(0).RecordsOC.Add(rec);
            UserViewField field = new UserViewField();

            rec.FieldsOS.Append(field);
            field.HideLabel = true;

            byte[] expected = new byte[] { 0x64, 0x00, 0x00, 0x80 };
            Assert.AreEqual(expected.Length, field.Details.Length);
            for (int i = 0; i < field.Details.Length; i++)
            {
                Assert.AreEqual(expected[i], field.Details[i], "Byte " + i + " is wrong.");
            }
            Assert.AreEqual(true, field.HideLabel);
            Assert.AreEqual(0x64, field.BrowseColumnWidth);
        }