summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-03-26 04:29:19 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-03-28 23:50:06 (GMT)
commit078ff776e37aebe5b7e88e4b4f21da1158fac3c7 (patch)
treed3e4a466b6d7df796cfd5031760b53c210d3635e /tests/auto
parent921d6882caa4f4be78c747493295d3bdd3f1f673 (diff)
downloadQt-078ff776e37aebe5b7e88e4b4f21da1158fac3c7.zip
Qt-078ff776e37aebe5b7e88e4b4f21da1158fac3c7.tar.gz
Qt-078ff776e37aebe5b7e88e4b4f21da1158fac3c7.tar.bz2
Autotest tweaks.
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp30
-rw-r--r--tests/auto/declarative/qdeclarativebinding/data/test-binding.qml2
-rw-r--r--tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp8
-rw-r--r--tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp3
-rw-r--r--tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp4
5 files changed, 45 insertions, 2 deletions
diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
index 0bf0b81..26c8231 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
+++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
@@ -82,6 +82,8 @@ void tst_qdeclarativebehaviors::simpleBehavior()
QTest::qWait(200);
qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x();
QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered
+
+ delete rect;
}
void tst_qdeclarativebehaviors::scriptTriggered()
@@ -95,6 +97,8 @@ void tst_qdeclarativebehaviors::scriptTriggered()
QTest::qWait(200);
qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x();
QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered
+
+ delete rect;
}
void tst_qdeclarativebehaviors::cppTriggered()
@@ -111,6 +115,8 @@ void tst_qdeclarativebehaviors::cppTriggered()
QTest::qWait(200);
qreal x = innerRect->x();
QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered
+
+ delete rect;
}
void tst_qdeclarativebehaviors::loop()
@@ -122,6 +128,8 @@ void tst_qdeclarativebehaviors::loop()
//don't crash
rect->setState("moved");
+
+ delete rect;
}
void tst_qdeclarativebehaviors::colorBehavior()
@@ -135,6 +143,8 @@ void tst_qdeclarativebehaviors::colorBehavior()
QTest::qWait(200);
QColor color = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->color();
QVERIFY(color != QColor("red") && color != QColor("green")); //i.e. the behavior has been triggered
+
+ delete rect;
}
void tst_qdeclarativebehaviors::parentBehavior()
@@ -152,6 +162,8 @@ void tst_qdeclarativebehaviors::parentBehavior()
QTest::qWait(600);
parent = rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem();
QVERIFY(parent == newParent);
+
+ delete rect;
}
void tst_qdeclarativebehaviors::replaceBinding()
@@ -186,6 +198,8 @@ void tst_qdeclarativebehaviors::replaceBinding()
rect->setProperty("basex", 20);
QTest::qWait(600);
QCOMPARE(innerRect->x(), (qreal)20);
+
+ delete rect;
}
void tst_qdeclarativebehaviors::group()
@@ -200,6 +214,8 @@ void tst_qdeclarativebehaviors::group()
QTest::qWait(200);
qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x();
QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered
+
+ delete rect;
}
{
@@ -212,6 +228,8 @@ void tst_qdeclarativebehaviors::group()
QTest::qWait(200);
qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x();
QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered
+
+ delete rect;
}
}
@@ -225,6 +243,8 @@ void tst_qdeclarativebehaviors::emptyBehavior()
rect->setState("moved");
qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x();
QCOMPARE(x, qreal(200)); //should change immediately
+
+ delete rect;
}
void tst_qdeclarativebehaviors::explicitSelection()
@@ -239,6 +259,8 @@ void tst_qdeclarativebehaviors::explicitSelection()
QTest::qWait(200);
qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x();
QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered
+
+ delete rect;
}
}
@@ -253,6 +275,8 @@ void tst_qdeclarativebehaviors::nonSelectingBehavior()
rect->setState("moved");
qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x();
QCOMPARE(x, qreal(200)); //should change immediately
+
+ delete rect;
}
}
@@ -266,6 +290,8 @@ void tst_qdeclarativebehaviors::reassignedAnimation()
QCOMPARE(qobject_cast<QDeclarativeNumberAnimation*>(
qobject_cast<QDeclarativeBehavior*>(
rect->findChild<QDeclarativeBehavior*>("MyBehavior"))->animation())->duration(), 200);
+
+ delete rect;
}
void tst_qdeclarativebehaviors::disabled()
@@ -279,6 +305,8 @@ void tst_qdeclarativebehaviors::disabled()
rect->setState("moved");
qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x();
QCOMPARE(x, qreal(200)); //should change immediately
+
+ delete rect;
}
void tst_qdeclarativebehaviors::dontStart()
@@ -294,6 +322,8 @@ void tst_qdeclarativebehaviors::dontStart()
QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim");
QVERIFY(myAnim && myAnim->qtAnimation());
QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped);
+
+ delete rect;
}
QTEST_MAIN(tst_qdeclarativebehaviors)
diff --git a/tests/auto/declarative/qdeclarativebinding/data/test-binding.qml b/tests/auto/declarative/qdeclarativebinding/data/test-binding.qml
index e9101e4..8f5b39e 100644
--- a/tests/auto/declarative/qdeclarativebinding/data/test-binding.qml
+++ b/tests/auto/declarative/qdeclarativebinding/data/test-binding.qml
@@ -12,5 +12,5 @@ Rectangle {
Binding { target: screen; property: "text"; value: s1.text; objectName: "binding1" }
Binding { target: screen; property: "color"; value: r1.color }
- Binding { target: screen; property: "color"; when: screen.changeColor == true; value: r2.color }
+ Binding { target: screen; property: "color"; when: screen.changeColor == true; value: r2.color; objectName: "binding3" }
}
diff --git a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
index 483d588..8ab7b0b 100644
--- a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
+++ b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
@@ -69,14 +69,20 @@ void tst_qdeclarativebinding::binding()
QDeclarativeEngine engine;
QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-binding.qml"));
QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
-
QVERIFY(rect != 0);
+
+ QDeclarativeBind *binding3 = qobject_cast<QDeclarativeBind*>(rect->findChild<QDeclarativeBind*>("binding3"));
+ QVERIFY(binding3 != 0);
+
QCOMPARE(rect->color(), QColor("yellow"));
QCOMPARE(rect->property("text").toString(), QString("Hello"));
+ QCOMPARE(binding3->when(), false);
rect->setProperty("changeColor", true);
QCOMPARE(rect->color(), QColor("red"));
+ QCOMPARE(binding3->when(), true);
+
QDeclarativeBind *binding = qobject_cast<QDeclarativeBind*>(rect->findChild<QDeclarativeBind*>("binding1"));
QVERIFY(binding != 0);
QCOMPARE(binding->object(), qobject_cast<QObject*>(rect));
diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
index bbf7421..c1bf2b8 100644
--- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
+++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
@@ -156,6 +156,9 @@ void tst_qdeclarativeimage::imageSource()
QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create());
QVERIFY(obj != 0);
+ if (async)
+ QVERIFY(obj->asynchronous() == true);
+
if (remote || async)
TRY_WAIT(obj->status() == QDeclarativeImage::Loading);
diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
index a745a24..05d968c 100644
--- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
+++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
@@ -129,6 +129,10 @@ void tst_QDeclarativeLoader::component()
QCOMPARE(loader->status(), QDeclarativeLoader::Ready);
QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1);
+ QDeclarativeComponent *c = qobject_cast<QDeclarativeComponent*>(item->QGraphicsObject::children().at(0));
+ QVERIFY(c);
+ QCOMPARE(loader->sourceComponent(), c);
+
delete loader;
}