Beispiel #1
0
        private void AddEtymology(LexEtymology etymology)
        {
//  ok if no form is given          if (!MultiTextBase.IsEmpty(etymology))
//            {
            Writer.WriteStartElement("etymology");
            //type is required, so add the attribute even if it's emtpy
            Writer.WriteAttributeString("type", etymology.Type.Trim());

            //source is required, so add the attribute even if it's emtpy
            Writer.WriteAttributeString("source", etymology.Source.Trim());
            AddMultitextGlosses(string.Empty, etymology.Gloss);
            WriteCustomMultiTextField("comment", etymology.Comment);
            AddMultitextForms(string.Empty, etymology);
            Writer.WriteEndElement();
//           }
        }
Beispiel #2
0
        public void OwnedObjects()
        {
            m_dtree.Initialize(m_cache, false, m_layouts, m_parts);
            m_dtree.ShowObject(m_entry.Hvo, "OptSensesEty");
            // With no etymology or senses, this view contains nothing at all.
            Assert.AreEqual(0, m_dtree.Controls.Count);
            m_parent.Close();
            m_parent.Dispose();
            m_parent = null;

            ILexSense sense1 = m_entry.SensesOS.Append(new LexSense());
            ILexSense sense2 = m_entry.SensesOS.Append(new LexSense());

            m_cache.MainCacheAccessor.SetString(sense2.Hvo,
                                                (int)LexSense.LexSenseTags.kflidScientificName,
                                                m_cache.MakeAnalysisTss("blah blah"));

            m_parent = new Form();
            m_dtree  = new DataTree();
            m_parent.Controls.Add(m_dtree);
            m_dtree.Initialize(m_cache, false, m_layouts, m_parts);
            m_dtree.ShowObject(m_entry.Hvo, "OptSensesEty");
            // With two senses, we get a header slice, a gloss slice for
            // sense 1 (not optional), and both gloss and Scientific name
            // slices for sense 2.
            Assert.AreEqual(3, m_dtree.Controls.Count);
            //Assert.AreEqual("Senses", (m_dtree.Controls[0] as Slice).Label);
            Assert.AreEqual("Gloss", (m_dtree.Controls[0] as Slice).Label);
            Assert.AreEqual("Gloss", (m_dtree.Controls[1] as Slice).Label);
            Assert.AreEqual("ScientificName", (m_dtree.Controls[2] as Slice).Label);
            m_parent.Close();
            m_parent.Dispose();
            m_parent = null;

            ILexEtymology lm = new LexEtymology();

            m_entry.EtymologyOA = lm;

            m_parent = new Form();
            m_dtree  = new DataTree();
            m_parent.Controls.Add(m_dtree);
            m_dtree.Initialize(m_cache, false, m_layouts, m_parts);
            m_dtree.ShowObject(m_entry.Hvo, "OptSensesEty");
            // Adding an etymology gets us just no more slices so far,
            // because it doesn't have a form or source
            Assert.AreEqual(3, m_dtree.Controls.Count);
            //Assert.AreEqual("Etymology", (m_dtree.Controls[3] as Slice).Label);
            m_parent.Close();
            m_parent.Dispose();
            m_parent = null;

            lm.Source = "source";
            // Again set both because I'm not sure which it really
            // should be.
            lm.Form.VernacularDefaultWritingSystem = "rubbish";
            lm.Form.AnalysisDefaultWritingSystem   = "rubbish";

            m_parent = new Form();
            m_dtree  = new DataTree();
            m_parent.Controls.Add(m_dtree);
            m_dtree.Initialize(m_cache, false, m_layouts, m_parts);
            m_dtree.ShowObject(m_entry.Hvo, "OptSensesEty");
            // When the etymology has something we get two more.
            Assert.AreEqual(5, m_dtree.Controls.Count);
            Assert.AreEqual("Form", (m_dtree.Controls[3] as Slice).Label);
            Assert.AreEqual("Source", (m_dtree.Controls[4] as Slice).Label);
        }