Exemple #1
0
        public void UserPromptForBookTitleWithEmptyPara()
        {
            // Set up title with an empty paragraph
            IStText title = AddTitleToMockedBook(m_book, string.Empty, Cache.DefaultVernWs);

            Options.ShowEmptyParagraphPromptsSetting = true;

            int         defVernWs = Cache.DefaultVernWs;
            DummyTeStVc stVc      = new DummyTeStVc(Cache, defVernWs);

            CreateExpectedUserPrompt(stVc, title.ParagraphsOS[0].Hvo,
                                     ScrBookTags.kflidTitle, StTxtParaTags.kflidContents);

            m_vwenvMock.Stub(x => x.CurrentObject()).Return(title.ParagraphsOS[0].Hvo);
            bool fTextAdded = stVc.CallInsertUserPrompt(m_vwenvMock, title[0]);

            Assert.IsTrue(fTextAdded, "User prompt not added");
            ITsString text = stVc.DisplayVariant(m_vwenvMock, SimpleRootSite.kTagUserPrompt,
                                                 ScrBookTags.kflidTitle);

            string difference;
            bool   fEqual = TsStringHelper.TsStringsAreEqual(
                ExpectedUserPrompt("Type book title for Philemon here", defVernWs),
                text, out difference);

            Assert.IsTrue(fEqual, difference);
            m_vwenvMock.VerifyAllExpectations();
        }
Exemple #2
0
        public void UserPromptForSectionHeadWithEmptyPara()
        {
            // Set up section head with an empty paragraph
            IScrSection section = AddSectionToMockedBook(m_book);
            IStTxtPara  para    = AddSectionHeadParaToSection(section, "",
                                                              ScrStyleNames.SectionHead);

            Options.ShowEmptyParagraphPromptsSetting = true;
            int         defVernWs = Cache.DefaultVernWs;
            DummyTeStVc stVc      = new DummyTeStVc(Cache, defVernWs);

            CreateExpectedUserPrompt(stVc, para.Hvo,
                                     ScrSectionTags.kflidHeading, StTxtParaTags.kflidContents);

            bool fTextAdded = stVc.CallInsertUserPrompt(m_vwenvMock, para);

            Assert.IsTrue(fTextAdded, "User prompt not added");
            ITsString text = stVc.DisplayVariant(m_vwenvMock, SimpleRootSite.kTagUserPrompt,
                                                 ScrSectionTags.kflidHeading);

            string difference;
            bool   fEqual = TsStringHelper.TsStringsAreEqual(
                ExpectedUserPrompt("Type section head here", defVernWs),
                text, out difference);

            Assert.IsTrue(fEqual, difference);
            m_vwenvMock.VerifyAllExpectations();
        }
Exemple #3
0
        public void UserPromptForSectionHeadWithEmptyPara()
        {
            CheckDisposed();

            // Set up section head with an empty paragraph
            IScrSection section = m_inMemoryCache.AddSectionToMockedBook(m_book.Hvo);
            StTxtPara   para    = m_inMemoryCache.AddSectionHeadParaToSection(section.Hvo, "",
                                                                              ScrStyleNames.SectionHead);

            section.AdjustReferences();
            Options.ShowEmptyParagraphPromptsSetting = true;

            DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache, m_inMemoryCache.Cache.DefaultVernWs);

            CreateExpectedUserPrompt(stVc, para.Hvo,
                                     (int)ScrSection.ScrSectionTags.kflidHeading, (int)StTxtPara.StTxtParaTags.kflidContents);

            IVwEnv vwEnv      = (IVwEnv)m_vwenvMock.MockInstance;
            bool   fTextAdded = stVc.CallInsertUserPrompt(vwEnv, para.Hvo);

            Assert.IsTrue(fTextAdded, "User prompt not added");
            ITsString text = stVc.DisplayVariant(vwEnv, SimpleRootSite.kTagUserPrompt, null,
                                                 (int)ScrSection.ScrSectionTags.kflidHeading);

            string difference;
            bool   fEqual = TsStringHelper.TsStringsAreEqual(
                ExpectedUserPrompt("Type section head here", m_inMemoryCache.Cache.DefaultVernWs),
                text, out difference);

            Assert.IsTrue(fEqual, difference);
            m_vwenvMock.Verify();
        }
