Exemplo n.º 1
0
		public void DiffEditAsPartOfImport()
		{
			CheckDisposed();

			m_settings.ImportTranslation = true;
			MockScrObjWrapper.s_fSimulateCancel = false;

			int origActCount = m_cache.ActionHandlerAccessor.UndoableActionCount;

			IScrBook jude = m_scr.FindBook(65);
			Assert.IsNotNull(jude, "This test is invalid if Jude isn't in the test DB.");
			int cBooksOrig = m_scr.ScriptureBooksOS.Count;

			List<SegmentInfo> al = new List<SegmentInfo>(3);
			// process a \id segment to import an existing a book
			al.Add(new SegmentInfo(@"\id", "JUD", ImportDomain.Main, new BCVRef(65, 0, 0)));
			al.Add(new SegmentInfo(@"\s", "Section head", ImportDomain.Main, new BCVRef(65, 1, 1)));
			al.Add(new SegmentInfo(@"\p", "Contents", ImportDomain.Main, new BCVRef(65, 1, 1)));

			m_importMgr.CallImportWithUndoTask(m_settings, al);

			Assert.AreEqual(1, m_importMgr.NewSavedVersions.Count, "We should have an imported version but not a backup saved version.");
			Assert.AreEqual(origActCount + 4, m_cache.ActionHandlerAccessor.UndoableActionCount,
				"Should have 4 extra undo actions (create backup, create imported version & first book, create second book, delete {empty} backup).");
			// Call ProcessChapterVerseNums to simulate an edit in the diff dialog.
			jude = m_scr.FindBook(65);
			ScrTxtPara sc1Para = new ScrTxtPara(m_cache, jude.SectionsOS[0].ContentOA.ParagraphsOS.HvoArray[0]);
			sc1Para.ProcessChapterVerseNums(0, 1, 0);
			Assert.AreEqual("&Undo Import", m_cache.UndoText);
			Assert.AreEqual(1, m_importMgr.m_cDisplayImportedBooksDlgCalled);
		}
Exemplo n.º 2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Calls ParseStTxtPara to carry out the desired side effects: re-parsing the paragraph
		/// for wordforms, ???.
		/// </summary>
		/// <param name="hvoPara">The Paragraph that was changed</param>
		/// <param name="ivMin">the starting character index where the change occurred</param>
		/// <param name="cvIns">the number of characters inserted</param>
		/// <param name="cvDel">the number of characters deleted</param>
		/// ------------------------------------------------------------------------------------
		protected override void DoEffectsOfPropChange(int hvoPara, int ivMin, int cvIns, int cvDel)
		{
			// If nothing really changed, don't do anything.
			if (cvIns == 0 && cvDel == 0)
				return;

			// Check that the paragraph is truly Scripture, and not a footnote or some other kind
			// of non-Scripture paragraph
			int hvoOfStTextThatOwnsPara = m_cache.GetOwnerOfObject(hvoPara);

			switch (m_cache.GetOwningFlidOfObject(hvoOfStTextThatOwnsPara))
			{
				case (int)ScrSection.ScrSectionTags.kflidContent:
				{
					ScrTxtPara para = new ScrTxtPara(m_cache, hvoPara, false, false);
					// get para props to determine para style - Intro?
					para.ProcessChapterVerseNums(ivMin, cvIns, cvDel);

					// Mark any back translations as unfinished
					para.MarkBackTranslationsAsUnfinished();
					break;
				}
				case (int)ScrBook.ScrBookTags.kflidFootnotes:
				case (int)ScrSection.ScrSectionTags.kflidHeading:
				{
					ScrTxtPara para = new ScrTxtPara(m_cache, hvoPara, false, false);
					// Mark any back translations as stale
					para.MarkBackTranslationsAsUnfinished();
					break;
				}
				default:
					// REVIEW TETeam(TomB): Is any checking needed for anything else?
					break;
			}
		}