aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-08-19 09:47:35 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-08-19 09:47:35 +0200
commitd2628d9d7015e4b75007471d150acedecaa0c6c1 (patch)
tree00ab012c7ae190d5a64788ee945ca006e3759e41 /tests
parentb6a6a6387e279c431d520243345530fa19bd96c5 (diff)
parent566afc2d2e4156712ffec081715f12307cf46628 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: tests/auto/quick/qquickgridview/qquickgridview.pro tests/auto/quick/qquickitem/qquickitem.pro Change-Id: Ic54cafbdda1ac22757d2ee65dcc63a1b167c7556
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp4
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp69
-rw-r--r--tests/auto/quick/qquickgridview/qquickgridview.pro4
-rw-r--r--tests/auto/quick/qquickitem/qquickitem.pro3
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp5
-rw-r--r--tests/auto/quick/qquickmousearea/qquickmousearea.pro2
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp13
-rw-r--r--tests/auto/quick/qquicktextedit/qquicktextedit.pro1
-rw-r--r--tests/auto/quick/qquickwindow/data/hoverCrash.qml36
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp33
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp3
11 files changed, 132 insertions, 41 deletions
diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
index f4a7bcdb48..ab8ff0e1a4 100644
--- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
@@ -207,6 +207,10 @@ void tst_qqmlmoduleplugin::incorrectPluginCase()
QString expectedError = QLatin1String("module \"com.nokia.WrongCase\" plugin \"PluGin\" not found");
#endif
+#ifdef Q_OS_MACX
+ if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8)
+ QEXPECT_FAIL("", "See QTBUG-32652", Continue);
+#endif
QCOMPARE(errors.at(0).description(), expectedError);
}
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index a8055b3467..dd9fa47d81 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -94,9 +94,10 @@ private slots:
void flickTwiceUsingTouches();
void nestedStopAtBounds();
void nestedStopAtBounds_data();
+ void nestedMouseAreaUsingTouch();
private:
- void flickWithTouch(QWindow *window, QTouchDevice *touchDevice);
+ void flickWithTouch(QWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to);
QQmlEngine engine;
};
@@ -1268,13 +1269,13 @@ void tst_qquickflickable::flickTwiceUsingTouches()
QVERIFY(flickable != 0);
QCOMPARE(flickable->contentY(), 0.0f);
- flickWithTouch(window, touchDevice);
+ flickWithTouch(window, touchDevice, QPoint(100, 400), QPoint(100, 240));
qreal contentYAfterFirstFlick = flickable->contentY();
qDebug() << "contentYAfterFirstFlick " << contentYAfterFirstFlick;
QVERIFY(contentYAfterFirstFlick > 50.0f);
- flickWithTouch(window, touchDevice);
+ flickWithTouch(window, touchDevice, QPoint(100, 400), QPoint(100, 240));
// In the original bug, that second flick would cause Flickable to halt immediately
qreal contentYAfterSecondFlick = flickable->contentY();
@@ -1284,34 +1285,19 @@ void tst_qquickflickable::flickTwiceUsingTouches()
delete window;
}
-void tst_qquickflickable::flickWithTouch(QWindow *window, QTouchDevice *touchDevice)
+void tst_qquickflickable::flickWithTouch(QWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to)
{
QTest::touchEvent(window, touchDevice)
- .press(0, QPoint(100, 400), window);
- QTest::qWait(1);
- QTest::touchEvent(window, touchDevice)
- .move(0, QPoint(100, 380), window);
- QTest::qWait(1);
- QTest::touchEvent(window, touchDevice)
- .move(0, QPoint(100, 360), window);
- QTest::qWait(1);
- QTest::touchEvent(window, touchDevice)
- .move(0, QPoint(100, 340), window);
- QTest::qWait(1);
- QTest::touchEvent(window, touchDevice)
- .move(0, QPoint(100, 320), window);
- QTest::qWait(1);
- QTest::touchEvent(window, touchDevice)
- .move(0, QPoint(100, 300), window);
- QTest::qWait(1);
- QTest::touchEvent(window, touchDevice)
- .move(0, QPoint(100, 280), window);
- QTest::qWait(1);
- QTest::touchEvent(window, touchDevice)
- .move(0, QPoint(100, 260), window);
+ .press(0, from, window);
QTest::qWait(1);
+ QPoint diff = to - from;
+ for (int i = 1; i <= 8; ++i) {
+ QTest::touchEvent(window, touchDevice)
+ .move(0, from + i*diff/8, window);
+ QTest::qWait(1);
+ }
QTest::touchEvent(window, touchDevice)
- .release(0, QPoint(100, 240), window);
+ .release(0, to, window);
QTest::qWait(1);
}
@@ -1384,6 +1370,35 @@ void tst_qquickflickable::nestedStopAtBounds()
QTRY_VERIFY(!outer->isMoving());
}
+void tst_qquickflickable::nestedMouseAreaUsingTouch()
+{
+ QTouchDevice *touchDevice = new QTouchDevice;
+ touchDevice->setName("Fake Touchscreen");
+ touchDevice->setType(QTouchDevice::TouchScreen);
+ touchDevice->setCapabilities(QTouchDevice::Position);
+ QWindowSystemInterface::registerTouchDevice(touchDevice);
+
+ QQuickView *window = new QQuickView;
+ window->setSource(testFileUrl("nestedmousearea.qml"));
+ window->show();
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable != 0);
+
+ QCOMPARE(flickable->contentY(), 50.0f);
+ flickWithTouch(window, touchDevice, QPoint(100, 300), QPoint(100, 200));
+
+ // flickable should not have moved
+ QCOMPARE(flickable->contentY(), 50.0);
+
+ // draggable item should have moved up
+ QQuickItem *nested = window->rootObject()->findChild<QQuickItem*>("nested");
+ QVERIFY(nested->y() < 100.0);
+
+ delete window;
+}
+
QTEST_MAIN(tst_qquickflickable)
#include "tst_qquickflickable.moc"
diff --git a/tests/auto/quick/qquickgridview/qquickgridview.pro b/tests/auto/quick/qquickgridview/qquickgridview.pro
index 3a4155256f..40b43fa2c0 100644
--- a/tests/auto/quick/qquickgridview/qquickgridview.pro
+++ b/tests/auto/quick/qquickgridview/qquickgridview.pro
@@ -11,4 +11,8 @@ include (../shared/util.pri)
TESTDATA = data/*
QT += core-private gui-private qml-private quick-private testlib
+
+win32:CONFIG += insignificant_test # QTBUG-33017
+macx:CONFIG += insignificant_test # QTBUG-33017
+
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickitem/qquickitem.pro b/tests/auto/quick/qquickitem/qquickitem.pro
index 81e2e3adef..9bcba5de33 100644
--- a/tests/auto/quick/qquickitem/qquickitem.pro
+++ b/tests/auto/quick/qquickitem/qquickitem.pro
@@ -9,4 +9,7 @@ macx:CONFIG -= app_bundle
TESTDATA = data/*
QT += core-private gui-private qml-private quick-private testlib
+
+win32:CONFIG += insignificant_test # QTBUG-32664
+
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 2268f0754c..cd8cc53b40 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -2605,6 +2605,11 @@ void tst_QQuickListView::currentIndex()
listview->setContentY(200);
QTRY_VERIFY(!delegateVisible(listview->currentItem()));
+ // empty model should reset currentIndex to -1
+ QaimModel emptyModel;
+ ctxt->setContextProperty("testModel", &emptyModel);
+ QCOMPARE(listview->currentIndex(), -1);
+
delete window;
}
diff --git a/tests/auto/quick/qquickmousearea/qquickmousearea.pro b/tests/auto/quick/qquickmousearea/qquickmousearea.pro
index dd7b434898..e9b06fd1df 100644
--- a/tests/auto/quick/qquickmousearea/qquickmousearea.pro
+++ b/tests/auto/quick/qquickmousearea/qquickmousearea.pro
@@ -10,5 +10,7 @@ include (../../shared/util.pri)
TESTDATA = data/*
+win32:CONFIG += insignificant_test # QTBUG-33006
+
QT += core-private gui-private qml-private quick-private network testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index a582c62701..f92612e411 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -1198,18 +1198,15 @@ void tst_QQuickMouseArea::transformedMouseArea()
foreach (const QPoint &point, points) {
// check hover
QTest::mouseMove(window, point);
- QTest::qWait(10);
- QCOMPARE(mouseArea->property("containsMouse").toBool(), insideTarget);
+ QTRY_COMPARE(mouseArea->property("containsMouse").toBool(), insideTarget);
// check mouse press
QTest::mousePress(window, Qt::LeftButton, 0, point);
- QTest::qWait(10);
- QCOMPARE(mouseArea->property("pressed").toBool(), insideTarget);
+ QTRY_COMPARE(mouseArea->property("pressed").toBool(), insideTarget);
// check mouse release
QTest::mouseRelease(window, Qt::LeftButton, 0, point);
- QTest::qWait(10);
- QCOMPARE(mouseArea->property("pressed").toBool(), false);
+ QTRY_COMPARE(mouseArea->property("pressed").toBool(), false);
}
delete window;
@@ -1514,8 +1511,8 @@ void tst_QQuickMouseArea::nestedStopAtBounds()
QTest::mouseMove(&view, position);
axis += invert ? -threshold : threshold;
QTest::mouseMove(&view, position);
- QCOMPARE(outer->drag()->active(), false);
- QCOMPARE(inner->drag()->active(), true);
+ QTRY_COMPARE(outer->drag()->active(), false);
+ QTRY_COMPARE(inner->drag()->active(), true);
QTest::mouseRelease(&view, Qt::LeftButton, 0, position);
}
diff --git a/tests/auto/quick/qquicktextedit/qquicktextedit.pro b/tests/auto/quick/qquicktextedit/qquicktextedit.pro
index 814291ac35..2386d713a7 100644
--- a/tests/auto/quick/qquicktextedit/qquicktextedit.pro
+++ b/tests/auto/quick/qquicktextedit/qquicktextedit.pro
@@ -16,3 +16,4 @@ QT += core-private gui-private qml-private quick-private network-private testli
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
mac:CONFIG += insignificant_test # QTBUG-27740
+win32:CONFIG += insignificant_test # QTBUG-32540
diff --git a/tests/auto/quick/qquickwindow/data/hoverCrash.qml b/tests/auto/quick/qquickwindow/data/hoverCrash.qml
new file mode 100644
index 0000000000..936d9e4f43
--- /dev/null
+++ b/tests/auto/quick/qquickwindow/data/hoverCrash.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+import QtQuick.Window 2.0 as Window
+
+Window.Window {
+ width: 200
+ height: 200
+ color: "#00FF00"
+ Column {
+ Rectangle {
+ objectName: 'item1'
+ color: 'red'
+ width: 100
+ height: 100
+ MouseArea {
+ id: area
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+ }
+
+ Loader {
+ objectName: 'item2'
+ width: 100
+ height: 100
+ active: area.containsMouse
+ sourceComponent: Rectangle {
+ color: 'blue'
+
+ MouseArea {
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index fbbc77c31c..17999ed588 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -328,6 +328,8 @@ private slots:
void blockClosing();
+ void crashWhenHoverItemDeleted();
+
#ifndef QT_NO_CURSOR
void cursor();
#endif
@@ -1292,23 +1294,23 @@ void tst_qquickwindow::cursor()
QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 100));
// Remove the cursor item from the scene. Theoretically this should make parentItem the
- // cursorItem, but given the situation will correct itself after the next mouse move it's
- // probably better left as is to avoid unnecessary work during tear down.
+ // cursorItem, but given the situation will correct itself after the next mouse move it
+ // simply unsets the window cursor for now.
childItem.setParentItem(0);
- QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
parentItem.setCursor(Qt::SizeAllCursor);
QCOMPARE(parentItem.cursor().shape(), Qt::SizeAllCursor);
- QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
// Changing the cursor of an un-parented item doesn't affect the window's cursor.
childItem.setCursor(Qt::ClosedHandCursor);
QCOMPARE(childItem.cursor().shape(), Qt::ClosedHandCursor);
- QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
childItem.unsetCursor();
QCOMPARE(childItem.cursor().shape(), Qt::ArrowCursor);
- QCOMPARE(window.cursor().shape(), Qt::WaitCursor);
+ QCOMPARE(window.cursor().shape(), Qt::ArrowCursor);
QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 101));
QCOMPARE(window.cursor().shape(), Qt::SizeAllCursor);
@@ -1487,6 +1489,25 @@ void tst_qquickwindow::blockClosing()
QTRY_VERIFY(!window->isVisible());
}
+void tst_qquickwindow::crashWhenHoverItemDeleted()
+{
+ // QTBUG-32771
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("hoverCrash.qml"));
+ QQuickWindow* window = qobject_cast<QQuickWindow *>(component.create());
+ QVERIFY(window);
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+
+ // Simulate a move from the first rectangle to the second. Crash will happen in here
+ // Moving instantaneously from (0, 99) to (0, 102) does not cause the crash
+ for (int i = 99; i < 102; ++i)
+ {
+ QTest::mouseMove(window, QPoint(0, i));
+ }
+}
+
QTEST_MAIN(tst_qquickwindow)
#include "tst_qquickwindow.moc"
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index 4779942406..6cf0aa4749 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -867,6 +867,9 @@ void tst_TouchMouse::mouseOnFlickableOnPinch()
QGuiApplication::processEvents();
//QVERIFY(flickable->isMovingHorizontally());
+
+ // Wait for flick to end
+ QTRY_VERIFY(!flickable->isMoving());
qDebug() << "Pos: " << rect->position();
// pinch