diff options
Diffstat (limited to 'tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp')
-rw-r--r-- | tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp index 80373fe..612220a 100644 --- a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp +++ b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp @@ -11,7 +11,7 @@ inline QUrl TEST_FILE(const QString &filename) { QFileInfo fileInfo(__FILE__); - return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename)); + return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename)); } inline QUrl TEST_FILE(const char *filename) @@ -39,6 +39,7 @@ private slots: void deferredProperties(); void extensionObjects(); void enums(); + void valueTypeFunctions(); private: QmlEngine engine; @@ -47,7 +48,7 @@ private: void tst_qmlbindengine::idShortcutInvalidates() { { - QmlComponent component(&engine, TEST_FILE("idShortcutInvalidates.txt")); + QmlComponent component(&engine, TEST_FILE("idShortcutInvalidates.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); QVERIFY(object != 0); QVERIFY(object->objectProperty() != 0); @@ -56,7 +57,7 @@ void tst_qmlbindengine::idShortcutInvalidates() } { - QmlComponent component(&engine, TEST_FILE("idShortcutInvalidates.1.txt")); + QmlComponent component(&engine, TEST_FILE("idShortcutInvalidates.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); QVERIFY(object != 0); QVERIFY(object->objectProperty() != 0); @@ -68,13 +69,13 @@ void tst_qmlbindengine::idShortcutInvalidates() void tst_qmlbindengine::boolPropertiesEvaluateAsBool() { { - QmlComponent component(&engine, TEST_FILE("boolPropertiesEvaluateAsBool.1.txt")); + QmlComponent component(&engine, TEST_FILE("boolPropertiesEvaluateAsBool.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->stringProperty(), QLatin1String("pass")); } { - QmlComponent component(&engine, TEST_FILE("boolPropertiesEvaluateAsBool.2.txt")); + QmlComponent component(&engine, TEST_FILE("boolPropertiesEvaluateAsBool.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->stringProperty(), QLatin1String("pass")); @@ -84,7 +85,7 @@ void tst_qmlbindengine::boolPropertiesEvaluateAsBool() void tst_qmlbindengine::signalAssignment() { { - QmlComponent component(&engine, TEST_FILE("signalAssignment.1.txt")); + QmlComponent component(&engine, TEST_FILE("signalAssignment.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->string(), QString()); @@ -93,7 +94,7 @@ void tst_qmlbindengine::signalAssignment() } { - QmlComponent component(&engine, TEST_FILE("signalAssignment.2.txt")); + QmlComponent component(&engine, TEST_FILE("signalAssignment.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->string(), QString()); @@ -105,7 +106,7 @@ void tst_qmlbindengine::signalAssignment() void tst_qmlbindengine::methods() { { - QmlComponent component(&engine, TEST_FILE("methods.1.txt")); + QmlComponent component(&engine, TEST_FILE("methods.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->methodCalled(), false); @@ -116,7 +117,7 @@ void tst_qmlbindengine::methods() } { - QmlComponent component(&engine, TEST_FILE("methods.2.txt")); + QmlComponent component(&engine, TEST_FILE("methods.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->methodCalled(), false); @@ -129,7 +130,7 @@ void tst_qmlbindengine::methods() void tst_qmlbindengine::bindingLoop() { - QmlComponent component(&engine, TEST_FILE("bindingLoop.txt")); + QmlComponent component(&engine, TEST_FILE("bindingLoop.qml")); QTest::ignoreMessage(QtWarningMsg, "QML MyQmlObject (unknown location): Binding loop detected for property \"stringProperty\" "); QObject *object = component.create(); QVERIFY(object != 0); @@ -337,7 +338,7 @@ void tst_qmlbindengine::objectPropertiesTriggerReeval() void tst_qmlbindengine::deferredProperties() { - QmlComponent component(&engine, TEST_FILE("deferredProperties.txt")); + QmlComponent component(&engine, TEST_FILE("deferredProperties.qml")); MyDeferredObject *object = qobject_cast<MyDeferredObject *>(component.create()); QVERIFY(object != 0); @@ -354,7 +355,7 @@ void tst_qmlbindengine::deferredProperties() void tst_qmlbindengine::extensionObjects() { - QmlComponent component(&engine, TEST_FILE("extensionObjects.txt")); + QmlComponent component(&engine, TEST_FILE("extensionObjects.qml")); MyExtendedObject *object = qobject_cast<MyExtendedObject *>(component.create()); QVERIFY(object != 0); @@ -385,6 +386,16 @@ void tst_qmlbindengine::enums() QCOMPARE(object->property("j").toInt(), 19); } +void tst_qmlbindengine::valueTypeFunctions() +{ + QmlComponent component(&engine, TEST_FILE("valueTypeFunctions.qml")); + MyTypeObject *obj = qobject_cast<MyTypeObject*>(component.create()); + QVERIFY(obj != 0); + QCOMPARE(obj->rectProperty(), QRect(0,0,100,100)); + QCOMPARE(obj->rectFProperty(), QRectF(0,0.5,100,99.5)); +} + + QTEST_MAIN(tst_qmlbindengine) #include "tst_qmlbindengine.moc" |