// ReSharper disable once UnusedMethodReturnValue.Local private static bool EnsureTestCaseNodeIsOnScreen(TreeNode node) { if (SafeIsNodeOnScreen(node)) { return(true); } Tree tree = GetTestCaseTree(); IVScrollBar scrollBar = tree.ScrollBars.Vertical; double initialValue = scrollBar.Value; while (scrollBar.Value < scrollBar.MaximumValue && !SafeIsNodeOnScreen(node)) { scrollBar.ScrollDownLarge(); } if (!SafeIsNodeOnScreen(node)) { scrollBar.SetToMinimum(); while (scrollBar.Value < initialValue && !SafeIsNodeOnScreen(node)) { scrollBar.ScrollDownLarge(); } } return(SafeIsNodeOnScreen(node)); }
public void ShouldScrollDownLarge() { double currentValue = vScrollBar.Value; vScrollBar.ScrollDownLarge(); vScrollBar.ScrollDownLarge(); vScrollBar.ScrollDownLarge(); Assert.AreEqual(currentValue + (largeChange * 3), vScrollBar.Value, 0.001d); }
public void ShouldScrollDownLarge() { var currentValue = vScrollBar.Value; vScrollBar.ScrollDownLarge(); vScrollBar.ScrollDownLarge(); vScrollBar.ScrollDownLarge(); Assert.That(vScrollBar.Value, Is.EqualTo(currentValue + (largeChange * 3)).Within(3)); }
protected override void TestFixtureSetUp() { listBox = window.Get <ListBox>("listBoxWithVScrollBar"); vScrollBar = listBox.ScrollBars.Vertical; vScrollBar.ScrollDown(); smallChange = vScrollBar.Value; vScrollBar.ScrollUp(); vScrollBar.ScrollDownLarge(); largeChange = vScrollBar.Value; vScrollBar.ScrollUpLarge(); }
protected override void TestFixtureSetUp() { listBox = Window.Get<ListBox>("listBoxWithVScrollBar"); vScrollBar = listBox.ScrollBars.Vertical; vScrollBar.ScrollDown(); smallChange = vScrollBar.Value; vScrollBar.ScrollUp(); vScrollBar.ScrollDownLarge(); largeChange = vScrollBar.Value; vScrollBar.ScrollUpLarge(); }
internal virtual void MakeVisible(VerticalSpanProvider verticalSpanProvider) { if (verticalScroll == null) { logger.DebugFormat("Vertical scrollbar not present in parent of {0}", uiItem); return; } if (!verticalScroll.IsScrollable) { logger.DebugFormat("Vertical scrollbar is not scrollable for parent of {0}", uiItem); return; } VerticalSpan verticalSpan = verticalSpanProvider.VerticalSpan; if (verticalSpan.Contains(uiItem.Bounds)) { logger.DebugFormat("UIItem ({0}) whose bounds are ({1}) is within bounds of parent whose vertical span is {2}", uiItem, uiItem.Bounds, verticalSpan); return; } if (verticalScroll.IsNotMinimum) { verticalScroll.SetToMinimum(); verticalSpan = verticalSpanProvider.VerticalSpan; logger.DebugFormat("Scroll Position set to minimum value."); } if (verticalSpan.Contains(uiItem.Bounds)) { logger.DebugFormat("UIItem ({0}) whose bounds are ({1}) is within bounds of parent whose vertical span is {2}", uiItem, uiItem.Bounds, verticalSpan); return; } logger.DebugFormat("Trying to make visible {0}, item's bounds are {1} and parent's span is {2}", uiItem, uiItem.Bounds, verticalSpan); var success = Retry.For( () => { verticalScroll.ScrollDownLarge(); var bounds = uiItem.Bounds; const string messageFormat = "Trying to make {0} visible, item's bounds are {1} and parent's span is {2}"; logger.DebugFormat(messageFormat, uiItem, bounds, verticalSpan); return(verticalSpan.Contains(bounds)); }, CoreAppXmlConfiguration.Instance.BusyTimeout(), TimeSpan.FromMilliseconds(0)); if (!success) { throw new UIActionException(string.Format("Could not make the {0} visible{1}", uiItem, Constants.BusyMessage)); } }
public void Setup() { listBox = MainWindow.Get<ListBox>("ListBoxWithVScrollBar"); vScrollBar = listBox.ScrollBars.Vertical; vScrollBar.ScrollDown(); smallChange = vScrollBar.Value; vScrollBar.ScrollUp(); vScrollBar.ScrollDownLarge(); largeChange = vScrollBar.Value; vScrollBar.ScrollUpLarge(); if (vScrollBar.IsNotMinimum) { vScrollBar.SetToMinimum(); } }
public void Setup() { listBox = MainWindow.Get <ListBox>("ListBoxWithVScrollBar"); vScrollBar = listBox.ScrollBars.Vertical; vScrollBar.ScrollDown(); smallChange = vScrollBar.Value; vScrollBar.ScrollUp(); vScrollBar.ScrollDownLarge(); largeChange = vScrollBar.Value; vScrollBar.ScrollUpLarge(); if (vScrollBar.IsNotMinimum) { vScrollBar.SetToMinimum(); } }
protected override void ExecuteTestRun(WindowsFramework framework) { listBox = MainWindow.Get<ListBox>("ListBoxWithVScrollBar"); vScrollBar = listBox.ScrollBars.Vertical; vScrollBar.ScrollDown(); smallChange = vScrollBar.Value; vScrollBar.ScrollUp(); vScrollBar.ScrollDownLarge(); largeChange = vScrollBar.Value; vScrollBar.ScrollUpLarge(); if (vScrollBar.IsNotMinimum) vScrollBar.SetToMinimum(); RunTest(ShouldGetVerticalScrollBar); RunTest(ShouldScrollDown); RunTest(ShouldScrollDownLarge); RunTest(ShouldScrollUp); RunTest(ShouldScrollUpLarge); }
internal virtual void MakeVisible(VerticalSpanProvider verticalSpanProvider) { if (verticalScroll == null) { WhiteLogger.Instance.DebugFormat("Vertical scrollbar not present in parent of {0}", uiItem); return; } if (!verticalScroll.IsScrollable) { WhiteLogger.Instance.DebugFormat("Vertical scrollbar is not scrollable for parent of {0}", uiItem); return; } VerticalSpan verticalSpan = verticalSpanProvider.VerticalSpan; if (verticalScroll.IsNotMinimum) { verticalScroll.SetToMinimum(); verticalSpan = verticalSpanProvider.VerticalSpan; WhiteLogger.Instance.DebugFormat("Scroll Position set to minimum value."); } if (verticalSpan.Contains(uiItem.Bounds)) { WhiteLogger.Instance.DebugFormat("UIItem ({0}) whose bounds are ({1}) is within bounds of parent whose vertical span is {2}", uiItem, uiItem.Bounds, verticalSpan); return; } WhiteLogger.Instance.DebugFormat("Trying to make visible {0}, item's bounds are {1} and parent's span is {2}", uiItem, uiItem.Bounds, verticalSpan); var clock = new Clock(CoreAppXmlConfiguration.Instance.BusyTimeout, 0); clock.RunWhile(() => verticalScroll.ScrollDownLarge(), delegate { Rect bounds = uiItem.Bounds; WhiteLogger.Instance.DebugFormat( "Trying to make visible {0}, item's bounds are {1} and parent's span is {2}", uiItem, bounds, verticalSpan); return(verticalSpan.DoesntContain(bounds)); }, delegate { throw new UIActionException(string.Format("Could not make the {0} visible{1}", uiItem, Constants.BusyMessage)); }); }
protected override void ExecuteTestRun(WindowsFramework framework) { listBox = MainWindow.Get <ListBox>("ListBoxWithVScrollBar"); vScrollBar = listBox.ScrollBars.Vertical; vScrollBar.ScrollDown(); smallChange = vScrollBar.Value; vScrollBar.ScrollUp(); vScrollBar.ScrollDownLarge(); largeChange = vScrollBar.Value; vScrollBar.ScrollUpLarge(); if (vScrollBar.IsNotMinimum) { vScrollBar.SetToMinimum(); } RunTest(ShouldGetVerticalScrollBar); RunTest(ShouldScrollDown); RunTest(ShouldScrollDownLarge); RunTest(ShouldScrollUp); RunTest(ShouldScrollUpLarge); }