/// <summary/> public override void TestTearDown() { m_group.Dispose(); m_group = null; base.TestTearDown(); }
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 TestSetup() { base.TestSetup(); m_group = m_draftForm.CreateSyncDraftView(Cache); }
public void TestCastAsIVwRootSiteWhenGroupIsEmpty() { using (RootSiteGroup group = new RootSiteGroup()) { Assert.IsNull(group.CastAsIVwRootSite()); } }
/// ----------------------------------------------------------------------------------- /// <summary> /// Creates 2 sync'd draftviews in a form. Loads scripture from the DB. /// </summary> /// <param name="cache">The cache, believe it or not</param> /// ----------------------------------------------------------------------------------- public RootSiteGroup CreateSyncDraftView(FdoCache cache) { CheckDisposed(); Cache = cache; RootSiteGroup group = new RootSiteGroup(cache, (int)TeViewGroup.Scripture); DummyDraftView draft1 = CreateDummyDraftView(false, false); m_draftView = CreateDummyDraftView(false, false); group.AddToSyncGroup(draft1); group.AddToSyncGroup(m_draftView); group.ScrollingController = m_draftView; draft1.MakeRoot(); draft1.Visible = true; m_draftView.MakeRoot(); m_draftView.Visible = true; Controls.Add(group); group.Show(); return group; }
/// <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_draftForm != null) m_draftForm.Dispose(); if (m_IgnorePropChanged != null) m_IgnorePropChanged.Dispose(); } // Dispose unmanaged resources here, whether disposing is true or false. m_draftForm = null; m_draftView = null; // Comes from m_draftForm, which is to dispose it. m_group = null; m_IgnorePropChanged = null; base.Dispose(disposing); }
public override void Exit() { CheckDisposed(); m_draftView = null; m_draftForm.Close(); m_draftForm = null; m_group = null; m_IgnorePropChanged.Dispose(); m_IgnorePropChanged = null; // Restore prompt setting m_IgnorePropChanged.Dispose(); base.Exit(); }
public override void Initialize() { CheckDisposed(); base.Initialize(); m_draftForm = new DummyDraftViewForm(); m_draftForm.DeleteRegistryKey(); m_group = m_draftForm.CreateSyncDraftView(Cache); m_IgnorePropChanged = new IgnorePropChanged(Cache, PropChangedHandling.SuppressChangeWatcher); m_draftView = m_draftForm.DraftView; m_draftView.RootBox.MakeSimpleSel(true, true, false, true); Application.DoEvents(); }