Exemple #4
0
        public void UserPromptForBookTitleWithEmptyPara()
        {
            CheckDisposed();

            // Set up title with an empty paragraph
            StText title = m_inMemoryCache.AddTitleToMockedBook(m_book.Hvo, m_emptyTsString,
                                                                StyleUtils.ParaStyleTextProps(ScrStyleNames.MainBookTitle));

            Options.ShowEmptyParagraphPromptsSetting = true;

            DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache, m_inMemoryCache.Cache.DefaultVernWs);

            CreateExpectedUserPrompt(stVc, title.ParagraphsOS.FirstItem.Hvo,
                                     (int)ScrBook.ScrBookTags.kflidTitle, (int)StTxtPara.StTxtParaTags.kflidContents);

            m_vwenvMock.ExpectAndReturn("CurrentObject", title.ParagraphsOS.FirstItem.Hvo);
            IVwEnv vwEnv      = (IVwEnv)m_vwenvMock.MockInstance;
            bool   fTextAdded = stVc.CallInsertUserPrompt(vwEnv,
                                                          title.ParagraphsOS.FirstItem.Hvo);

            Assert.IsTrue(fTextAdded, "User prompt not added");
            ITsString text = stVc.DisplayVariant(vwEnv, SimpleRootSite.kTagUserPrompt, null,
                                                 (int)ScrBook.ScrBookTags.kflidTitle);

            string difference;
            bool   fEqual = TsStringHelper.TsStringsAreEqual(
                ExpectedUserPrompt("Type book title for Philemon here", m_inMemoryCache.Cache.DefaultVernWs),
                text, out difference);

            Assert.IsTrue(fEqual, difference);
            m_vwenvMock.Verify();
        }
Exemple #5
0
        public void UserPromptForBackTranslation()
        {
            CheckDisposed();

            // Set up a section and paragraph with text
            IScrSection section = m_inMemoryCache.AddSectionToMockedBook(m_book.Hvo);
            StTxtPara   para    = m_inMemoryCache.AddParaToMockedSectionContent(section.Hvo,
                                                                                ScrStyleNames.NormalParagraph);

            section.AdjustReferences();

            m_inMemoryCache.AddRunToMockedPara(para, "Some paragraph text.", null);

            // Add an empty translation to the paragraph
            int            wsBT  = m_inMemoryCache.Cache.DefaultAnalWs;
            ICmTranslation trans = m_inMemoryCache.AddBtToMockedParagraph(para, wsBT);

            m_inMemoryCache.AddRunToMockedTrans(trans, wsBT, string.Empty, null);

            DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache, m_inMemoryCache.Cache.DefaultAnalWs);

            CreateExpectedUserPrompt(stVc, trans.Hvo,
                                     (int)CmTranslation.CmTranslationTags.kflidTranslation,
                                     (int)CmTranslation.CmTranslationTags.kflidTranslation);

            // verify that the prompt gets added
            IVwEnv vwEnv      = (IVwEnv)m_vwenvMock.MockInstance;
            bool   fTextAdded = stVc.CallInsertBackTranslationUserPrompt(vwEnv, trans.Hvo);

            Assert.IsTrue(fTextAdded, "User prompt not added");

            // verify the contents of the prompt
            ITsString text = stVc.DisplayVariant(vwEnv, SimpleRootSite.kTagUserPrompt, null,
                                                 (int)CmTranslation.CmTranslationTags.kflidTranslation);
            string difference;
            bool   fEqual = TsStringHelper.TsStringsAreEqual(
                ExpectedUserPrompt("Type back translation here", m_inMemoryCache.Cache.DefaultAnalWs),
                text, out difference);

            Assert.IsTrue(fEqual, difference);

            // verify the mock - is this useful?
            m_vwenvMock.Verify();
        }
Exemple #6
0
        public void UserPromptForBackTranslation()
        {
            // Set up a section and paragraph with text
            IScrSection section = AddSectionToMockedBook(m_book);
            IStTxtPara  para    = AddParaToMockedSectionContent(section, ScrStyleNames.NormalParagraph);

            AddRunToMockedPara(para, "Some paragraph text.", null);

            // Add an empty translation to the paragraph
            int            wsBT  = Cache.DefaultAnalWs;
            ICmTranslation trans = AddBtToMockedParagraph(para, wsBT);

            AddRunToMockedTrans(trans, wsBT, string.Empty, null);

            DummyTeStVc stVc = new DummyTeStVc(Cache, wsBT);

            CreateExpectedUserPrompt(stVc, trans.Hvo, CmTranslationTags.kflidTranslation,
                                     CmTranslationTags.kflidTranslation);

            // verify that the prompt gets added
            bool fTextAdded = stVc.CallInsertBackTranslationUserPrompt(m_vwenvMock, trans);

            Assert.IsTrue(fTextAdded, "User prompt not added");

            // verify the contents of the prompt
            ITsString text = stVc.DisplayVariant(m_vwenvMock, SimpleRootSite.kTagUserPrompt,
                                                 CmTranslationTags.kflidTranslation);
            string difference;
            bool   fEqual = TsStringHelper.TsStringsAreEqual(
                ExpectedUserPrompt("Type back translation here", wsBT),
                text, out difference);

            Assert.IsTrue(fEqual, difference);

            // verify the mock - is this useful?
            m_vwenvMock.VerifyAllExpectations();
        }
