From: Gunnar Sletta Date: Wed, 1 Feb 2012 13:58:24 +0000 (+0100) Subject: Don't leave windows hanging outside test functions X-Git-Tag: qt-v5.0.0-alpha1~540 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=602d48011c5c26a962cdb99de87340c1fcbee4f4;p=profile%2Fivi%2Fqtdeclarative.git Don't leave windows hanging outside test functions Change-Id: I2df2167386b0827ae25a14f958ee50d0a15eba0b Reviewed-by: Sergio Ahumada --- diff --git a/tests/auto/qtquick2/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/qtquick2/qquickanimatedimage/tst_qquickanimatedimage.cpp index 17721a4..c124e4f 100644 --- a/tests/auto/qtquick2/qquickanimatedimage/tst_qquickanimatedimage.cpp +++ b/tests/auto/qtquick2/qquickanimatedimage/tst_qquickanimatedimage.cpp @@ -141,20 +141,20 @@ void tst_qquickanimatedimage::mirror_running() { // test where mirror is set to true after animation has started - QQuickView *canvas = new QQuickView; - canvas->show(); + QQuickView canvas; + canvas.show(); - canvas->setSource(testFileUrl("hearts.qml")); - QQuickAnimatedImage *anim = qobject_cast(canvas->rootObject()); + canvas.setSource(testFileUrl("hearts.qml")); + QQuickAnimatedImage *anim = qobject_cast(canvas.rootObject()); QVERIFY(anim); int width = anim->property("width").toInt(); QCOMPARE(anim->currentFrame(), 0); - QPixmap frame0 = QPixmap::fromImage(canvas->grabFrameBuffer()); + QPixmap frame0 = QPixmap::fromImage(canvas.grabFrameBuffer()); anim->setCurrentFrame(1); - QPixmap frame1 = QPixmap::fromImage(canvas->grabFrameBuffer()); + QPixmap frame1 = QPixmap::fromImage(canvas.grabFrameBuffer()); anim->setCurrentFrame(0); @@ -165,11 +165,11 @@ void tst_qquickanimatedimage::mirror_running() anim->setProperty("mirror", true); QCOMPARE(anim->currentFrame(), 1); - QPixmap frame1_flipped = QPixmap::fromImage(canvas->grabFrameBuffer()); + QPixmap frame1_flipped = QPixmap::fromImage(canvas.grabFrameBuffer()); QTRY_VERIFY(spy.count() == 1); spy.clear(); QCOMPARE(anim->currentFrame(), 0); // animation only has 2 frames, should cycle back to first - QPixmap frame0_flipped = QPixmap::fromImage(canvas->grabFrameBuffer()); + QPixmap frame0_flipped = QPixmap::fromImage(canvas.grabFrameBuffer()); QSKIP("Skip while QTBUG-19351 and QTBUG-19252 are not resolved"); @@ -180,23 +180,21 @@ void tst_qquickanimatedimage::mirror_running() QCOMPARE(frame0_flipped, frame0_expected); QCOMPARE(frame1_flipped, frame1_expected); - - delete canvas; } void tst_qquickanimatedimage::mirror_notRunning() { QFETCH(QUrl, fileUrl); - QQuickView *canvas = new QQuickView; - canvas->show(); + QQuickView canvas; + canvas.show(); - canvas->setSource(fileUrl); - QQuickAnimatedImage *anim = qobject_cast(canvas->rootObject()); + canvas.setSource(fileUrl); + QQuickAnimatedImage *anim = qobject_cast(canvas.rootObject()); QVERIFY(anim); int width = anim->property("width").toInt(); - QPixmap screenshot = QPixmap::fromImage(canvas->grabFrameBuffer()); + QPixmap screenshot = QPixmap::fromImage(canvas.grabFrameBuffer()); QTransform transform; transform.translate(width, 0).scale(-1, 1.0); @@ -207,7 +205,7 @@ void tst_qquickanimatedimage::mirror_notRunning() bool paused = anim->isPlaying(); anim->setProperty("mirror", true); - screenshot = QPixmap::fromImage(canvas->grabFrameBuffer()); + screenshot = QPixmap::fromImage(canvas.grabFrameBuffer()); QSKIP("Skip while QTBUG-19351 and QTBUG-19252 are not resolved"); QCOMPARE(screenshot, expected); @@ -216,8 +214,6 @@ void tst_qquickanimatedimage::mirror_notRunning() QCOMPARE(anim->currentFrame(), frame); QCOMPARE(anim->isPlaying(), playing); QCOMPARE(anim->isPaused(), paused); - - delete canvas; } void tst_qquickanimatedimage::mirror_notRunning_data()