aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-03-13 08:43:32 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-03-13 08:43:32 +0100
commit57aa9580f07307c5e277e52362943e7efd1f9ac9 (patch)
treeb638b0637283fe00a1f9a173a8d2a03adab9e0d2 /tests
parent5b18141e1165e24d2f3909548772916bea5faf10 (diff)
parent5c2b1bee5258981800c623dc3f054b15d7875484 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/SignalSequenceSpy.qml11
-rw-r--r--tests/auto/controls/data/tst_combobox.qml54
-rw-r--r--tests/auto/qquickdrawer/tst_qquickdrawer.cpp10
3 files changed, 69 insertions, 6 deletions
diff --git a/tests/auto/controls/data/SignalSequenceSpy.qml b/tests/auto/controls/data/SignalSequenceSpy.qml
index fe47a3c1..d14a5ee6 100644
--- a/tests/auto/controls/data/SignalSequenceSpy.qml
+++ b/tests/auto/controls/data/SignalSequenceSpy.qml
@@ -72,10 +72,15 @@ QtObject {
property var __connections: []
onExpectedSequenceChanged: reset()
- onTargetChanged: __setup()
- onSignalsChanged: __setup()
- function __setup() {
+ // We may call __setup from onTargetChanged and as we would read the signals property
+ // inside __setup, we may be initializing the binding for signals for the first time, which
+ // will write the value to the property and trigger onSignalsChanged and call __setup
+ // again. One easy way to protect against it is to evaluate those two dependencies upfront
+ onTargetChanged: __setup(target, signals)
+ onSignalsChanged: __setup(target, signals)
+
+ function __setup(target, signals) {
if (__oldTarget) {
__connections.forEach(function (cx) {
__oldTarget[cx.name].disconnect(cx.method)
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index 5389a04a..30d6a93c 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -629,36 +629,90 @@ TestCase {
compare(control.currentIndex, 0)
compare(control.currentText, "Banana")
+ compare(control.highlightedIndex, -1)
keyPress(Qt.Key_C)
compare(control.currentIndex, 1)
compare(control.currentText, "Coco")
+ compare(control.highlightedIndex, -1)
// no match
keyPress(Qt.Key_N)
compare(control.currentIndex, 1)
compare(control.currentText, "Coco")
+ compare(control.highlightedIndex, -1)
keyPress(Qt.Key_C)
compare(control.currentIndex, 2)
compare(control.currentText, "Coconut")
+ compare(control.highlightedIndex, -1)
keyPress(Qt.Key_C)
compare(control.currentIndex, 4)
compare(control.currentText, "Cocomuffin")
+ compare(control.highlightedIndex, -1)
// wrap
keyPress(Qt.Key_C)
compare(control.currentIndex, 1)
compare(control.currentText, "Coco")
+ compare(control.highlightedIndex, -1)
keyPress(Qt.Key_A)
compare(control.currentIndex, 3)
compare(control.currentText, "Apple")
+ compare(control.highlightedIndex, -1)
keyPress(Qt.Key_B)
compare(control.currentIndex, 0)
compare(control.currentText, "Banana")
+ compare(control.highlightedIndex, -1)
+
+ // popup
+ control.popup.open()
+ tryCompare(control.popup, "opened", true)
+
+ compare(control.currentIndex, 0)
+ compare(control.highlightedIndex, 0)
+
+ keyClick(Qt.Key_C)
+ compare(control.highlightedIndex, 1) // "Coco"
+ compare(control.currentIndex, 0)
+
+ // no match
+ keyClick(Qt.Key_N)
+ compare(control.highlightedIndex, 1)
+ compare(control.currentIndex, 0)
+
+ keyClick(Qt.Key_C)
+ compare(control.highlightedIndex, 2) // "Coconut"
+ compare(control.currentIndex, 0)
+
+ keyClick(Qt.Key_C)
+ compare(control.highlightedIndex, 4) // "Cocomuffin"
+ compare(control.currentIndex, 0)
+
+ // wrap
+ keyClick(Qt.Key_C)
+ compare(control.highlightedIndex, 1) // "Coco"
+ compare(control.currentIndex, 0)
+
+ keyClick(Qt.Key_B)
+ compare(control.highlightedIndex, 0) // "Banana"
+ compare(control.currentIndex, 0)
+
+ keyClick(Qt.Key_A)
+ compare(control.highlightedIndex, 3) // "Apple"
+ compare(control.currentIndex, 0)
+
+ verify(control.popup.visible)
+
+ // accept
+ keyClick(Qt.Key_Return)
+ tryCompare(control.popup, "visible", false)
+ compare(control.currentIndex, 3)
+ compare(control.currentText, "Apple")
+ compare(control.highlightedIndex, -1)
}
function test_popup() {
diff --git a/tests/auto/qquickdrawer/tst_qquickdrawer.cpp b/tests/auto/qquickdrawer/tst_qquickdrawer.cpp
index bba1cf45..e3a6ccf2 100644
--- a/tests/auto/qquickdrawer/tst_qquickdrawer.cpp
+++ b/tests/auto/qquickdrawer/tst_qquickdrawer.cpp
@@ -1263,13 +1263,17 @@ void tst_QQuickDrawer::nonModal()
void tst_QQuickDrawer::slider_data()
{
QTest::addColumn<bool>("mouse");
- QTest::newRow("mouse") << true;
- QTest::newRow("touch") << false;
+ QTest::addColumn<int>("delta");
+
+ QTest::newRow("mouse") << true << 2;
+ QTest::newRow("touch") << false << 2;
+ QTest::newRow("mouse,delta") << true << 296 / 8;
}
void tst_QQuickDrawer::slider()
{
QFETCH(bool, mouse);
+ QFETCH(int, delta);
QQuickApplicationHelper helper(this, QStringLiteral("slider.qml"));
QQuickWindow *window = helper.window;
@@ -1295,7 +1299,7 @@ void tst_QQuickDrawer::slider()
QTest::touchEvent(window, touchDevice.data()).press(0, from);
int distance = qAbs(from.x() - to.x());
- for (int dx = 2; dx < distance; dx += 2) {
+ for (int dx = delta; dx <= distance; dx += delta) {
if (mouse)
QTest::mouseMove(window, from - QPoint(dx, 0));
else