Ejemplo n.º 1
0
            // 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));
            }
Ejemplo n.º 2
0
        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));
            }
        }
Ejemplo n.º 3
0
 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();
     }
 }
Ejemplo n.º 4
0
 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();
     }
 }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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)); });
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
 public void SetUp()
 {
     vScrollBar.SetToMinimum();
 }