aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2019-11-18 11:44:47 +0100
committerMitch Curtis <mitch.curtis@qt.io>2019-11-23 15:40:48 +0100
commit7811c2b31a8704e99474777ce21f3a22483b8a8c (patch)
tree5c94711190b4f8b092446e53431212cd6f761ff2
parent49b1e3ff2ac20d8aa8b3889fc76ab4e6907817fd (diff)
tst_dial: fix test_dragging afer mouseDrag() changes
02ffe50af41526f604ae61d41bf2150037d67473 fixed some incorrect behavior in mouseDrag() that these tests were unknowingly relying on. Fixes: QTBUG-80153 Change-Id: I486061cc7d7fe44ef7b9ff8924c711572a01e44a Reviewed-by: Liang Qi <liang.qi@qt.io>
-rw-r--r--tests/auto/controls/data/tst_dial.qml22
1 files changed, 14 insertions, 8 deletions
diff --git a/tests/auto/controls/data/tst_dial.qml b/tests/auto/controls/data/tst_dial.qml
index 86999594..26f30c33 100644
--- a/tests/auto/controls/data/tst_dial.qml
+++ b/tests/auto/controls/data/tst_dial.qml
@@ -223,33 +223,39 @@ TestCase {
var minimumExpectedValueCount = data.live ? 2 : 1;
// drag to the left
- mouseDrag(dial, dial.width / 2, dial.height / 2, -dial.width / 2, 0, Qt.LeftButton);
+ // we always add or subtract 1 to ensure we start the drag from the opposite side
+ // of where we're dragging to, for more reliable tests
+ mouseDrag(dial, dial.width / 2 + 1, dial.height / 2, -dial.width / 2, 0, Qt.LeftButton);
fuzzyCompare(dial.value, data.leftValue, 0.1);
- verify(valueSpy.count >= minimumExpectedValueCount);
+ verify(valueSpy.count >= minimumExpectedValueCount, "expected valueChanged to be emitted at least "
+ + minimumExpectedValueCount + " time(s), but it was only emitted " + valueSpy.count + " time(s)");
valueSpy.clear();
verify(moveSpy.count > 0);
moveSpy.clear();
// drag to the top
- mouseDrag(dial, dial.width / 2, dial.height / 2, 0, -dial.height / 2, Qt.LeftButton);
+ mouseDrag(dial, dial.width / 2, dial.height / 2 + 1, 0, -dial.height / 2, Qt.LeftButton);
fuzzyCompare(dial.value, data.topValue, 0.1);
- verify(valueSpy.count >= minimumExpectedValueCount);
+ verify(valueSpy.count >= minimumExpectedValueCount, "expected valueChanged to be emitted at least "
+ + minimumExpectedValueCount + " time(s), but it was only emitted " + valueSpy.count + " time(s)");
valueSpy.clear();
verify(moveSpy.count > 0);
moveSpy.clear();
// drag to the right
- mouseDrag(dial, dial.width / 2, dial.height / 2, dial.width / 2, 0, Qt.LeftButton);
+ mouseDrag(dial, dial.width / 2 - 1, dial.height / 2, dial.width / 2, 0, Qt.LeftButton);
fuzzyCompare(dial.value, data.rightValue, 0.1);
- verify(valueSpy.count >= minimumExpectedValueCount);
+ verify(valueSpy.count >= minimumExpectedValueCount, "expected valueChanged to be emitted at least "
+ + minimumExpectedValueCount + " time(s), but it was only emitted " + valueSpy.count + " time(s)");
valueSpy.clear();
verify(moveSpy.count > 0);
moveSpy.clear();
// drag to the bottom (* 0.6 to ensure we don't go over to the minimum position)
- mouseDrag(dial, dial.width / 2, dial.height / 2, 10, dial.height / 2, Qt.LeftButton);
+ mouseDrag(dial, dial.width / 2, dial.height / 2 - 1, 10, dial.height / 2, Qt.LeftButton);
fuzzyCompare(dial.value, data.bottomValue, 0.1);
- verify(valueSpy.count >= minimumExpectedValueCount);
+ verify(valueSpy.count >= minimumExpectedValueCount, "expected valueChanged to be emitted at least "
+ + minimumExpectedValueCount + " time(s), but it was only emitted " + valueSpy.count + " time(s)");
valueSpy.clear();
verify(moveSpy.count > 0);
moveSpy.clear();