aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickpincharea
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-03-04 13:58:57 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-04 19:47:38 +0100
commit037c0d5d597d2e7d35e74ea1de42d4ecf16fbc6a (patch)
tree7b0caf02309f14b422de7387ba4d0b3fc4484d9a /tests/auto/quick/qquickpincharea
parent1c451b40aee66a38ca3d61e5beec4ae8c986c8ed (diff)
PinchArea autotest doesn't depend on window activation; QScopedPointer
The QQuickView pointer is guarded by a QScopedPointer to make sure it will be deleted if the test fails. And because we don't depend on window activation, the test should be parallelizable. Change-Id: I33a5dcff037087d9752b264eb067196c2a5be535 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'tests/auto/quick/qquickpincharea')
-rw-r--r--tests/auto/quick/qquickpincharea/qquickpincharea.pro1
-rw-r--r--tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp29
2 files changed, 10 insertions, 20 deletions
diff --git a/tests/auto/quick/qquickpincharea/qquickpincharea.pro b/tests/auto/quick/qquickpincharea/qquickpincharea.pro
index df3b14d8c0..970ce48851 100644
--- a/tests/auto/quick/qquickpincharea/qquickpincharea.pro
+++ b/tests/auto/quick/qquickpincharea/qquickpincharea.pro
@@ -1,4 +1,5 @@
CONFIG += testcase
+CONFIG += parallel_test
TARGET = tst_qquickpincharea
macx:CONFIG -= app_bundle
diff --git a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
index ba1db0e7cf..18595133d0 100644
--- a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
+++ b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
@@ -84,10 +84,9 @@ void tst_QQuickPinchArea::cleanupTestCase()
}
void tst_QQuickPinchArea::pinchProperties()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("pinchproperties.qml"));
window->show();
- window->requestActivate();
QVERIFY(window->rootObject() != 0);
QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
@@ -195,8 +194,6 @@ void tst_QQuickPinchArea::pinchProperties()
QCOMPARE(rotMinSpy.count(),1);
QCOMPARE(rotMaxSpy.count(),1);
-
- delete window;
}
QTouchEvent::TouchPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i)
@@ -211,10 +208,10 @@ QTouchEvent::TouchPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickIt
void tst_QQuickPinchArea::scale()
{
QQuickView *window = createView();
+ QScopedPointer<QQuickView> scope(window);
window->setSource(testFileUrl("pinchproperties.qml"));
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window));
QVERIFY(window->rootObject() != 0);
qApp->processEvents();
@@ -267,17 +264,15 @@ void tst_QQuickPinchArea::scale()
pinchSequence.release(0, p1, window).release(1, p2, window).commit();
}
QVERIFY(!root->property("pinchActive").toBool());
-
- delete window;
}
void tst_QQuickPinchArea::pan()
{
QQuickView *window = createView();
+ QScopedPointer<QQuickView> scope(window);
window->setSource(testFileUrl("pinchproperties.qml"));
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window));
QVERIFY(window->rootObject() != 0);
qApp->processEvents();
@@ -327,18 +322,16 @@ void tst_QQuickPinchArea::pan()
QTest::touchEvent(window, device).release(0, p1, window).release(1, p2, window);
QVERIFY(!root->property("pinchActive").toBool());
-
- delete window;
}
// test pinch, release one point, touch again to continue pinch
void tst_QQuickPinchArea::retouch()
{
QQuickView *window = createView();
+ QScopedPointer<QQuickView> scope(window);
window->setSource(testFileUrl("pinchproperties.qml"));
window->show();
- window->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window));
QVERIFY(window->rootObject() != 0);
qApp->processEvents();
@@ -413,8 +406,6 @@ void tst_QQuickPinchArea::retouch()
QCOMPARE(startedSpy.count(), 2);
QCOMPARE(finishedSpy.count(), 1);
}
-
- delete window;
}
void tst_QQuickPinchArea::transformedPinchArea_data()
@@ -449,10 +440,10 @@ void tst_QQuickPinchArea::transformedPinchArea()
QFETCH(bool, shouldPinch);
QQuickView *view = createView();
+ QScopedPointer<QQuickView> scope(view);
view->setSource(testFileUrl("transformedPinchArea.qml"));
view->show();
- view->requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(view));
+ QVERIFY(QTest::qWaitForWindowExposed(view));
QVERIFY(view->rootObject() != 0);
qApp->processEvents();
@@ -475,8 +466,6 @@ void tst_QQuickPinchArea::transformedPinchArea()
pinchSequence.release(0, p1, view).release(1, p2, view).commit();
QCOMPARE(pinchArea->property("pinching").toBool(), false);
}
-
- delete view;
}
QQuickView *tst_QQuickPinchArea::createView()