コード例 #1
0
        public void NotifyScrollValueChanged_ScrollerInactive_StaysDeactivated()
        {
            AutoScroller autoScroller = CreateAutoScroller(
                out IScrollView scrollView,
                out IRectangle content,
                out IActivateable elementToStartScroller);

            autoScroller.ScrollerActive = false;

            autoScroller.NotifyScrollValueChanged();

            Assert.False(autoScroller.ScrollerActive);
        }
コード例 #2
0
        public void NotifyScrollValueChanged_UserScrolled_DeactivatesScroller()
        {
            AutoScroller autoScroller = CreateAutoScroller(
                out IScrollView scrollView,
                out IRectangle content,
                out IActivateable elementToStartScroller);

            autoScroller.ScrollerActive = true;

            // no changes to content size => manual scrolling
            autoScroller.NotifyScrollValueChanged();

            Assert.False(autoScroller.ScrollerActive);
        }
コード例 #3
0
        public void NotifyScrollValueChanged_ScrollerInactiveContentSizeChanged_NoScrollToBottom()
        {
            AutoScroller autoScroller = CreateAutoScroller(
                out IScrollView scrollView,
                out IRectangle content,
                out IActivateable elementToStartScroller);

            autoScroller.ScrollerActive = false;

            content.Size = Vector2.one;
            scrollView.NormalizedPosition = Vector2.one;

            autoScroller.NotifyScrollValueChanged();

            Assert.AreEqual(1, scrollView.NormalizedPosition.y);
        }
コード例 #4
0
        public void NotifyScrollValueChanged_ContentSizeChanged_KeepsScrollerActive()
        {
            AutoScroller autoScroller = CreateAutoScroller(
                out IScrollView scrollView,
                out IRectangle content,
                out IActivateable elementToStartScroller);

            autoScroller.ScrollerActive = true;

            content.Size = Vector2.one;

            // changes to content size => no manual scrolling
            autoScroller.NotifyScrollValueChanged();

            Assert.True(autoScroller.ScrollerActive);
        }
コード例 #5
0
        public void NotifyScrollValueChanged_ContentSizeChanged_ScrollToBottom()
        {
            AutoScroller autoScroller = CreateAutoScroller(
                out IScrollView scrollView,
                out IRectangle content,
                out IActivateable elementToStartScroller);

            autoScroller.ScrollerActive = true;

            content.Size = Vector2.one;
            scrollView.NormalizedPosition = Vector2.one;

            // changes to content size => no manual scrolling
            autoScroller.NotifyScrollValueChanged();

            Assert.AreEqual(0, scrollView.NormalizedPosition.y);
        }