summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@digia.com>2013-08-27 10:50:42 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-27 17:02:16 +0200
commitc304d741a27b5822a35d1fb83f8f5e65719907ce (patch)
tree8e225145af5b5b41679eacbfd3fa3e582655cd5f /tests
parent4031642ed61892bba4a7e56294085676924adce4 (diff)
downloadqtquickcontrols-c304d741a27b5822a35d1fb83f8f5e65719907ce.tar.gz
qtquickcontrols-c304d741a27b5822a35d1fb83f8f5e65719907ce.tar.bz2
qtquickcontrols-c304d741a27b5822a35d1fb83f8f5e65719907ce.zip
Fix scroll bar behavior when clickToPosition is enabled
There were two issues with the scrollbar when using this behavior: Issue 1 - The scroll bar did not account for the grooveRect position, so the handle was not centered correctly around the mouse cursor. Issue 2 - When click-and-holding outside the handle area, you could not continue to move the handle afterwards. Task-number: QTBUG-33133 Change-Id: I251f684f767ce5a372eb0d2b5e6c421f88ac7fbe Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_scrollview.qml24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_scrollview.qml b/tests/auto/controls/data/tst_scrollview.qml
index d5c3e008..7c476122 100644
--- a/tests/auto/controls/data/tst_scrollview.qml
+++ b/tests/auto/controls/data/tst_scrollview.qml
@@ -90,6 +90,30 @@ TestCase {
scrollView.destroy()
}
+ function test_clickToCenter() {
+
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ import QtQuick.Controls.Styles 1.0; \
+ ScrollView { \
+ id: _control1; \
+ width: 100 ; height: 100; \
+ Item { width: 200; height: 200 }\
+ activeFocusOnTab: true; \
+ style:ScrollViewStyle{} \
+ } '
+ var scrollView = Qt.createQmlObject(test_control, container, '')
+ verify(scrollView !== null, "view created is null")
+ verify(scrollView.flickableItem.contentY === 0)
+
+ mouseClick(scrollView, scrollView.width -2, scrollView.height/2, Qt.LeftButton)
+ verify(Math.round(scrollView.flickableItem.contentY) === 100)
+
+ verify(scrollView.flickableItem.contentX === 0)
+ mouseClick(scrollView, scrollView.width/2, scrollView.height - 2, Qt.LeftButton)
+ verify(Math.round(scrollView.flickableItem.contentX) === 100)
+ }
+
function test_viewport() {
var component = scrollViewComponent
var scrollView = component.createObject(testCase);