aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2014-11-26 10:01:15 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2014-11-28 12:02:24 +0100
commit9d7204eadd1d68823dcae790fe3f77aa2fbd4b0e (patch)
treed4ae759f4e1673f38b5df077cb5cc9f7a3b42ac6 /tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
parentbe6c91acc3ee5ebb8336b9e79df195662ac11788 (diff)
Stabilize tst_qquickflickable.
- Use one engine per test - Use QQuickView for the margins test - Verify QWindow cleanup. Change-Id: Id2a10b56101832c362822963a2a7bd1d66daa143 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'tests/auto/quick/qquickflickable/tst_qquickflickable.cpp')
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 26819ff48b..a3d902a054 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -91,12 +91,17 @@ private slots:
void stopAtBounds_data();
void nestedMouseAreaUsingTouch();
void pressDelayWithLoader();
+ void cleanup();
private:
void flickWithTouch(QQuickWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to);
- QQmlEngine engine;
};
+void tst_qquickflickable::cleanup()
+{
+ QVERIFY(QGuiApplication::topLevelWindows().isEmpty());
+}
+
void tst_qquickflickable::create()
{
QQmlEngine engine;
@@ -199,6 +204,7 @@ void tst_qquickflickable::properties()
void tst_qquickflickable::boundsBehavior()
{
+ QQmlEngine engine;
QQmlComponent component(&engine);
component.setData("import QtQuick 2.0; Flickable { boundsBehavior: Flickable.StopAtBounds }", QUrl::fromLocalFile(""));
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create());
@@ -330,6 +336,7 @@ void tst_qquickflickable::rebound()
void tst_qquickflickable::maximumFlickVelocity()
{
+ QQmlEngine engine;
QQmlComponent component(&engine);
component.setData("import QtQuick 2.0; Flickable { maximumFlickVelocity: 1.0; }", QUrl::fromLocalFile(""));
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create());
@@ -349,6 +356,7 @@ void tst_qquickflickable::maximumFlickVelocity()
void tst_qquickflickable::flickDeceleration()
{
+ QQmlEngine engine;
QQmlComponent component(&engine);
component.setData("import QtQuick 2.0; Flickable { flickDeceleration: 1.0; }", QUrl::fromLocalFile(""));
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create());
@@ -553,6 +561,7 @@ void tst_qquickflickable::nestedClickThenFlick()
void tst_qquickflickable::flickableDirection()
{
+ QQmlEngine engine;
QQmlComponent component(&engine);
component.setData("import QtQuick 2.0; Flickable { flickableDirection: Flickable.VerticalFlick; }", QUrl::fromLocalFile(""));
QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(component.create());
@@ -1213,9 +1222,16 @@ void tst_qquickflickable::flickVelocity()
void tst_qquickflickable::margins()
{
- QQmlEngine engine;
- QQmlComponent c(&engine, testFileUrl("margins.qml"));
- QQuickItem *root = qobject_cast<QQuickItem*>(c.create());
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("margins.qml"));
+ QTRY_COMPARE(window->status(), QQuickView::Ready);
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QQuickViewTestUtil::moveMouseAway(window.data());
+ window->setTitle(QTest::currentTestFunction());
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QQuickItem *root = window->rootObject();
+ QVERIFY(root);
QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(root);
QVERIFY(obj != 0);