[PATCH] tst_scrolling.qml: don't set default angle delta to verticalStepSize, don...
authorNoah Davis <noahadvs@gmail.com>
Mon, 14 Apr 2025 17:54:25 +0000 (13:54 -0400)
committerAurélien COUDERC <coucouf@debian.org>
Tue, 20 May 2025 06:38:42 +0000 (08:38 +0200)
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.

Gbp-Pq: Name upstream_bf7ead57_tst-scrolling-qml-don-t-set-default-angle-delta-to-verticalStepSize-don-t-test-if-smooth-scrolling-is-enabled-when-testing-angle-delta-moves.patch

autotests/wheelhandler/tst_scrolling.qml

index 425dcc99575eaae87c5e6327005e66517363045a..bde38665539263c329efafddda51f8014c549174 100644 (file)
@@ -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") {