aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-06-08 23:04:06 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-06-16 08:45:42 +0000
commite96fd5f39158f775d45ae9a60564f00454b789ed (patch)
tree8de27d350b79b9190a3e3eacdc5935246ce8871a /tests/auto/controls
parent513363e940e0978931083544374bfe092107b9fb (diff)
ScrollBar: fix flashing in Material & Universal styles
Ensure a suitable starting opacity for the inactive state transition. When calling increase() and decrease() from key-handlers, as the docs suggest, we flash the scrollbar by turning the active state on, and then back off immediately. If there is an opacity animation when the scrollbar becomes active (Material & Universal), the opacity animation is stopped right away, because the state changes back to inactive. This state changing trick worked only with the Default style, because it changes the opacity without animating when it becomes active. Change-Id: I4117de79c7145a710c0b6c43873ca2336b64e21e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/controls')
-rw-r--r--tests/auto/controls/data/tst_scrollbar.qml40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_scrollbar.qml b/tests/auto/controls/data/tst_scrollbar.qml
index 6697de88..3e153ebb 100644
--- a/tests/auto/controls/data/tst_scrollbar.qml
+++ b/tests/auto/controls/data/tst_scrollbar.qml
@@ -736,4 +736,44 @@ TestCase {
container.destroy()
}
+
+ function test_flashing() {
+ var control = createTemporaryObject(scrollBar, testCase, {size: 0.2})
+ verify(control)
+
+ var activeSpy = signalSpy.createObject(control, {target: control, signalName: "activeChanged"})
+ verify(activeSpy.valid)
+
+ compare(control.active, false)
+ if (control.contentItem)
+ compare(control.contentItem.opacity, 0)
+ if (control.background)
+ compare(control.background.opacity, 0)
+
+ control.increase()
+ compare(control.position, 0.1)
+ compare(control.active, false)
+ compare(activeSpy.count, 2)
+ if (control.contentItem)
+ verify(control.contentItem.opacity > 0)
+ if (control.background)
+ verify(control.background.opacity > 0)
+ if (control.contentItem)
+ tryCompare(control.contentItem, "opacity", 0)
+ if (control.background)
+ tryCompare(control.background, "opacity", 0)
+
+ control.decrease()
+ compare(control.position, 0.0)
+ compare(control.active, false)
+ compare(activeSpy.count, 4)
+ if (control.contentItem)
+ verify(control.contentItem.opacity > 0)
+ if (control.background)
+ verify(control.background.opacity > 0)
+ if (control.contentItem)
+ tryCompare(control.contentItem, "opacity", 0)
+ if (control.background)
+ tryCompare(control.background, "opacity", 0)
+ }
}