Ejemplo n.º 1
0
		public void CreateAndUpdateSingleFt()
		{
			string paraContents = "Das buch ist rot";
			string trans = "The book is red";
			m_para.Contents.UnderlyingTsString = m_tsf.MakeString(paraContents, m_wsVern);
			ICmIndirectAnnotation ft = MakeFt(m_para, trans, 0, paraContents.Length);
			FreeTransEditMonitor monitor = new FreeTransEditMonitor(Cache, m_wsTrans); // BEFORE propChanged!
			Cache.PropChanged(ft.Hvo, (int)CmAnnotation.CmAnnotationTags.kflidComment, 0, 0, 0);
			monitor.LoseFocus();
			Assert.AreEqual(1, m_para.TranslationsOC.Count, "monitor should have made a CmTranslation");
			Assert.AreEqual(trans, m_para.TranslationsOC.ToList()[0].Translation.GetAlternative(m_wsTrans).Text);
			string trans2 = "The book is green";
			ft.Comment.SetAlternative(trans2, m_wsTrans);
			monitor.Dispose(); // should trigger update.
			Assert.AreEqual(1, m_para.TranslationsOC.Count, "monitor should not have made another translation");
			Assert.AreEqual(trans2, m_para.TranslationsOC.ToList()[0].Translation.GetAlternative(m_wsTrans).Text);
		}
Ejemplo n.º 2
0
		public void NonScriptureText()
		{
			IText text = new Text();
			Cache.LangProject.TextsOC.Add(text);
			StText sttext = new StText();
			text.ContentsOA = sttext;
			m_para = new StTxtPara();
			sttext.ParagraphsOS.Append(m_para);
			string paraContents = "Das buch ist rot";
			string trans = "The book is red";
			m_para.Contents.UnderlyingTsString = m_tsf.MakeString(paraContents, m_wsVern);
			ICmIndirectAnnotation ft = MakeFt(m_para, trans, 0, paraContents.Length);
			FreeTransEditMonitor monitor = new FreeTransEditMonitor(Cache, m_wsTrans); // BEFORE propChanged!
			Cache.PropChanged(ft.Hvo, (int)CmAnnotation.CmAnnotationTags.kflidComment, 0, 0, 0);
			monitor.LoseFocus();
			Assert.AreEqual(0, m_para.TranslationsOC.Count, "monitor should not make CmTranslation for non-Scripture");
		}