diff options
author | Joni Poikelin <joni.poikelin@theqtcompany.com> | 2016-03-30 10:46:59 +0300 |
---|---|---|
committer | Joni Poikelin <joni.poikelin@theqtcompany.com> | 2016-04-01 07:35:38 +0000 |
commit | bed6b3d633d83302a8e2167845db4b36e6847f0b (patch) | |
tree | 761e59bd982090979e8ff8098a4a79ea90d8f05e /tests | |
parent | c59c43bbc44026a508746b1de2505f6185bd0310 (diff) |
Fix ScrollBars with paddings
Padding was not taken into account when calculating the new position,
which caused there to be small offset between the mouse press and the
resulting handle position by the amount of padding used.
Task-number: QTBUG-52233
Change-Id: Ibd8c4375b030a27a6124aefc4bc9af570d14d3a9
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_scrollbar.qml | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/auto/controls/data/tst_scrollbar.qml b/tests/auto/controls/data/tst_scrollbar.qml index 55f31e12..6e021ccf 100644 --- a/tests/auto/controls/data/tst_scrollbar.qml +++ b/tests/auto/controls/data/tst_scrollbar.qml @@ -57,7 +57,7 @@ TestCase { Component { id: scrollBar - ScrollBar { } + ScrollBar { padding: 0 } } Component { @@ -210,4 +210,20 @@ TestCase { control.destroy() } + + function test_padding_data() { + return [ + { tag: "horizontal", properties: { visible: true, orientation: Qt.Horizontal, width: testCase.width, leftPadding: testCase.width * 0.1 } }, + { tag: "vertical", properties: { visible: true, orientation: Qt.Vertical, height: testCase.height, topPadding: testCase.height * 0.1 } } + ] + } + + function test_padding(data) { + var control = scrollBar.createObject(testCase, data.properties) + + mousePress(control, control.leftPadding + control.availableWidth * 0.5, control.topPadding + control.availableHeight * 0.5, Qt.LeftButton) + mouseRelease(control, control.leftPadding + control.availableWidth * 0.5, control.topPadding + control.availableHeight * 0.5, Qt.LeftButton) + + compare(control.position, 0.5) + } } |