Fix tst_qdeclarativestates autotest.
authorMichael Brasser <michael.brasser@nokia.com>
Fri, 19 Aug 2011 02:28:35 +0000 (12:28 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 19 Aug 2011 04:18:52 +0000 (06:18 +0200)
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 <qt_sanity_bot@ovi.com>
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
tests/auto/declarative/qdeclarativestates/data/anchorRewindBug.qml
tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp

index 191a96f..c39766e 100644 (file)
@@ -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.
 
index 6512533..60c537b 100644 (file)
@@ -31,7 +31,7 @@ Rectangle {
         }
         PropertyChanges {
             target: rectangle
-            opacity: 0
+            visible: false
         }
     }
 }
index a59ca26..e13a6c4 100644 (file)
@@ -41,6 +41,7 @@
 #include <qtest.h>
 #include <QtDeclarative/qdeclarativeengine.h>
 #include <QtDeclarative/qdeclarativecomponent.h>
+#include <QtDeclarative/qsgview.h>
 #include <private/qsgstateoperations_p.h>
 #include <private/qsganchors_p_p.h>
 #include <private/qsgrectangle_p.h>
@@ -49,6 +50,7 @@
 #include <private/qdeclarativestategroup_p.h>
 #include <private/qsgitem_p.h>
 #include <private/qdeclarativeproperty_p.h>
+#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<QSGRectangle*>(rectComponent.create());
+    QSGRectangle *rect = qobject_cast<QSGRectangle*>(view->rootObject());
     QVERIFY(rect != 0);
 
     QSGItem * column = rect->findChild<QSGItem*>("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