/// ----------------------------------------------------------------------------------- /// <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); }
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"); } } }