Exemple #7
0
		public void UserPromptForBackTranslation()
		{
			CheckDisposed();

			// Set up a section and paragraph with text
			IScrSection section = m_inMemoryCache.AddSectionToMockedBook(m_book.Hvo);
			StTxtPara para = m_inMemoryCache.AddParaToMockedSectionContent(section.Hvo,
				ScrStyleNames.NormalParagraph);
			section.AdjustReferences();

			m_inMemoryCache.AddRunToMockedPara(para, "Some paragraph text.", null);

			// Add an empty translation to the paragraph
			int wsBT = m_inMemoryCache.Cache.DefaultAnalWs;
			ICmTranslation trans = m_inMemoryCache.AddBtToMockedParagraph(para, wsBT);
			m_inMemoryCache.AddRunToMockedTrans(trans, wsBT, string.Empty, null);

			DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache, m_inMemoryCache.Cache.DefaultAnalWs);

			CreateExpectedUserPrompt(stVc, trans.Hvo,
				(int)CmTranslation.CmTranslationTags.kflidTranslation,
				(int)CmTranslation.CmTranslationTags.kflidTranslation);

			// verify that the prompt gets added
			IVwEnv vwEnv = (IVwEnv)m_vwenvMock.MockInstance;
			bool fTextAdded = stVc.CallInsertBackTranslationUserPrompt(vwEnv, trans.Hvo);
			Assert.IsTrue(fTextAdded, "User prompt not added");

			// verify the contents of the prompt
			ITsString text = stVc.DisplayVariant(vwEnv, SimpleRootSite.kTagUserPrompt, null,
				(int)CmTranslation.CmTranslationTags.kflidTranslation);
			string difference;
			bool fEqual = TsStringHelper.TsStringsAreEqual(
				ExpectedUserPrompt("Type back translation here", m_inMemoryCache.Cache.DefaultAnalWs),
				text, out difference);
			Assert.IsTrue(fEqual, difference);

			// verify the mock - is this useful?
			m_vwenvMock.Verify();
		}
Exemple #8
0
		public void UserPromptForSectionHeadWithEmptyPara()
		{
			CheckDisposed();

			// Set up section head with an empty paragraph
			IScrSection section = m_inMemoryCache.AddSectionToMockedBook(m_book.Hvo);
			StTxtPara para = m_inMemoryCache.AddSectionHeadParaToSection(section.Hvo, "",
				 ScrStyleNames.SectionHead);
			section.AdjustReferences();
			Options.ShowEmptyParagraphPromptsSetting = true;

			DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache, m_inMemoryCache.Cache.DefaultVernWs);

			CreateExpectedUserPrompt(stVc, para.Hvo,
				(int)ScrSection.ScrSectionTags.kflidHeading, (int)StTxtPara.StTxtParaTags.kflidContents);

			IVwEnv vwEnv = (IVwEnv)m_vwenvMock.MockInstance;
			bool fTextAdded = stVc.CallInsertUserPrompt(vwEnv, para.Hvo);

			Assert.IsTrue(fTextAdded, "User prompt not added");
			ITsString text = stVc.DisplayVariant(vwEnv, SimpleRootSite.kTagUserPrompt, null,
				(int)ScrSection.ScrSectionTags.kflidHeading);

			string difference;
			bool fEqual = TsStringHelper.TsStringsAreEqual(
				ExpectedUserPrompt("Type section head here", m_inMemoryCache.Cache.DefaultVernWs),
				text, out difference);
			Assert.IsTrue(fEqual, difference);
			m_vwenvMock.Verify();
		}
Exemple #9
0
		public void UserPromptForBookTitleWithEmptyPara()
		{
			CheckDisposed();

			// Set up title with an empty paragraph
			StText title = m_inMemoryCache.AddTitleToMockedBook(m_book.Hvo, m_emptyTsString,
				StyleUtils.ParaStyleTextProps(ScrStyleNames.MainBookTitle));
			Options.ShowEmptyParagraphPromptsSetting = true;

			DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache, m_inMemoryCache.Cache.DefaultVernWs);

			CreateExpectedUserPrompt(stVc, title.ParagraphsOS.FirstItem.Hvo,
				(int)ScrBook.ScrBookTags.kflidTitle, (int)StTxtPara.StTxtParaTags.kflidContents);

			m_vwenvMock.ExpectAndReturn("CurrentObject", title.ParagraphsOS.FirstItem.Hvo);
			IVwEnv vwEnv = (IVwEnv)m_vwenvMock.MockInstance;
			bool fTextAdded = stVc.CallInsertUserPrompt(vwEnv,
				title.ParagraphsOS.FirstItem.Hvo);

			Assert.IsTrue(fTextAdded, "User prompt not added");
			ITsString text = stVc.DisplayVariant(vwEnv, SimpleRootSite.kTagUserPrompt, null,
				(int)ScrBook.ScrBookTags.kflidTitle);

			string difference;
			bool fEqual = TsStringHelper.TsStringsAreEqual(
				ExpectedUserPrompt("Type book title for Philemon here", m_inMemoryCache.Cache.DefaultVernWs),
				text, out difference);
			Assert.IsTrue(fEqual, difference);
			m_vwenvMock.Verify();
		}
