Esempio n. 1
0
		public void TestSetup()
		{
			Debug.Assert(m_testTeApp == null, "Why does it have something in m_testTeApp here?");
			Unpacker.UnPackParatextTestProjects();
			m_regData = Unpacker.PrepareRegistryForPTData();
			m_teSubKey = Registry.CurrentUser.CreateSubKey(@"Software\SIL\FieldWorks\Translation Editor");

			// save the width of the style pane, only if it already has a value
			// Tests will fail if the style pane is showing, so we turn it off.
			object keyValue = m_teSubKey.GetValue("DraftStyleAreaWidth");
			if (keyValue != null)
			{
				m_draftAreaStyleWidth = (int)keyValue;
				m_teSubKey.SetValue("DraftStyleAreaWidth", 0);
			}

			// TeApp derives from FwApp
			// Make sure the registry thinks the last time an attempt was made to open TE
			// was successful. Otherwise, the welcome dialog shows up in the middle of tests.
			RegistryBoolSetting successfulStartup = new RegistryBoolSetting(FwSubKey.TE, "OpenSuccessful", true);
			successfulStartup.Value = true;

			// TODO: Figure out what we need to pass into the app
			m_testTeApp = new TestTeApp(new string[0]);

			m_fMainWindowOpened = m_testTeApp.OpenMainWindow();
			Assert.AreEqual(1, m_testTeApp.MainWindows.Count);

			// Sidebar buttons get pressed as part of main window initialization;
			// wait for that initialization to finish before we proceed.
			while (DataUpdateMonitor.IsUpdateInProgress(
				((TestTeMainWnd)m_testTeApp.MainWindows[0]).Cache.MainCacheAccessor))
			{
				Application.DoEvents();
			}

			if (m_fMainWindowOpened)
			{
				m_firstMainWnd = (TestTeMainWnd)m_testTeApp.MainWindows[0];
				m_firstMainWnd.CreateDraftView();
				// Set the view to the DraftView
				m_firstMainWnd.SwitchActiveView(m_firstMainWnd.TheDraftViewWrapper);
				Application.DoEvents();

				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);
				Application.DoEvents();
			}
		}
Esempio n. 2
0
		public void Init()
		{
			if (m_fMainWindowOpened)
			{
				if (m_testTeApp == null)
					StartTestApp();

				m_firstMainWnd = (TestTeMainWnd)m_testTeApp.MainWindows[0];
				if (m_firstMainWnd.ClientWindows.Count == 0)
					m_firstMainWnd.CreateDraftView();

				// Set the view to the DraftView
				m_firstMainWnd.SwitchActiveView(m_firstMainWnd.TheDraftViewWrapper);
				Application.DoEvents();

				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);
				Application.DoEvents();
			}
		}
Esempio n. 3
0
        public void Init()
        {
            CheckDisposed();
            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!
            }
        }
Esempio n. 4
0
		public void Init()
		{
			CheckDisposed();

			if (m_fMainWindowOpened)
			{
				m_firstMainWnd = (TestTeMainWnd)m_testTeApp.MainWindows[0];
				// Set the view to the DraftView
				m_firstMainWnd.SelectScriptureDraftView();
				Application.DoEvents();

				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);

				if (!m_firstMainWnd.Cache.DatabaseAccessor.IsTransactionOpen())
					m_firstMainWnd.Cache.DatabaseAccessor.BeginTrans();
				m_firstMainWnd.Cache.BeginUndoTask("Undo TeAppTest", "Redo TeAppTest");
			}
		}
Esempio n. 5
0
        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!
            }
        }