/// <summary> /// Correct way to deal with FixtureTearDown for class that derive from BaseTest. /// </summary> /// <param name="disposing"></param> protected override void Dispose(bool disposing) { if (IsDisposed) { return; } if (disposing) { if (m_testTeApp != null) { m_testTeApp.ExitAppplication(); m_testTeApp.Dispose(); } if (m_regData != null) { m_regData.RestoreRegistryData(); } Unpacker.RemoveParatextTestProjects(); } m_testTeApp = null; base.Dispose(disposing); }
public override void FixtureSetup() { CheckDisposed(); base.FixtureSetup(); // TeApp derives from FwApp m_testTeApp = new TestTeApp(new string[] { "-c", m_sSvrName, // ComputerName (aka the SQL server) "-proj", m_ProjName, // ProjectName "-db", m_sDbName }); // DatabaseName m_fMainWindowOpened = m_testTeApp.OpenMainWindow(); }
public override void FixtureSetup() { CheckDisposed(); base.FixtureSetup(); Unpacker.UnPackParatextTestProjects(); m_regData = Unpacker.PrepareRegistryForPTData(); // TeApp derives from FwApp m_testTeApp = new TestTeApp(new string[] { "-c", m_sSvrName, // ComputerName (aka the SQL server) "-proj", m_ProjName, // ProjectName "-db", m_sDbName }); // DatabaseName m_fMainWindowOpened = m_testTeApp.OpenMainWindow(); }
/// <summary> /// Correct way to deal with FixtureTearDown for class that derive from BaseTest. /// </summary> /// <param name="disposing"></param> protected override void Dispose(bool disposing) { if (IsDisposed) { return; } if (disposing) { if (m_testTeApp != null) { m_testTeApp.ExitAppplication(); m_testTeApp.Dispose(); } } m_testTeApp = null; base.Dispose(disposing); }
public void Init() { CheckDisposed(); Unpacker.UnPackParatextTestProjects(); m_regData = Unpacker.PrepareRegistryForPTData(); // TeApp derives from FwApp m_testTeApp = new TestTeApp(new string[] { "-c", m_sSvrName, // ComputerName (aka the SQL server) "-proj", m_ProjName, // ProjectName "-db", m_sDbName }); // DatabaseName m_fMainWindowOpened = m_testTeApp.OpenMainWindow(); if (m_fMainWindowOpened) { m_firstMainWnd = (TestTeMainWnd)m_testTeApp.MainWindows[0]; // reload the styles from the database (test may have inserted new styles!) m_firstMainWnd.Synchronize(new SyncInfo(SyncMsg.ksyncStyle, 0, 0)); // Set the view to the DraftView m_firstMainWnd.SelectScriptureDraftView(); Application.DoEvents(); // insert book tests create filters - turn them off to prevent interaction // between tests m_firstMainWnd.TurnOffAllFilters(); m_firstDraftView = (TestTeDraftView)m_firstMainWnd.TheDraftView; m_firstDraftView.ActivateView(); SelectionHelper helper = m_firstDraftView.SetInsertionPoint(0, 0, 0, 0, true); // helper.IhvoEndPara = -1; helper.SetSelection(m_firstDraftView, true, true); // we don't want to open a transaction! } }
public void CleanUp() { CheckDisposed(); bool wipedOutStuff = false; if (m_fMainWindowOpened) { try { // Undo everything that we can undo - checking to make sure we are not // in an infinite loop int undoCount = 0; while (m_firstMainWnd.Cache.CanUndo) { if (++undoCount <= 10) { m_firstMainWnd.SimulateEditUndoClick(); Application.DoEvents(); } else { // Do a complete clean up and re-init so next test can run // without impact from this test. wipedOutStuff = true; if (m_testTeApp != null) { m_testTeApp.ExitAppplication(); m_testTeApp.Dispose(); m_testTeApp = null; } if (m_regData != null) { m_regData.RestoreRegistryData(); } Unpacker.RemoveParatextTestProjects(); return; } } m_firstMainWnd.Cache.ActionHandlerAccessor.Commit(); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Got exception in UndoRedoTests.CleanUp: " + e.Message); } } if (!wipedOutStuff) { if (m_testTeApp != null) { m_testTeApp.ExitAppplication(); m_testTeApp.Dispose(); m_testTeApp = null; } if (m_regData != null) { m_regData.RestoreRegistryData(); } Unpacker.RemoveParatextTestProjects(); } }