Exemple #10
0
		public void UserPromptForBackTranslation()
		{
			// Set up a section and paragraph with text
			IScrSection section = AddSectionToMockedBook(m_book);
			IStTxtPara para = AddParaToMockedSectionContent(section, ScrStyleNames.NormalParagraph);

			AddRunToMockedPara(para, "Some paragraph text.", null);

			// Add an empty translation to the paragraph
			int wsBT = Cache.DefaultAnalWs;
			ICmTranslation trans = AddBtToMockedParagraph(para, wsBT);
			AddRunToMockedTrans(trans, wsBT, string.Empty, null);

			DummyTeStVc stVc = new DummyTeStVc(Cache, wsBT);
				CreateExpectedUserPrompt(stVc, trans.Hvo, CmTranslationTags.kflidTranslation,
					CmTranslationTags.kflidTranslation);

				// verify that the prompt gets added
				bool fTextAdded = stVc.CallInsertBackTranslationUserPrompt(m_vwenvMock, trans);
				Assert.IsTrue(fTextAdded, "User prompt not added");

				// verify the contents of the prompt
				ITsString text = stVc.DisplayVariant(m_vwenvMock, SimpleRootSite.kTagUserPrompt,
					CmTranslationTags.kflidTranslation);
				string difference;
				bool fEqual = TsStringHelper.TsStringsAreEqual(
					ExpectedUserPrompt("Type back translation here", wsBT),
					text, out difference);
				Assert.IsTrue(fEqual, difference);

				// verify the mock - is this useful?
				m_vwenvMock.VerifyAllExpectations();
			}
Exemple #11
0
		public void UserPromptForSectionHeadWithEmptyPara()
		{
			// Set up section head with an empty paragraph
			IScrSection section = AddSectionToMockedBook(m_book);
			IStTxtPara para = AddSectionHeadParaToSection(section, "",
				 ScrStyleNames.SectionHead);
			Options.ShowEmptyParagraphPromptsSetting = true;
			int defVernWs = Cache.DefaultVernWs;
			DummyTeStVc stVc = new DummyTeStVc(Cache, defVernWs);
				CreateExpectedUserPrompt(stVc, para.Hvo,
					ScrSectionTags.kflidHeading, StTxtParaTags.kflidContents);

				bool fTextAdded = stVc.CallInsertUserPrompt(m_vwenvMock, para);

				Assert.IsTrue(fTextAdded, "User prompt not added");
				ITsString text = stVc.DisplayVariant(m_vwenvMock, SimpleRootSite.kTagUserPrompt,
					ScrSectionTags.kflidHeading);

				string difference;
				bool fEqual = TsStringHelper.TsStringsAreEqual(
					ExpectedUserPrompt("Type section head here", defVernWs),
					text, out difference);
				Assert.IsTrue(fEqual, difference);
				m_vwenvMock.VerifyAllExpectations();
			}
Exemple #12
0
		public void UserPromptForBookTitleWithEmptyPara()
		{
			// Set up title with an empty paragraph
			IStText title = AddTitleToMockedBook(m_book, string.Empty, Cache.DefaultVernWs);
			Options.ShowEmptyParagraphPromptsSetting = true;

			int defVernWs = Cache.DefaultVernWs;
			DummyTeStVc stVc = new DummyTeStVc(Cache, defVernWs);
				CreateExpectedUserPrompt(stVc, title.ParagraphsOS[0].Hvo,
					ScrBookTags.kflidTitle, StTxtParaTags.kflidContents);

				m_vwenvMock.Stub(x => x.CurrentObject()).Return(title.ParagraphsOS[0].Hvo);
				bool fTextAdded = stVc.CallInsertUserPrompt(m_vwenvMock, title[0]);

				Assert.IsTrue(fTextAdded, "User prompt not added");
				ITsString text = stVc.DisplayVariant(m_vwenvMock, SimpleRootSite.kTagUserPrompt,
					ScrBookTags.kflidTitle);

				string difference;
				bool fEqual = TsStringHelper.TsStringsAreEqual(
					ExpectedUserPrompt("Type book title for Philemon here", defVernWs),
					text, out difference);
				Assert.IsTrue(fEqual, difference);
				m_vwenvMock.VerifyAllExpectations();
			}