diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativebehaviors')
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index 5e0c9d5..1dc4b53 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -46,6 +46,7 @@ #include <private/qdeclarativetext_p.h> #include <private/qdeclarativebehavior_p.h> #include <private/qdeclarativeanimation_p.h> +#include <private/qdeclarativeitem_p.h> #include "../../../shared/util.h" class tst_qdeclarativebehaviors : public QObject @@ -81,7 +82,7 @@ void tst_qdeclarativebehaviors::simpleBehavior() QTRY_VERIFY(rect); QTRY_VERIFY(qobject_cast<QDeclarativeBehavior*>(rect->findChild<QDeclarativeBehavior*>("MyBehavior"))->animation()); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); //i.e. the behavior has been triggered @@ -129,7 +130,7 @@ void tst_qdeclarativebehaviors::loop() QTRY_VERIFY(rect); //don't crash - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); delete rect; } @@ -141,7 +142,7 @@ void tst_qdeclarativebehaviors::colorBehavior() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QTRY_VERIFY(rect); - rect->setState("red"); + QDeclarativeItemPrivate::get(rect)->setState("red"); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->color() != QColor("red")); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->color() != QColor("green")); //i.e. the behavior has been triggered @@ -156,7 +157,7 @@ void tst_qdeclarativebehaviors::parentBehavior() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QTRY_VERIFY(rect); - rect->setState("reparented"); + QDeclarativeItemPrivate::get(rect)->setState("reparented"); QTRY_VERIFY(rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem() != rect->findChild<QDeclarativeItem*>("NewParent")); QTRY_VERIFY(rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem() == rect->findChild<QDeclarativeItem*>("NewParent")); @@ -170,7 +171,7 @@ void tst_qdeclarativebehaviors::replaceBinding() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QTRY_VERIFY(rect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); QTRY_VERIFY(innerRect); QTRY_VERIFY(innerRect->x() > 0); @@ -182,7 +183,7 @@ void tst_qdeclarativebehaviors::replaceBinding() rect->setProperty("movedx", 210); QTRY_COMPARE(innerRect->x(), (qreal)210); - rect->setState(""); + QDeclarativeItemPrivate::get(rect)->setState(""); QTRY_VERIFY(innerRect->x() > 10); QTRY_VERIFY(innerRect->x() < 210); //i.e. the behavior has been triggered QTRY_COMPARE(innerRect->x(), (qreal)10); @@ -202,7 +203,7 @@ void tst_qdeclarativebehaviors::group() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QTRY_VERIFY(rect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); //QTest::qWait(200); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); @@ -217,7 +218,7 @@ void tst_qdeclarativebehaviors::group() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QTRY_VERIFY(rect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); //i.e. the behavior has been triggered @@ -233,7 +234,7 @@ void tst_qdeclarativebehaviors::emptyBehavior() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QVERIFY(rect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); QCOMPARE(x, qreal(200)); //should change immediately @@ -247,7 +248,7 @@ void tst_qdeclarativebehaviors::explicitSelection() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QVERIFY(rect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); //i.e. the behavior has been triggered @@ -262,7 +263,7 @@ void tst_qdeclarativebehaviors::nonSelectingBehavior() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QVERIFY(rect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); QCOMPARE(x, qreal(200)); //should change immediately @@ -291,7 +292,7 @@ void tst_qdeclarativebehaviors::disabled() QVERIFY(rect); QCOMPARE(rect->findChild<QDeclarativeBehavior*>("MyBehavior")->enabled(), false); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); QCOMPARE(x, qreal(200)); //should change immediately |