/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="rootSite"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="rootb"></param> /// ------------------------------------------------------------------------------------ private void PrepareView(DummyBasicView rootSite, int width, int height, IVwRootBox rootb) { rootSite.Visible = false; rootSite.Width = width; rootSite.Height = height; rootSite.SetRootBox(rootb); }
public override void TestSetup() { base.TestSetup(); var styleSheet = new FwStyleSheet(); styleSheet.Init(Cache, m_scr.Hvo, ScriptureTags.kflidStyles); Debug.Assert(m_basicView == null, "m_basicView is not null."); //if (m_basicView != null) // m_basicView.Dispose(); m_basicView = CreateDummyBasicView(); m_basicView.Cache = Cache; m_basicView.Visible = false; m_basicView.StyleSheet = styleSheet; }
public override void Initialize() { CheckDisposed(); base.Initialize(); FwStyleSheet styleSheet = new FwStyleSheet(); styleSheet.Init(Cache, m_scr.Hvo, (int)Scripture.ScriptureTags.kflidStyles); Debug.Assert(m_basicView == null, "m_basicView is not null."); //if (m_basicView != null) // m_basicView.Dispose(); m_basicView = CreateDummyBasicView(); m_basicView.Cache = Cache; m_basicView.Visible = false; m_basicView.StyleSheet = styleSheet; }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { // Dispose managed resources here. if (m_basicView != null) { m_basicView.Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_basicView = null; base.Dispose(disposing); }
public void AdjustScrollRange() { DynamicMock rootBox = new DynamicMock(typeof(IVwRootBox)); // This was taken out because it doesn't seem like the views code does this // anymore. It just calls AdjustScrollRange for the original view that changed. // Done as a part of TE-3576 //// result for style pane //rootBox.ExpectAndReturn("Height", 900); //rootBox.ExpectAndReturn("Width", 100); //rootBox.ExpectAndReturn("Height", 1000); //rootBox.ExpectAndReturn("Width", 100); //rootBox.ExpectAndReturn("Height", 1000); //rootBox.ExpectAndReturn("Width", 100); //// result for draft pane //rootBox.ExpectAndReturn("Height", 950); //rootBox.ExpectAndReturn("Width", 100); //rootBox.ExpectAndReturn("Height", 900); //rootBox.ExpectAndReturn("Width", 100); //rootBox.ExpectAndReturn("Height", 1000); //rootBox.ExpectAndReturn("Width", 100); // result for bt pane rootBox.ExpectAndReturn("Height", 1100); rootBox.ExpectAndReturn("Width", 100); rootBox.ExpectAndReturn("Height", 900); rootBox.ExpectAndReturn("Width", 100); rootBox.ExpectAndReturn("Height", 950); rootBox.ExpectAndReturn("Width", 100); using (DummyBasicView stylePane = new DummyBasicView(), draftPane = new DummyBasicView(), btPane = new DummyBasicView()) { using (RootSiteGroup group = new RootSiteGroup()) { PrepareView(stylePane, 50, 300, (IVwRootBox)rootBox.MockInstance); PrepareView(draftPane, 150, 300, (IVwRootBox)rootBox.MockInstance); PrepareView(btPane, 150, 300, (IVwRootBox)rootBox.MockInstance); group.AddToSyncGroup(stylePane); group.AddToSyncGroup(draftPane); group.AddToSyncGroup(btPane); group.ScrollingController = btPane; group.Controls.AddRange(new Control[] { stylePane, draftPane, btPane } ); btPane.ScrollMinSize = new Size(100, 1000); btPane.ScrollPosition = new Point(0, 700); // now call AdjustScrollRange on each of the panes. // This simulates what the views code does. // This was taken out because it doesn't seem like the views code does this // anymore. It just calls AdjustScrollRange for the original view that changed. // Done as a part of TE-3576 //stylePane.AdjustScrollRange(null, 0, 0, -100, 500); //draftPane.AdjustScrollRange(null, 0, 0, -50, 500); btPane.AdjustScrollRange(null, 0, 0, 100, 500); Assert.AreEqual(1108, btPane.ScrollMinSize.Height, "Wrong ScrollMinSize"); Assert.AreEqual(800, -btPane.ScrollPosition.Y, "Wrong scroll position"); } } }
/// ----------------------------------------------------------------------------------- /// <summary> /// Close the draft view /// </summary> /// ----------------------------------------------------------------------------------- public override void TestTearDown() { m_basicView.Dispose(); m_basicView = null; base.TestTearDown(); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Create a new basic view /// </summary> /// ----------------------------------------------------------------------------------- public override void TestSetup() { base.TestSetup(); var styleSheet = new FwStyleSheet(); styleSheet.Init(Cache, m_scr.Hvo, ScriptureTags.kflidStyles); Debug.Assert(m_basicView == null, "m_basicView is not null."); m_basicView = new DummyBasicView {Cache = Cache, Visible = false, StyleSheet = styleSheet}; }
public override void Exit() { CheckDisposed(); if (m_dlg != null) { if (m_dlg.IsHandleCreated) m_dlg.Close(); m_dlg.Dispose(); m_dlg = null; } if (m_vwRootsite != null) { m_vwRootsite.Dispose(); m_vwRootsite = null; } if (m_vwPattern != null) { if (Marshal.IsComObject(m_vwPattern)) Marshal.ReleaseComObject(m_vwPattern); m_vwPattern = null; } if (m_Stylesheet != null) { if (Marshal.IsComObject(m_Stylesheet)) Marshal.ReleaseComObject(m_Stylesheet); m_Stylesheet = null; } m_text = null; base.Exit(); }
public override void TestSetup() { base.TestSetup(); m_vwPattern = VwPatternClass.Create(); m_Stylesheet = new TestFwStylesheet(); m_vwRootsite = new DummyBasicView(); m_vwRootsite.StyleSheet = m_Stylesheet; m_vwRootsite.Cache = Cache; m_vwRootsite.DisplayType = DummyBasicViewVc.DisplayType.kNormal | DummyBasicViewVc.DisplayType.kDuplicateParagraphs; m_vwRootsite.MakeRoot(m_text.Hvo, ScrBookTags.kflidTitle, 3); m_dlg = new DummyFwFindReplaceDlg(); }
public override void Exit() { CheckDisposed(); m_basicView.Dispose(); m_basicView = null; base.Exit(); }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; if (disposing) { // Dispose managed resources here. if (m_basicView != null) m_basicView.Dispose(); } // Dispose unmanaged resources here, whether disposing is true or false. m_basicView = null; base.Dispose(disposing); }
public virtual void CleanUp() { CheckDisposed(); UndoResult ures = 0; while (m_fdoCache.CanUndo) { m_fdoCache.Undo(out ures); if (ures == UndoResult.kuresFailed || ures == UndoResult.kuresError) Assert.Fail("ures should not be == " + ures.ToString()); } // Some tests are not at all happy to have m_basicView be disposed befroe the undoing. m_basicView.Dispose(); m_basicView = null; m_fdoCache.Dispose(); m_fdoCache = null; }
public virtual void Initialize() { CheckDisposed(); Debug.Assert(m_fdoCache == null, "m_fdoCache is not null."); //if (m_fdoCache != null) // m_fdoCache.Dispose(); m_fdoCache = GetCache(); FwStyleSheet styleSheet = new FwStyleSheet(); ILangProject lgproj = m_fdoCache.LangProject; IScripture scripture = lgproj.TranslatedScriptureOA; styleSheet.Init(m_fdoCache, scripture.Hvo, (int)Scripture.ScriptureTags.kflidStyles); Debug.Assert(m_basicView == null, "m_basicView is not null."); //if (m_basicView != null) // m_basicView.Dispose(); m_basicView = new DummyBasicView(); m_basicView.Cache = m_fdoCache; m_basicView.Visible = false; m_basicView.StyleSheet = styleSheet; }
public override void TestTearDown() { // FdoTestBase::TestTeardown uses m_actionHandler which seems to // require its associated RootBox to have a valid root site. // This m_basicView needs to be disposed after FdoTestBase::TestTeardown is called. base.TestTearDown(); if (m_basicView != null) m_basicView.Dispose(); m_basicView = null; }
public override void TestSetup() { base.TestSetup(); IWritingSystemManager wsManager = Cache.ServiceLocator.WritingSystemManager; m_genesis = AddBookToMockedScripture(1, "Genesis"); m_text = AddTitleToMockedBook(m_genesis, m_kTitleText, wsManager.GetWsFromStr("en-fonipa-x-etic")); m_vwPattern = VwPatternClass.Create(); m_Stylesheet = new TestFwStylesheet(); m_vwRootsite = new DummyBasicView(); m_vwRootsite.StyleSheet = m_Stylesheet; m_vwRootsite.Cache = Cache; m_vwRootsite.DisplayType = DummyBasicViewVc.DisplayType.kMappedPara; // Needed for some footnote tests m_vwRootsite.MakeRoot(m_text.Hvo, ScrBookTags.kflidTitle, 3); m_dlg = new DummyFwFindReplaceDlg(); IWritingSystemContainer wsContainer = Cache.ServiceLocator.WritingSystems; wsContainer.AnalysisWritingSystems.Add(wsManager.Get("en-fonipa-x-etic")); wsContainer.AnalysisWritingSystems.Add(wsManager.Get("fr")); wsContainer.AnalysisWritingSystems.Add(wsManager.Get("de")); wsContainer.AnalysisWritingSystems.Add(wsManager.Get("es")); wsContainer.AnalysisWritingSystems.Add(wsManager.Get("ur")); }
public void AdjustScrollRange() { DynamicMock rootBox = new DynamicMock(typeof(IVwRootBox)); // This was taken out because it doesn't seem like the views code does this // anymore. It just calls AdjustScrollRange for the original view that changed. // Done as a part of TE-3576 //// result for style pane //rootBox.ExpectAndReturn("Height", 900); //rootBox.ExpectAndReturn("Width", 100); //rootBox.ExpectAndReturn("Height", 1000); //rootBox.ExpectAndReturn("Width", 100); //rootBox.ExpectAndReturn("Height", 1000); //rootBox.ExpectAndReturn("Width", 100); //// result for draft pane //rootBox.ExpectAndReturn("Height", 950); //rootBox.ExpectAndReturn("Width", 100); //rootBox.ExpectAndReturn("Height", 900); //rootBox.ExpectAndReturn("Width", 100); //rootBox.ExpectAndReturn("Height", 1000); //rootBox.ExpectAndReturn("Width", 100); // result for bt pane rootBox.ExpectAndReturn("Height", 1100); rootBox.ExpectAndReturn("Width", 100); rootBox.ExpectAndReturn("Height", 900); rootBox.ExpectAndReturn("Width", 100); rootBox.ExpectAndReturn("Height", 950); rootBox.ExpectAndReturn("Width", 100); using (DummyBasicView stylePane = new DummyBasicView(), draftPane = new DummyBasicView(), btPane = new DummyBasicView()) { using (RootSiteGroup group = new RootSiteGroup()) { PrepareView(stylePane, 50, 300, (IVwRootBox)rootBox.MockInstance); PrepareView(draftPane, 150, 300, (IVwRootBox)rootBox.MockInstance); PrepareView(btPane, 150, 300, (IVwRootBox)rootBox.MockInstance); group.AddToSyncGroup(stylePane); group.AddToSyncGroup(draftPane); group.AddToSyncGroup(btPane); group.ScrollingController = btPane; group.Controls.AddRange(new Control[] { stylePane, draftPane, btPane }); btPane.ScrollMinSize = new Size(100, 1000); btPane.ScrollPosition = new Point(0, 700); // now call AdjustScrollRange on each of the panes. // This simulates what the views code does. // This was taken out because it doesn't seem like the views code does this // anymore. It just calls AdjustScrollRange for the original view that changed. // Done as a part of TE-3576 //stylePane.AdjustScrollRange(null, 0, 0, -100, 500); //draftPane.AdjustScrollRange(null, 0, 0, -50, 500); btPane.AdjustScrollRange(null, 0, 0, 100, 500); Assert.AreEqual(1108, btPane.ScrollMinSize.Height, "Wrong ScrollMinSize"); Assert.AreEqual(800, -btPane.ScrollPosition.Y, "Wrong scroll position"); } } }
public override void TestTearDown() { if (m_dlg != null) { if (m_dlg.IsHandleCreated) m_dlg.Close(); m_dlg.Dispose(); m_dlg = null; } if (m_vwRootsite != null) { m_vwRootsite.Dispose(); m_vwRootsite = null; } if (m_vwPattern != null) { if (Marshal.IsComObject(m_vwPattern)) Marshal.ReleaseComObject(m_vwPattern); m_vwPattern = null; } if (m_Stylesheet != null) { if (Marshal.IsComObject(m_Stylesheet)) Marshal.ReleaseComObject(m_Stylesheet); m_Stylesheet = null; } m_text = null; m_genesis = null; base.TestTearDown(); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Creates and opens the given view in a form. /// </summary> /// ----------------------------------------------------------------------------------- protected void CreateView(DummyBasicView theView) { Cache = GetCache(); FwStyleSheet styleSheet = new FwStyleSheet(); ILangProject lgproj = Cache.LangProject; IScripture scripture = lgproj.TranslatedScriptureOA; styleSheet.Init(Cache, scripture.Hvo, (int)Scripture.ScriptureTags.kflidStyles); m_basicView = theView; m_basicView.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; m_basicView.Cache = Cache; m_basicView.Dock = DockStyle.Fill; m_basicView.Name = "basicView"; m_basicView.Visible = true; m_basicView.StyleSheet = styleSheet; Controls.Add(m_basicView); m_basicView.ActivateView(); }
public override void Initialize() { CheckDisposed(); base.Initialize(); m_vwPattern = VwPatternClass.Create(); m_Stylesheet = new TestFwStylesheet(); m_vwRootsite = new DummyBasicView(); m_vwRootsite.StyleSheet = m_Stylesheet; m_vwRootsite.Cache = Cache; m_vwRootsite.DisplayType = DummyBasicViewVc.DisplayType.kMappedPara; // Needed for some footnote tests m_vwRootsite.MakeRoot(m_text.Hvo, (int)ScrBook.ScrBookTags.kflidTitle, 3); m_dlg = new DummyFwFindReplaceDlg(); Cache.LanguageWritingSystemFactoryAccessor.BypassInstall = true; m_inMemoryCache.InitializeWritingSystemEncodings(); }