/// ------------------------------------------------------------------------------------ /// <summary> /// Completes the initialize. Every test needs to call this before initializing. /// We don't include this in the initialize run before every test because, if we want /// to create another archive, it will cause a crash. /// </summary> /// <param name="fMakePhilemonChanges">if <c>true</c> make changes in Philemon and /// detect differences</param> /// <param name="bookRev">the book to use for the revision in the bookmerger.</param> /// ------------------------------------------------------------------------------------ private void CompleteInitialize(bool fMakePhilemonChanges, IScrBook bookRev) { Debug.Assert(m_bookMerger == null, "m_bookMerger is not null."); if (fMakePhilemonChanges) { m_philemonCurr = m_scr.FindBook(57); m_draft = m_scr.CreateSavedVersion("PhilemonArchive", new int[] {m_philemonCurr.Hvo}); m_philemonRev = m_draft.FindBook(57); m_draft.Type = ScrDraftType.ImportedVersion; } //if (m_bookMerger != null) // m_bookMerger.Dispose(); m_bookMerger = new BookMerger(Cache, null, fMakePhilemonChanges ? m_philemonRev : bookRev); if (fMakePhilemonChanges) { MakeChangesInPhilemonCurrent(); m_bookMerger.DetectDifferences(null); Assert.AreEqual(6, m_bookMerger.Differences.Count, "Problem in Initialize (unexpected number of diffs)"); } m_styleSheet = new FwStyleSheet(); m_styleSheet.Init(Cache, m_scr.Hvo, (int)Scripture.ScriptureTags.kflidStyles); Debug.Assert(m_dlg == null, "m_dlg is not null."); //if (m_dlg != null) // m_dlg.Dispose(); m_dlg = new DummyDiffDialog(m_bookMerger, Cache, m_styleSheet, null); m_dlg.CreateControl(); // Pieces that may be needed for merging BT segments. using (new SuppressSubTasks(Cache)) { EnsureAnnDefn(LangProject.kguidAnnTextSegment); EnsureAnnDefn(LangProject.kguidAnnFreeTranslation); EnsureAnnDefn(LangProject.kguidAnnWordformInContext); EnsureAnnDefn(LangProject.kguidAnnPunctuationInContext); if (Cache.LangProject.WordformInventoryOA == null) { WordformInventory wfi = new WordformInventory(); Cache.LangProject.WordformInventoryOA = wfi; } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Completes the initialize. Every test needs to call this before initializing. /// We don't include this in the initialize run before every test because, if we want /// to create another archive, it will cause a crash. /// </summary> /// <param name="fMakePhilemonChanges">if <c>true</c> make changes in Philemon and /// detect differences</param> /// <param name="bookRev">the book to use for the revision in the bookmerger.</param> /// ------------------------------------------------------------------------------------ private void CompleteInitialize(bool fMakePhilemonChanges, IScrBook bookRev) { Debug.Assert(m_bookMerger == null, "m_bookMerger is not null."); if (fMakePhilemonChanges) { using (UndoableUnitOfWorkHelper undoHelper = new UndoableUnitOfWorkHelper( m_actionHandler, "revision")) { m_philemonCurr = m_scr.FindBook(57); m_draft = Cache.ServiceLocator.GetInstance<IScrDraftFactory>().Create("PhilemonArchive", new IScrBook[] { m_philemonCurr }); m_philemonRev = m_draft.FindBook(57); m_draft.Type = ScrDraftType.ImportedVersion; undoHelper.RollBack = false; } } m_bookMerger = new BookMerger(Cache, null, fMakePhilemonChanges ? m_philemonRev : bookRev); if (fMakePhilemonChanges) { using (UndoableUnitOfWorkHelper undoHelper = new UndoableUnitOfWorkHelper( m_actionHandler, "Philemon changes")) { MakeChangesInPhilemonCurrent(); m_bookMerger.DetectDifferences(null); Assert.AreEqual(6, m_bookMerger.Differences.Count, "Problem in TestSetup (unexpected number of diffs)"); undoHelper.RollBack = false; } } m_styleSheet = new FwStyleSheet(); m_styleSheet.Init(Cache, m_scr.Hvo, ScriptureTags.kflidStyles); Debug.Assert(m_dlg == null, "m_dlg is not null."); //if (m_dlg != null) // m_dlg.Dispose(); m_dlg = new DummyDiffDialog(m_bookMerger, Cache, m_styleSheet, null); m_dlg.CreateControl(); }