From e636770970e979d4111ca90eca926c5eea2e7ce0 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 19 Aug 2011 12:28:35 +1000 Subject: Fix tst_qdeclarativestates autotest. Update test after changes to Column. Task-number: QTBUG-21002 Change-Id: I12671207cd07ba375f9c90cc02fdc9f81f189678 Reviewed-on: http://codereview.qt.nokia.com/3236 Reviewed-by: Qt Sanity Bot Reviewed-by: Alan Alpert --- .../qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp | 1 - .../qdeclarativestates/data/anchorRewindBug.qml | 2 +- .../qdeclarativestates/tst_qdeclarativestates.cpp | 15 +++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index 191a96f81d..c39766e22d 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -404,7 +404,6 @@ void tst_qdeclarativebehaviors::sameValue() QCOMPARE(target->x(), qreal(100)); target->setProperty("x", 0); - qDebug() << "x" << target->x(); QTRY_VERIFY(target->x() != qreal(0) && target->x() != qreal(100)); QTRY_VERIFY(target->x() == qreal(0)); //make sure Behavior has finished. diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml b/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml index 6512533b37..60c537b1ed 100644 --- a/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml +++ b/tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml @@ -31,7 +31,7 @@ Rectangle { } PropertyChanges { target: rectangle - opacity: 0 + visible: false } } } diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index a59ca2607f..e13a6c4305 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +50,7 @@ #include #include #include +#include "../../../shared/util.h" #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir @@ -953,10 +955,11 @@ void tst_qdeclarativestates::anchorChangesCrash() // QTBUG-12273 void tst_qdeclarativestates::anchorRewindBug() { - QDeclarativeEngine engine; + QSGView *view = new QSGView; + view->setSource(QUrl::fromLocalFile(SRCDIR "/data/anchorRewindBug.qml")); + qApp->processEvents(); - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorRewindBug.qml"); - QSGRectangle *rect = qobject_cast(rectComponent.create()); + QSGRectangle *rect = qobject_cast(view->rootObject()); QVERIFY(rect != 0); QSGItem * column = rect->findChild("column"); @@ -971,7 +974,7 @@ void tst_qdeclarativestates::anchorRewindBug() // and column's implicit resizing should still work QVERIFY(!QSGItemPrivate::get(column)->heightValid); QVERIFY(!QSGItemPrivate::get(column)->widthValid); - QCOMPARE(column->height(), 100.0); + QTRY_COMPARE(column->height(), 100.0); QSGItemPrivate::get(rect)->setState(""); @@ -979,9 +982,9 @@ void tst_qdeclarativestates::anchorRewindBug() // and column's implicit resizing should still work QVERIFY(!QSGItemPrivate::get(column)->heightValid); QVERIFY(!QSGItemPrivate::get(column)->widthValid); - QCOMPARE(column->height(), 200.0); + QTRY_COMPARE(column->height(), 200.0); - delete rect; + delete view; } // QTBUG-11834 -- cgit v1.2.3