1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
From bf7ead578d39c9b279c5fd8f4e458923280a4dcb Mon Sep 17 00:00:00 2001
From: Noah Davis <noahadvs@gmail.com>
Date: Mon, 14 Apr 2025 13:54:25 -0400
Subject: [PATCH] tst_scrolling.qml: don't set default angle delta to
verticalStepSize, don't test if smooth scrolling is enabled when testing
angle delta moves
While arbitrary angle deltas are allowed, setting the default angle delta size to verticalStepSize is not semantically correct because verticalStepSize is not an angle delta.
We shouldn't make more assumptions about WheelHandler's internal logic than necessary since there is already a way to avoid failing the test when smooth scrolling is enabled.
---
autotests/wheelhandler/tst_scrolling.qml | 50 +++++-------------------
1 file changed, 9 insertions(+), 41 deletions(-)
diff --git a/autotests/wheelhandler/tst_scrolling.qml b/autotests/wheelhandler/tst_scrolling.qml
index 425dcc995..bde386655 100644
--- a/autotests/wheelhandler/tst_scrolling.qml
+++ b/autotests/wheelhandler/tst_scrolling.qml
@@ -24,36 +24,20 @@ TestCase {
width: flickable.implicitWidth
height: flickable.implicitHeight
- function wheelScrolling(angleDelta = wheelHandler.verticalStepSize) {
+ function wheelScrolling(angleDelta = 120) {
let x = flickable.contentX
let y = flickable.contentY
const angleDeltaFactor = angleDelta / 120
mouseWheel(flickable, flickable.leftMargin, 0, -angleDelta, -angleDelta, Qt.NoButton)
- if (angleDelta === wheelHandler.verticalStepSize) {
- tryCompare(flickable, "contentX", Math.round(x + hstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+xTick")
- } else {
- compare(flickable.contentX, Math.round(x + hstep * angleDeltaFactor), "+xTick")
- }
+ tryCompare(flickable, "contentX", Math.round(x + hstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+xTick")
x = flickable.contentX
- if (angleDelta === wheelHandler.verticalStepSize) {
- tryCompare(flickable, "contentY", Math.round(y + vstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+yTick")
- } else {
- compare(flickable.contentY, Math.round(y + vstep * angleDeltaFactor), "+yTick")
- }
+ tryCompare(flickable, "contentY", Math.round(y + vstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+yTick")
y = flickable.contentY
mouseWheel(flickable, flickable.leftMargin, 0, angleDelta, angleDelta, Qt.NoButton)
- if (angleDelta === wheelHandler.verticalStepSize) {
- tryCompare(flickable, "contentX", Math.round(x - hstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-xTick")
- } else {
- compare(flickable.contentX, Math.round(x - hstep * angleDeltaFactor), "-xTick")
- }
+ tryCompare(flickable, "contentX", Math.round(x - hstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-xTick")
x = flickable.contentX
- if (angleDelta === wheelHandler.verticalStepSize) {
- tryCompare(flickable, "contentY", Math.round(y - vstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-yTick")
- } else {
- compare(flickable.contentY, Math.round(y - vstep * angleDeltaFactor), "-yTick")
- }
+ tryCompare(flickable, "contentY", Math.round(y - vstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-yTick")
y = flickable.contentY
if (Qt.platform.pluginName !== "xcb") {
@@ -69,31 +53,15 @@ TestCase {
}
mouseWheel(flickable, flickable.leftMargin, 0, -angleDelta, -angleDelta, Qt.NoButton, wheelHandler.pageScrollModifiers)
- if (angleDelta === wheelHandler.verticalStepSize) {
- tryCompare(flickable, "contentX", Math.round(x + pageWidth * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+xPage")
- } else {
- compare(flickable.contentX, Math.round(x + pageWidth * angleDeltaFactor), "+xPage")
- }
+ tryCompare(flickable, "contentX", Math.round(x + pageWidth * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+xPage")
x = flickable.contentX
- if (angleDelta === wheelHandler.verticalStepSize) {
- tryCompare(flickable, "contentY", Math.round(y + pageHeight * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+yPage")
- } else {
- compare(flickable.contentY, Math.round(y + pageHeight * angleDeltaFactor), "+yPage")
- }
+ tryCompare(flickable, "contentY", Math.round(y + pageHeight * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+yPage")
y = flickable.contentY
mouseWheel(flickable, flickable.leftMargin, 0, angleDelta, angleDelta, Qt.NoButton, wheelHandler.pageScrollModifiers)
- if (angleDelta === wheelHandler.verticalStepSize) {
- tryCompare(flickable, "contentX", Math.round(x - pageWidth * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-xPage")
- } else {
- compare(flickable.contentX, Math.round(x - pageWidth * angleDeltaFactor), "-xPage")
- }
+ tryCompare(flickable, "contentX", Math.round(x - pageWidth * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-xPage")
x = flickable.contentX
- if (angleDelta === wheelHandler.verticalStepSize) {
- tryCompare(flickable, "contentY", Math.round(y - pageHeight * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-yPage")
- } else {
- compare(flickable.contentY, Math.round(y - pageHeight * angleDeltaFactor), "-yPage")
- }
+ tryCompare(flickable, "contentY", Math.round(y - pageHeight * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-yPage")
y = flickable.contentY
if (Qt.platform.pluginName !== "xcb") {
--
GitLab
|