diff options
Diffstat (limited to 'tests')
57 files changed, 1126 insertions, 399 deletions
diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index 9d8ba6c..6b7d57f 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -373,7 +373,6 @@ void tst_qdeclarativeanchors::crash1() QString expect = "QML Text (" + source.toString() + ":4:5" + ") Possible anchor loop detected on fill."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); - QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); // XXX ideally, should be one message QDeclarativeView *view = new QDeclarativeView(source); qApp->processEvents(); diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml b/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml index 12b1b7b..5e1891a 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml @@ -10,7 +10,7 @@ Rectangle { width: 100; height: 100 color: Qt.rgba(1,0,0) Behavior on x { - NumberAnimation { objectName: "MyAnim"; running: true } + NumberAnimation {id: myAnim; objectName: "MyAnim"; running: true } } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml b/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml index 6419a6b..11b2d3a 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml @@ -8,8 +8,8 @@ Rectangle { width: 100; height: 100; color: "green" Behavior on x { objectName: "MyBehavior" - NumberAnimation { duration: 200 } - NumberAnimation { duration: 1000 } + NumberAnimation {id: na1; duration: 200 } + NumberAnimation {id: na2; duration: 1000 } } } MouseArea { diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml b/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml index c28fa9a..5e72bca 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml @@ -8,7 +8,7 @@ Rectangle { width: 100; height: 100; color: "green" Behavior on x { objectName: "MyBehavior"; - NumberAnimation { duration: 500; } + NumberAnimation {id: na; duration: 500; } } } MouseArea { diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp index f0117f5..b212820 100644 --- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp +++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp @@ -58,7 +58,7 @@ private slots: void engineMethod(); void parentContext(); void setContextProperty(); - void addDefaultObject(); + void setContextObject(); void destruction(); void idAsContextProperty(); @@ -224,24 +224,6 @@ private: int _c; }; -class TestObject2 : public QObject -{ - Q_OBJECT - Q_PROPERTY(int b READ b NOTIFY bChanged) - -public: - TestObject2() : _b(10) {} - - int b() const { return _b; } - void setB(int b) { _b = b; emit bChanged(); } - -signals: - void bChanged(); - -private: - int _b; -}; - #define TEST_CONTEXT_PROPERTY(ctxt, name, value) \ { \ QDeclarativeComponent component(&engine); \ @@ -367,35 +349,31 @@ void tst_qdeclarativecontext::setContextProperty() } } -void tst_qdeclarativecontext::addDefaultObject() +void tst_qdeclarativecontext::setContextObject() { QDeclarativeContext ctxt(&engine); TestObject to; - TestObject2 to2; to.setA(2); to.setB(192); to.setC(18); - to2.setB(111999); - ctxt.addDefaultObject(&to2); - ctxt.addDefaultObject(&to); + ctxt.setContextObject(&to); ctxt.setContextProperty("c", QVariant(9)); // Static context properties TEST_CONTEXT_PROPERTY(&ctxt, a, QVariant(2)); - TEST_CONTEXT_PROPERTY(&ctxt, b, QVariant(111999)); + TEST_CONTEXT_PROPERTY(&ctxt, b, QVariant(192)); TEST_CONTEXT_PROPERTY(&ctxt, c, QVariant(9)); to.setA(12); to.setB(100); to.setC(7); - to2.setB(1612); ctxt.setContextProperty("c", QVariant(3)); TEST_CONTEXT_PROPERTY(&ctxt, a, QVariant(12)); - TEST_CONTEXT_PROPERTY(&ctxt, b, QVariant(1612)); + TEST_CONTEXT_PROPERTY(&ctxt, b, QVariant(100)); TEST_CONTEXT_PROPERTY(&ctxt, c, QVariant(3)); // Changes in context properties diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/ownership.qml b/tests/auto/declarative/qdeclarativeecmascript/data/ownership.qml new file mode 100644 index 0000000..72edf6e --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/ownership.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +QtObject { + Component.onCompleted: { var a = getObject(); a = null; } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qlistqobjectMethods.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qlistqobjectMethods.qml new file mode 100644 index 0000000..5897e2a --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qlistqobjectMethods.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +QtObject { + property int test: getObjects().length + property bool test2: getObjects()[0].trueProperty +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp index 6a04704..ce505f3 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp @@ -74,12 +74,12 @@ private: void registerTypes() { - QML_REGISTER_TYPE(Qt.test, 1,0, MyQmlObject,MyQmlObject); - QML_REGISTER_TYPE(Qt.test, 1,0, MyDeferredObject,MyDeferredObject); - QML_REGISTER_TYPE(Qt.test, 1,0, MyQmlContainer,MyQmlContainer); - QML_REGISTER_EXTENDED_TYPE(Qt.test, 1,0, MyBaseExtendedObject,MyBaseExtendedObject,BaseExtensionObject); - QML_REGISTER_EXTENDED_TYPE(Qt.test, 1,0, MyExtendedObject,MyExtendedObject,ExtensionObject); - QML_REGISTER_TYPE(Qt.test, 1,0, MyTypeObject, MyTypeObject); + qmlRegisterType<MyQmlObject>("Qt.test", 1,0, "MyQmlObject"); + qmlRegisterType<MyDeferredObject>("Qt.test", 1,0, "MyDeferredObject"); + qmlRegisterType<MyQmlContainer>("Qt.test", 1,0, "MyQmlContainer"); + qmlRegisterExtendedType<MyBaseExtendedObject, BaseExtensionObject>("Qt.test", 1,0, "MyBaseExtendedObject"); + qmlRegisterExtendedType<MyExtendedObject, ExtensionObject>("Qt.test", 1,0, "MyExtendedObject"); + qmlRegisterType<MyTypeObject>("Qt.test", 1,0, "MyTypeObject"); } #include "testtypes.moc" diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index a283e3f..78a5e0f 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -207,18 +207,10 @@ class MyDefaultObject1 : public QObject Q_OBJECT Q_PROPERTY(int horseLegs READ horseLegs CONSTANT); Q_PROPERTY(int antLegs READ antLegs CONSTANT); + Q_PROPERTY(int emuLegs READ emuLegs CONSTANT); public: int horseLegs() const { return 4; } int antLegs() const { return 6; } -}; - -class MyDefaultObject2 : public QObject -{ - Q_OBJECT - Q_PROPERTY(int antLegs READ antLegs CONSTANT); - Q_PROPERTY(int emuLegs READ emuLegs CONSTANT); -public: - int antLegs() const { return 5; } // Had an accident int emuLegs() const { return 2; } }; diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 4838288..caefdbf 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -126,6 +126,8 @@ private slots: void attachedPropertyScope(); void scriptConnect(); void scriptDisconnect(); + void ownership(); + void qlistqobjectMethods(); void bug1(); @@ -348,7 +350,6 @@ void tst_qdeclarativeecmascript::basicExpressions() MyQmlObject object2; MyQmlObject object3; MyDefaultObject1 default1; - MyDefaultObject2 default2; MyDefaultObject3 default3; object1.setStringProperty("Object1"); object2.setStringProperty("Object2"); @@ -357,13 +358,12 @@ void tst_qdeclarativeecmascript::basicExpressions() QDeclarativeContext context(engine.rootContext()); QDeclarativeContext nestedContext(&context); - context.addDefaultObject(&default1); - context.addDefaultObject(&default2); + context.setContextObject(&default1); context.setContextProperty("a", QVariant(1944)); context.setContextProperty("b", QVariant("Milk")); context.setContextProperty("object", &object1); context.setContextProperty("objectOverride", &object2); - nestedContext.addDefaultObject(&default3); + nestedContext.setContextObject(&default3); nestedContext.setContextProperty("b", QVariant("Cow")); nestedContext.setContextProperty("objectOverride", &object3); nestedContext.setContextProperty("millipedeLegs", QVariant(100)); @@ -889,6 +889,7 @@ void tst_qdeclarativeecmascript::dynamicDestruction() } QVERIFY(!createdQmlObject); + QDeclarativeEngine::setObjectOwnership(object, QDeclarativeEngine::JavaScriptOwnership); QMetaObject::invokeMethod(object, "killMe"); QVERIFY(object); QTest::qWait(0); @@ -1636,7 +1637,7 @@ void tst_qdeclarativeecmascript::listToVariant() MyQmlContainer container; QDeclarativeContext context(engine.rootContext()); - context.addDefaultObject(&container); + context.setContextObject(&container); QObject *object = component.create(&context); QVERIFY(object != 0); @@ -1890,7 +1891,94 @@ void tst_qdeclarativeecmascript::scriptDisconnect() delete object; } +} + +class OwnershipObject : public QObject +{ + Q_OBJECT +public: + OwnershipObject() { object = new QObject; } + + QPointer<QObject> object; + +public slots: + QObject *getObject() { return object; } +}; + +void tst_qdeclarativeecmascript::ownership() +{ + OwnershipObject own; + QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext()); + context->setContextObject(&own); + + { + QDeclarativeComponent component(&engine, TEST_FILE("ownership.qml")); + + QVERIFY(own.object != 0); + + QObject *object = component.create(context); + QDeclarativeEnginePrivate::getScriptEngine(&engine)->collectGarbage(); + + QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + + QVERIFY(own.object == 0); + + delete object; + } + + own.object = new QObject(&own); + + { + QDeclarativeComponent component(&engine, TEST_FILE("ownership.qml")); + + QVERIFY(own.object != 0); + + QObject *object = component.create(context); + QDeclarativeEnginePrivate::getScriptEngine(&engine)->collectGarbage(); + QCoreApplication::processEvents(QEventLoop::DeferredDeletion); + + QVERIFY(own.object != 0); + + delete object; + } +} + +class QListQObjectMethodsObject : public QObject +{ + Q_OBJECT +public: + QListQObjectMethodsObject() { + m_objects.append(new MyQmlObject()); + m_objects.append(new MyQmlObject()); + } + + ~QListQObjectMethodsObject() { + qDeleteAll(m_objects); + } + +public slots: + QList<QObject *> getObjects() { return m_objects; } + +private: + QList<QObject *> m_objects; +}; + +// Tests that returning a QList<QObject*> from a method works +void tst_qdeclarativeecmascript::qlistqobjectMethods() +{ + QListQObjectMethodsObject obj; + QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext()); + context->setContextObject(&obj); + + QDeclarativeComponent component(&engine, TEST_FILE("qlistqobjectMethods.qml")); + + QObject *object = component.create(context); + + QCOMPARE(object->property("test").toInt(), 2); + QCOMPARE(object->property("test2").toBool(), true); + + delete object; } QTEST_MAIN(tst_qdeclarativeecmascript) diff --git a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro index 0c736b4..3ba50be 100644 --- a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro +++ b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro @@ -1,8 +1,9 @@ load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui +contains(QT_CONFIG,declarative): QT += declarative gui network macx:CONFIG -= app_bundle -SOURCES += tst_qdeclarativefontloader.cpp +HEADERS += ../shared/testhttpserver.h +SOURCES += tst_qdeclarativefontloader.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp index a9762df..375e801 100644 --- a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp +++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -43,6 +43,9 @@ #include <QtDeclarative/qdeclarativecomponent.h> #include <private/qdeclarativefontloader_p.h> #include "../../../shared/util.h" +#include "../shared/testhttpserver.h" + +#define SERVER_PORT 14445 class tst_qdeclarativefontloader : public QObject @@ -57,16 +60,21 @@ private slots: void localFont(); void failLocalFont(); void webFont(); + void redirWebFont(); void failWebFont(); private slots: private: QDeclarativeEngine engine; + TestHTTPServer server; }; -tst_qdeclarativefontloader::tst_qdeclarativefontloader() +tst_qdeclarativefontloader::tst_qdeclarativefontloader() : + server(SERVER_PORT) { + server.serveDirectory(SRCDIR "/data"); + Q_ASSERT(server.isValid()); } void tst_qdeclarativefontloader::noFont() @@ -126,21 +134,38 @@ void tst_qdeclarativefontloader::failLocalFont() void tst_qdeclarativefontloader::webFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://www.princexml.com/fonts/steffmann/Starburst.ttf\" }"; + QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/tarzeau_ocr_a.ttf\" }"; + QDeclarativeComponent component(&engine); + + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QVERIFY(fontObject->source() != QUrl("")); + QTRY_COMPARE(fontObject->name(), QString("OCRA")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); +} + +void tst_qdeclarativefontloader::redirWebFont() +{ + server.addRedirect("olddir/oldname.ttf","../tarzeau_ocr_a.ttf"); + + QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/olddir/oldname.ttf\" }"; QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); QVERIFY(fontObject != 0); QVERIFY(fontObject->source() != QUrl("")); - QTRY_COMPARE(fontObject->name(), QString("Starburst")); + QTRY_COMPARE(fontObject->name(), QString("OCRA")); QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); } void tst_qdeclarativefontloader::failWebFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://wrong.address.com/Starburst.ttf\" }"; - QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://wrong.address.com/Starburst.ttf\" ) "); + QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/nonexist.ttf\" }"; + QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://localhost:14445/nonexist.ttf\" ) "); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml index 32833d2..cc3e549 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml @@ -1,6 +1,7 @@ import Qt 4.6 Rectangle { + property int current: grid.currentIndex width: 240 height: 320 color: "#ffffff" diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index a1edc53..385d6f5 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -703,6 +703,11 @@ void tst_QDeclarativeGridView::currentIndex() QCOMPARE(gridview->highlightItem()->x(), hlPosX); QCOMPARE(gridview->highlightItem()->y(), hlPosY); + // insert item before currentIndex + gridview->setCurrentIndex(28); + model.insertItem(0, "Foo", "1111"); + QCOMPARE(canvas->rootObject()->property("current").toInt(), 29); + delete canvas; } @@ -944,7 +949,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex() } // Position on a currently visible item - gridview->positionViewAtIndex(4); + gridview->positionViewAtIndex(4, QDeclarativeGridView::Beginning); QCOMPARE(gridview->contentY(), 60.); // Confirm items positioned correctly @@ -958,7 +963,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex() } // Position on an item beyond the visible items - gridview->positionViewAtIndex(21); + gridview->positionViewAtIndex(21, QDeclarativeGridView::Beginning); QCOMPARE(gridview->contentY(), 420.); // Confirm items positioned correctly @@ -972,7 +977,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex() } // Position on an item that would leave empty space if positioned at the top - gridview->positionViewAtIndex(31); + gridview->positionViewAtIndex(31, QDeclarativeGridView::Beginning); QCOMPARE(gridview->contentY(), 520.); // Confirm items positioned correctly @@ -986,7 +991,7 @@ void tst_QDeclarativeGridView::positionViewAtIndex() } // Position at the beginning again - gridview->positionViewAtIndex(0); + gridview->positionViewAtIndex(0, QDeclarativeGridView::Beginning); QCOMPARE(gridview->contentY(), 0.); // Confirm items positioned correctly @@ -999,6 +1004,47 @@ void tst_QDeclarativeGridView::positionViewAtIndex() QCOMPARE(item->y(), (i/3)*60.); } + // Position at End + gridview->positionViewAtIndex(30, QDeclarativeGridView::End); + QCOMPARE(gridview->contentY(), 340.); + + // Position in Center + gridview->positionViewAtIndex(15, QDeclarativeGridView::Center); + QCOMPARE(gridview->contentY(), 170.); + + // Ensure at least partially visible + gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible); + QCOMPARE(gridview->contentY(), 170.); + + gridview->setContentY(302); + gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible); + QCOMPARE(gridview->contentY(), 302.); + + gridview->setContentY(360); + gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible); + QCOMPARE(gridview->contentY(), 300.); + + gridview->setContentY(60); + gridview->positionViewAtIndex(20, QDeclarativeGridView::Visible); + QCOMPARE(gridview->contentY(), 60.); + + gridview->setContentY(20); + gridview->positionViewAtIndex(20, QDeclarativeGridView::Visible); + QCOMPARE(gridview->contentY(), 100.); + + // Ensure completely visible + gridview->setContentY(120); + gridview->positionViewAtIndex(20, QDeclarativeGridView::Contain); + QCOMPARE(gridview->contentY(), 120.); + + gridview->setContentY(302); + gridview->positionViewAtIndex(15, QDeclarativeGridView::Contain); + QCOMPARE(gridview->contentY(), 300.); + + gridview->setContentY(60); + gridview->positionViewAtIndex(20, QDeclarativeGridView::Contain); + QCOMPARE(gridview->contentY(), 100.); + delete canvas; } diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp index 636c5e3..5f6d9a4 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp +++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp @@ -93,7 +93,7 @@ void tst_qdeclarativeinstruction::dump() QDeclarativeInstruction i; i.line = 2; i.type = QDeclarativeInstruction::SetId; - i.setId.value = 0; + i.setId.value = data->primitives.count() - 1; i.setId.index = 0; data->bytecode << i; } @@ -171,17 +171,17 @@ void tst_qdeclarativeinstruction::dump() i.line = 10; i.type = QDeclarativeInstruction::StoreString; i.storeString.propertyIndex = 7; - i.storeString.value = 1; + i.storeString.value = data->primitives.count() - 1; data->bytecode << i; } { - data->primitives << "http://www.nokia.com"; + data->urls << QUrl("http://www.nokia.com"); QDeclarativeInstruction i; i.line = 11; i.type = QDeclarativeInstruction::StoreUrl; i.storeUrl.propertyIndex = 8; - i.storeUrl.value = 2; + i.storeUrl.value = data->urls.count() - 1; data->bytecode << i; } @@ -290,7 +290,7 @@ void tst_qdeclarativeinstruction::dump() i.line = 23; i.type = QDeclarativeInstruction::StoreVariant; i.storeString.propertyIndex = 20; - i.storeString.value = 3; + i.storeString.value = data->primitives.count() - 1; data->bytecode << i; } @@ -326,7 +326,7 @@ void tst_qdeclarativeinstruction::dump() i.line = 27; i.type = QDeclarativeInstruction::StoreSignal; i.storeSignal.signalIndex = 2; - i.storeSignal.value = 4; + i.storeSignal.value = data->primitives.count() - 1; data->bytecode << i; } @@ -527,7 +527,7 @@ void tst_qdeclarativeinstruction::dump() << "8\t\t8\tSTORE_INTEGER\t\t5\t9" << "9\t\t9\tSTORE_BOOL\t\t6\ttrue" << "10\t\t10\tSTORE_STRING\t\t7\t1\t\t\"Test String\"" - << "11\t\t11\tSTORE_URL\t\t8\t2\t\t\"http://www.nokia.com\"" + << "11\t\t11\tSTORE_URL\t\t8\t0\t\tQUrl(\"http://www.nokia.com\") " << "12\t\t12\tSTORE_COLOR\t\t9\t\t\t\"ff00ff00\"" << "13\t\t13\tSTORE_DATE\t\t10\t9" << "14\t\t14\tSTORE_TIME\t\t11\t33" @@ -539,11 +539,11 @@ void tst_qdeclarativeinstruction::dump() << "20\t\t20\tSTORE_RECT\t\t17\t2" << "21\t\t21\tSTORE_RECTF\t\t18\t19" << "22\t\t22\tSTORE_VECTOR3D\t\t19\t9" - << "23\t\t23\tSTORE_VARIANT\t\t20\t3\t\t\"color(1, 1, 1, 1)\"" + << "23\t\t23\tSTORE_VARIANT\t\t20\t2\t\t\"color(1, 1, 1, 1)\"" << "24\t\t24\tSTORE_OBJECT\t\t21" << "25\t\t25\tSTORE_VARIANT_OBJECT\t22" << "26\t\t26\tSTORE_INTERFACE\t\t23" - << "27\t\t27\tSTORE_SIGNAL\t\t2\t4\t\t\"console.log(1921)\"" + << "27\t\t27\tSTORE_SIGNAL\t\t2\t3\t\t\"console.log(1921)\"" << "28\t\t28\tSTORE_SCRIPT\t\t2" << "29\t\t29\tSTORE_SCRIPT_STRING\t24\t3\t1" << "30\t\t30\tASSIGN_SIGNAL_OBJECT\t0\t\t\t\"mySignal\"" diff --git a/tests/auto/declarative/qdeclarativeitem/data/propertychanges.qml b/tests/auto/declarative/qdeclarativeitem/data/propertychanges.qml new file mode 100644 index 0000000..bf4dd85 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeitem/data/propertychanges.qml @@ -0,0 +1,10 @@ +import Qt 4.6 + +Item { + Item { + objectName: "item" + } + Item { + objectName: "parentItem" + } +}
\ No newline at end of file diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index bbcc86e..45d670f 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -60,6 +60,7 @@ private slots: void clip(); void mapCoordinates(); void mapCoordinates_data(); + void propertyChanges(); private: template<typename T> @@ -289,7 +290,7 @@ void tst_QDeclarativeItem::smooth() QDeclarativeComponent component(&engine); component.setData("import Qt 4.6; Item { smooth: false; }", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); - QSignalSpy spy(item, SIGNAL(smoothChanged())); + QSignalSpy spy(item, SIGNAL(smoothChanged(bool))); QVERIFY(item); QVERIFY(!item->smooth()); @@ -297,6 +298,10 @@ void tst_QDeclarativeItem::smooth() item->setSmooth(true); QVERIFY(item->smooth()); QCOMPARE(spy.count(),1); + QList<QVariant> arguments = spy.first(); + QVERIFY(arguments.count() == 1); + QVERIFY(arguments.at(0).toBool() == true); + item->setSmooth(true); QCOMPARE(spy.count(),1); @@ -314,13 +319,18 @@ void tst_QDeclarativeItem::clip() QDeclarativeComponent component(&engine); component.setData("import Qt 4.6\nItem { clip: false\n }", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); - QSignalSpy spy(item, SIGNAL(clipChanged())); + QSignalSpy spy(item, SIGNAL(clipChanged(bool))); QVERIFY(item); QVERIFY(!item->clip()); item->setClip(true); QVERIFY(item->clip()); + + QList<QVariant> arguments = spy.first(); + QVERIFY(arguments.count() == 1); + QVERIFY(arguments.at(0).toBool() == true); + QCOMPARE(spy.count(),1); item->setClip(true); QCOMPARE(spy.count(),1); @@ -392,6 +402,84 @@ void tst_QDeclarativeItem::mapCoordinates_data() QTest::newRow(QTest::toString(i)) << i << i; } +void tst_QDeclarativeItem::propertyChanges() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + canvas->show(); + + QEvent wa(QEvent::WindowActivate); + QApplication::sendEvent(canvas, &wa); + QFocusEvent fe(QEvent::FocusIn); + QApplication::sendEvent(canvas, &fe); + + QDeclarativeItem *item = findItem<QDeclarativeItem>(canvas->rootObject(), "item"); + QDeclarativeItem *parentItem = findItem<QDeclarativeItem>(canvas->rootObject(), "parentItem"); + + QVERIFY(item); + QVERIFY(parentItem); + + QSignalSpy parentSpy(item, SIGNAL(parentChanged(QDeclarativeItem *))); + QSignalSpy widthSpy(item, SIGNAL(widthChanged(qreal))); + QSignalSpy heightSpy(item, SIGNAL(heightChanged(qreal))); + QSignalSpy baselineOffsetSpy(item, SIGNAL(baselineOffsetChanged(qreal))); + QSignalSpy childrenRectSpy(parentItem, SIGNAL(childrenRectChanged(QRectF))); + QSignalSpy focusSpy(item, SIGNAL(focusChanged(bool))); + QSignalSpy wantsFocusSpy(parentItem, SIGNAL(wantsFocusChanged(bool))); + + item->setParentItem(parentItem); + item->setWidth(100.0); + item->setHeight(200.0); + item->setFocus(true); + item->setBaselineOffset(10.0); + + QCOMPARE(item->parentItem(), parentItem); + QCOMPARE(parentSpy.count(),1); + QList<QVariant> parentArguments = parentSpy.first(); + QVERIFY(parentArguments.count() == 1); + QCOMPARE(item->parentItem(), qvariant_cast<QDeclarativeItem *>(parentArguments.at(0))); + + QCOMPARE(item->width(), 100.0); + QCOMPARE(widthSpy.count(),1); + QList<QVariant> widthArguments = widthSpy.first(); + QVERIFY(widthArguments.count() == 1); + QCOMPARE(item->width(), widthArguments.at(0).toReal()); + + QCOMPARE(item->height(), 200.0); + QCOMPARE(heightSpy.count(),1); + QList<QVariant> heightArguments = heightSpy.first(); + QVERIFY(heightArguments.count() == 1); + QCOMPARE(item->height(), heightArguments.at(0).toReal()); + + QCOMPARE(item->baselineOffset(), 10.0); + QCOMPARE(baselineOffsetSpy.count(),1); + QList<QVariant> baselineOffsetArguments = baselineOffsetSpy.first(); + QVERIFY(baselineOffsetArguments.count() == 1); + QCOMPARE(item->baselineOffset(), baselineOffsetArguments.at(0).toReal()); + + QCOMPARE(parentItem->childrenRect(), QRectF(0.0,0.0,100.0,200.0)); + QCOMPARE(childrenRectSpy.count(),2); + QList<QVariant> childrenRectArguments = childrenRectSpy.at(1); + QVERIFY(childrenRectArguments.count() == 1); + QCOMPARE(parentItem->childrenRect(), childrenRectArguments.at(0).toRectF()); + + QCOMPARE(item->hasFocus(), true); + QCOMPARE(focusSpy.count(),1); + QList<QVariant> focusArguments = focusSpy.first(); + QVERIFY(focusArguments.count() == 1); + QCOMPARE(focusArguments.at(0).toBool(), true); + + QCOMPARE(parentItem->hasFocus(), false); + QCOMPARE(parentItem->wantsFocus(), true); + QCOMPARE(wantsFocusSpy.count(),1); + QList<QVariant> wantsFocusArguments = wantsFocusSpy.first(); + QVERIFY(wantsFocusArguments.count() == 1); + QCOMPARE(wantsFocusArguments.at(0).toBool(), true); + + delete canvas; +} + template<typename T> T *tst_QDeclarativeItem::findItem(QGraphicsObject *parent, const QString &objectName) { diff --git a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir index b32f82b..303c5c8 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir @@ -1,3 +1,3 @@ -Test 0.0 Test.qml -TestSubDir 0.0 TestSubDir.qml -TestLocal 0.0 TestLocal.qml +Test Test.qml +TestSubDir TestSubDir.qml +TestLocal TestLocal.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/subdir/qmldir b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/subdir/qmldir index f7016c7..a54f7df 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/subdir/qmldir +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/subdir/qmldir @@ -1 +1 @@ -SubTest 0.0 SubTest.qml +SubTest SubTest.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp index 9ffe28a..6efe755 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp @@ -42,15 +42,15 @@ void registerTypes() { - QML_REGISTER_INTERFACE(MyInterface); - QML_REGISTER_TYPE(Test,1,0,MyQmlObject,MyQmlObject); - QML_REGISTER_TYPE(Test,1,0,MyTypeObject,MyTypeObject); - QML_REGISTER_TYPE(Test,1,0,MyContainer,MyContainer); - QML_REGISTER_TYPE(Test,1,0,MyPropertyValueSource,MyPropertyValueSource); - QML_REGISTER_TYPE(Test,1,0,MyDotPropertyObject,MyDotPropertyObject); - QML_REGISTER_TYPE(Test,1,0,MyNamespacedType,MyNamespace::MyNamespacedType); - QML_REGISTER_TYPE(Test,1,0,MySecondNamespacedType,MyNamespace::MySecondNamespacedType); - QML_REGISTER_NOCREATE_TYPE(MyGroupedObject); + qmlRegisterInterface<MyInterface>("MyInterface"); + qmlRegisterType<MyQmlObject>("Test",1,0,"MyQmlObject"); + qmlRegisterType<MyTypeObject>("Test",1,0,"MyTypeObject"); + qmlRegisterType<MyContainer>("Test",1,0,"MyContainer"); + qmlRegisterType<MyPropertyValueSource>("Test",1,0,"MyPropertyValueSource"); + qmlRegisterType<MyDotPropertyObject>("Test",1,0,"MyDotPropertyObject"); + qmlRegisterType<MyNamespace::MyNamespacedType>("Test",1,0,"MyNamespacedType"); + qmlRegisterType<MyNamespace::MySecondNamespacedType>("Test",1,0,"MySecondNamespacedType"); + qmlRegisterType<MyGroupedObject>(); } QVariant myCustomVariantTypeConverter(const QString &data) diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 083c551..6b564d4 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -1418,12 +1418,12 @@ void tst_qdeclarativelanguage::initTestCase() { registerTypes(); - QML_REGISTER_TYPE(com.nokia.Test, 0, 0, TestTP, TestType); - QML_REGISTER_TYPE(com.nokia.Test, 1, 0, Test, TestType); - QML_REGISTER_TYPE(com.nokia.Test, 1, 5, Test, TestType); - QML_REGISTER_TYPE(com.nokia.Test, 1, 8, Test, TestType2); - QML_REGISTER_TYPE(com.nokia.Test, 1, 9, OldTest, TestType); - QML_REGISTER_TYPE(com.nokia.Test, 1, 12, Test, TestType2); + qmlRegisterType<TestType>("com.nokia.Test", 0, 0, "TestTP"); + qmlRegisterType<TestType>("com.nokia.Test", 1, 0, "Test"); + qmlRegisterType<TestType>("com.nokia.Test", 1, 5, "Test"); + qmlRegisterType<TestType2>("com.nokia.Test", 1, 8, "Test"); + qmlRegisterType<TestType>("com.nokia.Test", 1, 9, "OldTest"); + qmlRegisterType<TestType2>("com.nokia.Test", 1, 12, "Test"); // Create locale-specific file // For POSIX, this will just be data/I18nType.qml, since POSIX is 7-bit diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index a1e6d6b..1b59608 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -214,7 +214,7 @@ void tst_QDeclarativeListModel::dynamic() QDeclarativeEngine engine; QDeclarativeListModel model; QDeclarativeEngine::setContextForObject(&model,engine.rootContext()); - engine.rootContext()->addDefaultObject(&model); + engine.rootContext()->setContextObject(&model); QDeclarativeExpression e(engine.rootContext(), script, &model); if (!warning.isEmpty()) QTest::ignoreMessage(QtWarningMsg, warning.toLatin1()); diff --git a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp index 1b7af19..f3c72d1 100644 --- a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp +++ b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp @@ -106,7 +106,7 @@ QML_DECLARE_TYPE(TestType); void tst_qdeclarativelistreference::initTestCase() { - QML_REGISTER_NOCREATE_TYPE(TestType); + qmlRegisterType<TestType>(); } void tst_qdeclarativelistreference::qmllistreference() diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml index 74f5ef4..a6d7610 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml @@ -1,6 +1,7 @@ import Qt 4.6 Rectangle { + property int current: list.currentIndex width: 240 height: 320 color: "#ffffff" diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 75fbbf8..5b57487 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -925,6 +925,7 @@ void tst_QDeclarativeListView::sections() // Remove section boundary model.removeItem(5); + QTest::qWait(100); // New section header created QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", 5); @@ -932,6 +933,7 @@ void tst_QDeclarativeListView::sections() QCOMPARE(item->height(), 40.0); model.insertItem(3, "New Item", "0"); + QTest::qWait(100); // Section header moved item = findItem<QDeclarativeItem>(viewport, "wrapper", 5); @@ -944,6 +946,7 @@ void tst_QDeclarativeListView::sections() // insert item which will become a section header model.insertItem(6, "Replace header", "1"); + QTest::qWait(100); item = findItem<QDeclarativeItem>(viewport, "wrapper", 6); QVERIFY(item); @@ -1056,6 +1059,11 @@ void tst_QDeclarativeListView::currentIndex() QTest::qWait(500); QCOMPARE(listview->highlightItem()->y(), hlPos); + // insert item before currentIndex + listview->setCurrentIndex(28); + model.insertItem(0, "Foo", "1111"); + QCOMPARE(canvas->rootObject()->property("current").toInt(), 29); + delete canvas; } @@ -1185,7 +1193,7 @@ void tst_QDeclarativeListView::positionViewAtIndex() } // Position on a currently visible item - listview->positionViewAtIndex(3); + listview->positionViewAtIndex(3, QDeclarativeListView::Beginning); QCOMPARE(listview->contentY(), 60.); // Confirm items positioned correctly @@ -1198,7 +1206,7 @@ void tst_QDeclarativeListView::positionViewAtIndex() } // Position on an item beyond the visible items - listview->positionViewAtIndex(22); + listview->positionViewAtIndex(22, QDeclarativeListView::Beginning); QCOMPARE(listview->contentY(), 440.); // Confirm items positioned correctly @@ -1211,7 +1219,7 @@ void tst_QDeclarativeListView::positionViewAtIndex() } // Position on an item that would leave empty space if positioned at the top - listview->positionViewAtIndex(28); + listview->positionViewAtIndex(28, QDeclarativeListView::Beginning); QCOMPARE(listview->contentY(), 480.); // Confirm items positioned correctly @@ -1224,7 +1232,7 @@ void tst_QDeclarativeListView::positionViewAtIndex() } // Position at the beginning again - listview->positionViewAtIndex(0); + listview->positionViewAtIndex(0, QDeclarativeListView::Beginning); QCOMPARE(listview->contentY(), 0.); // Confirm items positioned correctly @@ -1236,6 +1244,47 @@ void tst_QDeclarativeListView::positionViewAtIndex() QCOMPARE(item->y(), i*20.); } + // Position at End + listview->positionViewAtIndex(20, QDeclarativeListView::End); + QCOMPARE(listview->contentY(), 100.); + + // Position in Center + listview->positionViewAtIndex(15, QDeclarativeListView::Center); + QCOMPARE(listview->contentY(), 150.); + + // Ensure at least partially visible + listview->positionViewAtIndex(15, QDeclarativeListView::Visible); + QCOMPARE(listview->contentY(), 150.); + + listview->setContentY(302); + listview->positionViewAtIndex(15, QDeclarativeListView::Visible); + QCOMPARE(listview->contentY(), 302.); + + listview->setContentY(320); + listview->positionViewAtIndex(15, QDeclarativeListView::Visible); + QCOMPARE(listview->contentY(), 300.); + + listview->setContentY(85); + listview->positionViewAtIndex(20, QDeclarativeListView::Visible); + QCOMPARE(listview->contentY(), 85.); + + listview->setContentY(75); + listview->positionViewAtIndex(20, QDeclarativeListView::Visible); + QCOMPARE(listview->contentY(), 100.); + + // Ensure completely visible + listview->setContentY(120); + listview->positionViewAtIndex(20, QDeclarativeListView::Contain); + QCOMPARE(listview->contentY(), 120.); + + listview->setContentY(302); + listview->positionViewAtIndex(15, QDeclarativeListView::Contain); + QCOMPARE(listview->contentY(), 300.); + + listview->setContentY(85); + listview->positionViewAtIndex(20, QDeclarativeListView::Contain); + QCOMPARE(listview->contentY(), 100.); + delete canvas; } diff --git a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp index 818f108..279a9b7 100644 --- a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp +++ b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp @@ -132,10 +132,10 @@ QML_DECLARE_TYPE(ValueInterceptorTestType); void tst_qdeclarativemetatype::initTestCase() { - QML_REGISTER_TYPE(Test, 1, 0, TestType, TestType); - QML_REGISTER_TYPE(Test, 1, 0, ParserStatusTestType, ParserStatusTestType); - QML_REGISTER_TYPE(Test, 1, 0, ValueSourceTestType, ValueSourceTestType); - QML_REGISTER_TYPE(Test, 1, 0, ValueInterceptorTestType, ValueInterceptorTestType); + qmlRegisterType<TestType>("Test", 1, 0, "TestType"); + qmlRegisterType<ParserStatusTestType>("Test", 1, 0, "ParserStatusTestType"); + qmlRegisterType<ValueSourceTestType>("Test", 1, 0, "ValueSourceTestType"); + qmlRegisterType<ValueInterceptorTestType>("Test", 1, 0, "ValueInterceptorTestType"); } void tst_qdeclarativemetatype::copy() diff --git a/tests/auto/declarative/qdeclarativeparticles/data/particlemotion.qml b/tests/auto/declarative/qdeclarativeparticles/data/particlemotion.qml index ace61fe..f1e4909 100644 --- a/tests/auto/declarative/qdeclarativeparticles/data/particlemotion.qml +++ b/tests/auto/declarative/qdeclarativeparticles/data/particlemotion.qml @@ -1,10 +1,12 @@ import Qt 4.6 +import Qt.labs.particles 1.0 + Rectangle { width: 240 height: 320 color: "black" Particles { - objectName: "particles" + objectName: "particles" anchors.fill: parent width: 1 height: 1 @@ -30,4 +32,4 @@ Rectangle { pace: 100 } ] -}
\ No newline at end of file +} diff --git a/tests/auto/declarative/qdeclarativeparticles/data/particles.qml b/tests/auto/declarative/qdeclarativeparticles/data/particles.qml index 0d42645..4f168a9 100644 --- a/tests/auto/declarative/qdeclarativeparticles/data/particles.qml +++ b/tests/auto/declarative/qdeclarativeparticles/data/particles.qml @@ -1,4 +1,6 @@ import Qt 4.6 +import Qt.labs.particles 1.0 + Rectangle{ width: 100 height: 100 @@ -7,7 +9,7 @@ Rectangle{ Particles { id: particles objectName: "particles" width:1; height:1; anchors.centerIn: parent; opacity: 1 - lifeSpan: 100; lifeSpanDeviation: 20; count:1000; + lifeSpan: 100; lifeSpanDeviation: 20; count:1000; fadeInDuration: 20; fadeOutDuration: 20; emissionRate: 1000 angle: 0; angleDeviation: 360; velocity: 500; velocityDeviation:30 source: "particle.png" diff --git a/tests/auto/declarative/qdeclarativeparticles/tst_qdeclarativeparticles.cpp b/tests/auto/declarative/qdeclarativeparticles/tst_qdeclarativeparticles.cpp index 6090a07..f4e9a27 100644 --- a/tests/auto/declarative/qdeclarativeparticles/tst_qdeclarativeparticles.cpp +++ b/tests/auto/declarative/qdeclarativeparticles/tst_qdeclarativeparticles.cpp @@ -41,7 +41,7 @@ #include <QtTest/QtTest> #include <QtTest/QSignalSpy> #include <qdeclarativeview.h> -#include <private/qdeclarativeparticles_p.h> +#include <QGraphicsObject> class tst_QDeclarativeParticles : public QObject { @@ -67,73 +67,75 @@ void tst_QDeclarativeParticles::properties() { QDeclarativeView *canvas = createView(SRCDIR "/data/particles.qml"); QVERIFY(canvas->rootObject()); - QDeclarativeParticles* particles = canvas->rootObject()->findChild<QDeclarativeParticles*>("particles"); + + QObject* particles = canvas->rootObject()->findChild<QObject*>("particles"); QVERIFY(particles); - particles->setSource(QUrl::fromLocalFile(SRCDIR "/data/particle.png")); - QCOMPARE(particles->source(), QUrl::fromLocalFile(SRCDIR "/data/particle.png")); + particles->setProperty("source", QUrl::fromLocalFile(SRCDIR "/data/particle.png")); + QCOMPARE(particles->property("source").toUrl(), QUrl::fromLocalFile(SRCDIR "/data/particle.png")); - particles->setLifeSpanDeviation(1000); - QCOMPARE(particles->lifeSpanDeviation(), 1000); + particles->setProperty("lifeSpanDeviation", (1000)); + QCOMPARE(particles->property("lifeSpanDeviation").toInt(), 1000); - particles->setFadeInDuration(1000); - QCOMPARE(particles->fadeInDuration(), 1000); + particles->setProperty("fadeInDuration", 1000); + QCOMPARE(particles->property("fadeInDuration").toInt(), 1000); - particles->setFadeOutDuration(1000); - QCOMPARE(particles->fadeOutDuration(), 1000); + particles->setProperty("fadeOutDuration", 1000); + QCOMPARE(particles->property("fadeOutDuration").toInt(), 1000); - particles->setAngle(100.0); - QCOMPARE(particles->angle(), 100.0); + particles->setProperty("angle", 100.0); + QCOMPARE(particles->property("angle").toDouble(), 100.0); - particles->setAngleDeviation(100.0); - QCOMPARE(particles->angleDeviation(), 100.0); + particles->setProperty("angleDeviation", 100.0); + QCOMPARE(particles->property("angleDeviation").toDouble(), 100.0); - particles->setVelocity(100.0); - QCOMPARE(particles->velocity(), 100.0); + particles->setProperty("velocity", 100.0); + QCOMPARE(particles->property("velocity").toDouble(), 100.0); - particles->setVelocityDeviation(100.0); - QCOMPARE(particles->velocityDeviation(), 100.0); + particles->setProperty("velocityDeviation", 100.0); + QCOMPARE(particles->property("velocityDeviation").toDouble(), 100.0); - particles->setEmissionVariance(0.5); - QCOMPARE(particles->emissionVariance(),0.5); + particles->setProperty("emissionVariance", 0.5); + QCOMPARE(particles->property("emissionVariance").toDouble(),0.5); - particles->setEmissionRate(12); - QCOMPARE(particles->emissionRate(), 12); + particles->setProperty("emissionRate", 12); + QCOMPARE(particles->property("emissionRate").toInt(), 12); } void tst_QDeclarativeParticles::motionGravity() { QDeclarativeView *canvas = createView(SRCDIR "/data/particlemotion.qml"); QVERIFY(canvas->rootObject()); - QDeclarativeParticles* particles = canvas->rootObject()->findChild<QDeclarativeParticles*>("particles"); + + QObject* particles = canvas->rootObject()->findChild<QObject*>("particles"); QVERIFY(particles); - QDeclarativeParticleMotionGravity* motionGravity = canvas->rootObject()->findChild<QDeclarativeParticleMotionGravity*>("motionGravity"); - QCOMPARE(particles->motion(), motionGravity); + QObject* motionGravity = canvas->rootObject()->findChild<QObject*>("motionGravity"); + //QCOMPARE(qvariant_cast<QObject*>(particles->property("motion")), motionGravity); QSignalSpy xattractorSpy(motionGravity, SIGNAL(xattractorChanged())); QSignalSpy yattractorSpy(motionGravity, SIGNAL(yattractorChanged())); QSignalSpy accelerationSpy(motionGravity, SIGNAL(accelerationChanged())); - QCOMPARE(motionGravity->xAttractor(), 0.0); - QCOMPARE(motionGravity->yAttractor(), 1000.0); - QCOMPARE(motionGravity->acceleration(), 25.0); + QCOMPARE(motionGravity->property("xattractor").toDouble(), 0.0); + QCOMPARE(motionGravity->property("yattractor").toDouble(), 1000.0); + QCOMPARE(motionGravity->property("acceleration").toDouble(), 25.0); - motionGravity->setXAttractor(20.0); - motionGravity->setYAttractor(10.0); - motionGravity->setAcceleration(10.0); + motionGravity->setProperty("xattractor", 20.0); + motionGravity->setProperty("yattractor", 10.0); + motionGravity->setProperty("acceleration", 10.0); - QCOMPARE(motionGravity->xAttractor(), 20.0); - QCOMPARE(motionGravity->yAttractor(), 10.0); - QCOMPARE(motionGravity->acceleration(), 10.0); + QCOMPARE(motionGravity->property("xattractor").toDouble(), 20.0); + QCOMPARE(motionGravity->property("yattractor").toDouble(), 10.0); + QCOMPARE(motionGravity->property("acceleration").toDouble(), 10.0); QCOMPARE(xattractorSpy.count(), 1); QCOMPARE(yattractorSpy.count(), 1); QCOMPARE(accelerationSpy.count(), 1); - motionGravity->setXAttractor(20.0); - motionGravity->setYAttractor(10.0); - motionGravity->setAcceleration(10.0); + motionGravity->setProperty("xattractor", 20.0); + motionGravity->setProperty("yattractor", 10.0); + motionGravity->setProperty("acceleration", 10.0); QCOMPARE(xattractorSpy.count(), 1); QCOMPARE(yattractorSpy.count(), 1); @@ -144,42 +146,44 @@ void tst_QDeclarativeParticles::motionWander() { QDeclarativeView *canvas = createView(SRCDIR "/data/particlemotion.qml"); QVERIFY(canvas->rootObject()); - QDeclarativeParticles* particles = canvas->rootObject()->findChild<QDeclarativeParticles*>("particles"); + + QObject* particles = canvas->rootObject()->findChild<QObject*>("particles"); QVERIFY(particles); - + QSignalSpy motionSpy(particles, SIGNAL(motionChanged())); - QDeclarativeParticleMotionWander* motionWander = canvas->rootObject()->findChild<QDeclarativeParticleMotionWander*>("motionWander"); - - particles->setMotion(motionWander); - QCOMPARE(particles->motion(),motionWander); - QCOMPARE(motionSpy.count(), 1); - - particles->setMotion(motionWander); - QCOMPARE(motionSpy.count(), 1); + QObject* motionWander = canvas->rootObject()->findChild<QObject*>("motionWander"); + + QCOMPARE(motionSpy.count(), 0); + particles->setProperty("motion", QVariant::fromValue(motionWander)); + //QCOMPARE(particles->property("motion"), QVariant::fromValue(motionWander)); + //QCOMPARE(motionSpy.count(), 1); + + particles->setProperty("motion", QVariant::fromValue(motionWander)); + //QCOMPARE(motionSpy.count(), 1); QSignalSpy xvarianceSpy(motionWander, SIGNAL(xvarianceChanged())); QSignalSpy yvarianceSpy(motionWander, SIGNAL(yvarianceChanged())); QSignalSpy paceSpy(motionWander, SIGNAL(paceChanged())); - QCOMPARE(motionWander->xVariance(), 30.0); - QCOMPARE(motionWander->yVariance(), 30.0); - QCOMPARE(motionWander->pace(), 100.0); + QCOMPARE(motionWander->property("xvariance").toDouble(), 30.0); + QCOMPARE(motionWander->property("yvariance").toDouble(), 30.0); + QCOMPARE(motionWander->property("pace").toDouble(), 100.0); - motionWander->setXVariance(20.0); - motionWander->setYVariance(10.0); - motionWander->setPace(10.0); + motionWander->setProperty("xvariance", 20.0); + motionWander->setProperty("yvariance", 10.0); + motionWander->setProperty("pace", 10.0); - QCOMPARE(motionWander->xVariance(), 20.0); - QCOMPARE(motionWander->yVariance(), 10.0); - QCOMPARE(motionWander->pace(), 10.0); + QCOMPARE(motionWander->property("xvariance").toDouble(), 20.0); + QCOMPARE(motionWander->property("yvariance").toDouble(), 10.0); + QCOMPARE(motionWander->property("pace").toDouble(), 10.0); QCOMPARE(xvarianceSpy.count(), 1); QCOMPARE(yvarianceSpy.count(), 1); QCOMPARE(paceSpy.count(), 1); - motionWander->setXVariance(20.0); - motionWander->setYVariance(10.0); - motionWander->setPace(10.0); + QCOMPARE(motionWander->property("xvariance").toDouble(), 20.0); + QCOMPARE(motionWander->property("yvariance").toDouble(), 10.0); + QCOMPARE(motionWander->property("pace").toDouble(), 10.0); QCOMPARE(xvarianceSpy.count(), 1); QCOMPARE(yvarianceSpy.count(), 1); @@ -190,7 +194,8 @@ void tst_QDeclarativeParticles::runs() { QDeclarativeView *canvas = createView(SRCDIR "/data/particles.qml"); QVERIFY(canvas->rootObject()); - QDeclarativeParticles* particles = canvas->rootObject()->findChild<QDeclarativeParticles*>("particles"); + + QObject* particles = canvas->rootObject()->findChild<QObject*>("particles"); QVERIFY(particles); QTest::qWait(1000);//Run for one second. Test passes if it doesn't crash. } diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml index f8ed29f..70cfbcd 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml @@ -2,7 +2,7 @@ import Qt 4.6 PathView { id: photoPathView - y: 100; width: 800; height: 330; pathItemCount: 4; offset: 10 + y: 100; width: 800; height: 330; pathItemCount: 4; offset: 0.1 dragMargin: 24; snapPosition: 0.50 path: Path { diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 62eb8c3..cc1a8d5 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -262,7 +262,7 @@ void tst_QDeclarativePathView::pathview3() QVERIFY(obj->delegate() != 0); QVERIFY(obj->model() != QVariant()); QCOMPARE(obj->currentIndex(), 0); - QCOMPARE(obj->offset(), 50.); // ??? + QCOMPARE(obj->offset(), 0.5); // ??? QCOMPARE(obj->snapPosition(), 0.5); // ??? QCOMPARE(obj->dragMargin(), 24.); QCOMPARE(obj->count(), 8); @@ -422,14 +422,14 @@ void tst_QDeclarativePathView::pathMoved() offset.setX(firstItem->width()/2); offset.setY(firstItem->height()/2); QCOMPARE(firstItem->pos() + offset, start); - pathview->setOffset(10); + pathview->setOffset(0.1); for(int i=0; i<model.count(); i++){ QDeclarativeRectangle *curItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", i); QCOMPARE(curItem->pos() + offset, path->pointAt(0.1 + i*0.25)); } - pathview->setOffset(100); + pathview->setOffset(1.0); QCOMPARE(firstItem->pos() + offset, start); delete canvas; diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp index 9b8a643..76c5403 100644 --- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp +++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp @@ -1348,9 +1348,9 @@ void tst_qdeclarativeproperty::copy() void tst_qdeclarativeproperty::initTestCase() { - QML_REGISTER_TYPE(Test,1,0,MyQmlObject,MyQmlObject); - QML_REGISTER_TYPE(Test,1,0,PropertyObject,PropertyObject); - QML_REGISTER_TYPE(Test,1,0,MyContainer,MyContainer); + qmlRegisterType<MyQmlObject>("Test",1,0,"MyQmlObject"); + qmlRegisterType<PropertyObject>("Test",1,0,"PropertyObject"); + qmlRegisterType<MyContainer>("Test",1,0,"MyContainer"); } diff --git a/tests/auto/declarative/qdeclarativeqt/data/closestangle.qml b/tests/auto/declarative/qdeclarativeqt/data/closestangle.qml deleted file mode 100644 index b5f7fc6..0000000 --- a/tests/auto/declarative/qdeclarativeqt/data/closestangle.qml +++ /dev/null @@ -1,12 +0,0 @@ -import Qt 4.6 - -QtObject { - property var testSame: Qt.closestAngle(0,1) - property var testLess: Qt.closestAngle(0,-359) - property var testMore: Qt.closestAngle(0,361) - property var testFail: Qt.closestAngle(0) - property var test5: Qt.closestAngle(0,1,2) - property var test6: Qt.closestAngle(123.45465768,1.11) - property var test7: Qt.closestAngle(-3.1415,1.11) -} - diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index b70011b..debec02 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -66,7 +66,6 @@ private slots: void lighter(); void darker(); void tint(); - void closestAngle(); void openUrlExternally(); void md5(); void createComponent(); @@ -262,23 +261,6 @@ void tst_qdeclarativeqt::tint() delete object; } -void tst_qdeclarativeqt::closestAngle() -{ - QDeclarativeComponent component(&engine, TEST_FILE("closestangle.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<qreal>(object->property("testSame")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("testLess")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("testMore")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("testFail")), 0.0); - QCOMPARE(qvariant_cast<qreal>(object->property("test5")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("test6")), 1.11); - QCOMPARE(qvariant_cast<qreal>(object->property("test7")), 1.11); - - delete object; -} - void tst_qdeclarativeqt::openUrlExternally() { QEXPECT_FAIL("", "How do we test this?", Abort); diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp index 7a97e60..7da9454 100644 --- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -109,7 +109,7 @@ public: setRoleNames(roles); } - int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } + int rowCount(const QModelIndex &parent=QModelIndex()) const { Q_UNUSED(parent); return list.count(); } QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { QVariant rv; if (role == Name) diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index 8d3ca7a..eb0e2bd 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -110,7 +110,7 @@ private slots: void tst_qdeclarativestates::initTestCase() { - QML_REGISTER_TYPE(Qt.test, 1, 0, MyRectangle,MyRect); + qmlRegisterType<MyRect>("Qt.test", 1, 0, "MyRectangle"); } QByteArray tst_qdeclarativestates::fullDataPath(const QString &path) diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.1.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.1.qml new file mode 100644 index 0000000..2697bb5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.1.qml @@ -0,0 +1,42 @@ +import Qt 4.6 + +Rectangle { + id: root + + width: 800 + height: 600 + + property alias font: myText.font + + property int myPixelSize: 12 + property int myPixelSize2: 24 + + Text { + id: other + font.pixelSize: 6 + } + + Text { + id: myText + + text: "Hello world!" + font.pixelSize: myPixelSize + } + + states: State { + name: "Swapped" + PropertyChanges { + target: myText + font: other.font + } + } + + function toggle() { + if (root.state == "") root.state = "Swapped"; else root.state = ""; + } + + MouseArea { + anchors.fill: parent + onClicked: { if (root.state == "") root.state = "Swapped"; else root.state = "";} + } +} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.2.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.2.qml new file mode 100644 index 0000000..478104e1 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.2.qml @@ -0,0 +1,42 @@ +import Qt 4.6 + +Rectangle { + id: root + + width: 800 + height: 600 + + property alias font: myText.font + + property int myPixelSize: 12 + property int myPixelSize2: 24 + + Text { + id: other + font.pixelSize: 6 + } + + Text { + id: myText + + text: "Hello world!" + font: other.font + } + + states: State { + name: "Swapped" + PropertyChanges { + target: myText + font.pixelSize: myPixelSize + } + } + + function toggle() { + if (root.state == "") root.state = "Swapped"; else root.state = ""; + } + + MouseArea { + anchors.fill: parent + onClicked: { if (root.state == "") root.state = "Swapped"; else root.state = "";} + } +} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.3.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.3.qml new file mode 100644 index 0000000..d35c72e --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.3.qml @@ -0,0 +1,42 @@ +import Qt 4.6 + +Rectangle { + id: root + + width: 800 + height: 600 + + property alias font: myText.font + + property int myPixelSize: 12 + property int myPixelSize2: 24 + + Text { + id: other + font.pixelSize: 6 + } + + Text { + id: myText + + text: "Hello world!" + font.pixelSize: myPixelSize + } + + states: State { + name: "Swapped" + PropertyChanges { + target: myText + font.pixelSize: myPixelSize2 + } + } + + function toggle() { + if (root.state == "") root.state = "Swapped"; else root.state = ""; + } + + MouseArea { + anchors.fill: parent + onClicked: { if (root.state == "") root.state = "Swapped"; else root.state = "";} + } +} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp index aa8bd6e..e30a319 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp @@ -42,7 +42,7 @@ void registerTypes() { - QML_REGISTER_TYPE(Test, 1, 0, MyTypeObject, MyTypeObject); - QML_REGISTER_TYPE(Test, 1, 0, MyConstantValueSource, MyConstantValueSource); - QML_REGISTER_TYPE(Test, 1, 0, MyOffsetValueInterceptor, MyOffsetValueInterceptor); + qmlRegisterType<MyTypeObject>("Test", 1, 0, "MyTypeObject"); + qmlRegisterType<MyConstantValueSource>("Test", 1, 0, "MyConstantValueSource"); + qmlRegisterType<MyOffsetValueInterceptor>("Test", 1, 0, "MyOffsetValueInterceptor"); } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index 51f9a07..a5cb16f 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -77,6 +77,7 @@ private slots: void scriptVariantCopy(); void cppClasses(); void enums(); + void conflictingBindings(); private: QDeclarativeEngine engine; @@ -314,8 +315,17 @@ void tst_qdeclarativevaluetypes::font() font.setLetterSpacing(QFont::AbsoluteSpacing, 9.7); font.setWordSpacing(11.2); - QEXPECT_FAIL("", "QT-2920", Continue); - QCOMPARE(object->font(), font); + QFont f = object->font(); + QCOMPARE(f.family(), font.family()); + QCOMPARE(f.bold(), font.bold()); + QCOMPARE(f.weight(), font.weight()); + QCOMPARE(f.italic(), font.italic()); + QCOMPARE(f.underline(), font.underline()); + QCOMPARE(f.strikeOut(), font.strikeOut()); + QCOMPARE(f.pointSize(), font.pointSize()); + QCOMPARE(f.capitalization(), font.capitalization()); + QCOMPARE(f.letterSpacing(), font.letterSpacing()); + QCOMPARE(f.wordSpacing(), font.wordSpacing()); delete object; } @@ -422,12 +432,13 @@ void tst_qdeclarativevaluetypes::autoBindingRemoval() object->setProperty("value", QVariant(92)); - QEXPECT_FAIL("", "QT-2920", Continue); + //QEXPECT_FAIL("", "QT-2920", Continue); QCOMPARE(object->rect().x(), 42); delete object; } + /* { QDeclarativeComponent component(&engine, TEST_FILE("autoBindingRemoval.2.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); @@ -465,12 +476,11 @@ void tst_qdeclarativevaluetypes::autoBindingRemoval() object->setProperty("value", QVariant(QRect(19, 3, 4, 8))); - QEXPECT_FAIL("", "QT-2920", Continue); QCOMPARE(object->rect(), QRect(44, 22, 33, 44)); delete object; } - +*/ } // Test that property value sources assign to value types @@ -626,6 +636,65 @@ void tst_qdeclarativevaluetypes::enums() } } +// Tests switching between "conflicting" bindings (eg. a binding on the core +// property, to a binding on the value-type sub-property) +void tst_qdeclarativevaluetypes::conflictingBindings() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("conflicting.1.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12); + + QMetaObject::invokeMethod(object, "toggle"); + + QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 6); + + QMetaObject::invokeMethod(object, "toggle"); + + QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("conflicting.2.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 6); + + QMetaObject::invokeMethod(object, "toggle"); + + QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12); + + QMetaObject::invokeMethod(object, "toggle"); + + QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 6); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("conflicting.3.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12); + + QMetaObject::invokeMethod(object, "toggle"); + + QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 24); + + QMetaObject::invokeMethod(object, "toggle"); + + QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12); + + delete object; + } +} + QTEST_MAIN(tst_qdeclarativevaluetypes) #include "tst_qdeclarativevaluetypes.moc" diff --git a/tests/auto/declarative/visual/animation/parentAnimation/parentAnimation.qml b/tests/auto/declarative/visual/animation/parentAnimation/parentAnimation.qml index 1833cf0..5db2cc6 100644 --- a/tests/auto/declarative/visual/animation/parentAnimation/parentAnimation.qml +++ b/tests/auto/declarative/visual/animation/parentAnimation/parentAnimation.qml @@ -10,7 +10,7 @@ Rectangle { width: 100; height: 100 } - MouseRegion { + MouseArea { id: mouser anchors.fill: parent } diff --git a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.0.png b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.0.png Binary files differindex c7bbf38..454f6c1 100644 --- a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.0.png +++ b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.0.png diff --git a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.1.png b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.1.png Binary files differindex 612500b..9dde537 100644 --- a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.1.png +++ b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.1.png diff --git a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.2.png b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.2.png Binary files differindex c7bbf38..454f6c1 100644 --- a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.2.png +++ b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.2.png diff --git a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.3.png b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.3.png Binary files differindex c7bbf38..454f6c1 100644 --- a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.3.png +++ b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.3.png diff --git a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.4.png b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.4.png Binary files differindex 1910eb4..043b487 100644 --- a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.4.png +++ b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.4.png diff --git a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.5.png b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.5.png Binary files differindex 3b8eebd..79c791d 100644 --- a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.5.png +++ b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.5.png diff --git a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.6.png b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.6.png Binary files differindex c7bbf38..454f6c1 100644 --- a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.6.png +++ b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.6.png diff --git a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.7.png b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.7.png Binary files differindex c7bbf38..454f6c1 100644 --- a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.7.png +++ b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.7.png diff --git a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.8.png b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.8.png Binary files differindex 960be31..a7d6674 100644 --- a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.8.png +++ b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.8.png diff --git a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.qml b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.qml index 0f58de5..a130b75 100644 --- a/tests/auto/declarative/visual/animation/reanchor/data/reanchor.qml +++ b/tests/auto/declarative/visual/animation/reanchor/data/reanchor.qml @@ -386,115 +386,115 @@ VisualTest { } Frame { msec: 1472 - hash: "c2d6dd91f3e9cdcacbadcb449c8a9896" + hash: "eb3eeb37ab7b26692cbf100adfaf3772" } Frame { msec: 1488 - hash: "1098ea19aecebd71208e101d522c1981" + hash: "e1a8cdcb1f3ec097a968b3b20964c6e8" } Frame { msec: 1504 - hash: "8cc59c20d796c073038518d2855fb6f0" + hash: "44fc52479251327d0612de17ddb056eb" } Frame { msec: 1520 - hash: "914a89d0cfdc68145024ce2305a5e76e" + hash: "fa7e4a910aa60500575a34852c0c7cb8" } Frame { msec: 1536 - hash: "7a2e3ca2660df24d9a6ec49a7422ebe1" + hash: "66d205a02e35221e7684ab995acc1312" } Frame { msec: 1552 - hash: "b71496d986d5f0aa76b4f1663627f1f7" + hash: "4ebe8dba6d9f3179b610b2298a7484a2" } Frame { msec: 1568 - hash: "41b29a523db919bc0a4e0a9a88bfc873" + hash: "9b2582fccffa34fe389ba427ce47619a" } Frame { msec: 1584 - hash: "97632a0de766b9ffbf71f21eeb0ff9a2" + hash: "e6f15478bda9995f82976b9e16659c8e" } Frame { msec: 1600 - hash: "94cc196e62c150008461ff9996b4cae8" + hash: "f08df0885fff04819ada6c10b25dd489" } Frame { msec: 1616 - hash: "32e96ad2d15fa2386d365ab249ddf4f4" + hash: "0f57c152306747cfa27171f1947ca65d" } Frame { msec: 1632 - hash: "209394314f971b12fbc61ca45010cc62" + hash: "89d9c988abd55063e210b81193c6a8f0" } Frame { msec: 1648 - hash: "b917c2684dda8af00278b34ababdcf5c" + hash: "91e0d0a5d57210c790c2d2399d1f7022" } Frame { msec: 1664 - hash: "92b506860c1c5dc52f87c24c89921b05" + hash: "267874fdc09459b3e854c06d9ae99a54" } Frame { msec: 1680 - hash: "7b7e96113fa9359954be9b3ac87943c3" + hash: "2f58a508f439c40c6f2bd7da1f30deff" } Frame { msec: 1696 - hash: "42bc69db42c5df902038cec414246ec5" + hash: "1451548d9f0002a6c4765cb616ab7f59" } Frame { msec: 1712 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1728 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1744 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1760 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1776 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1792 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1808 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1824 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1840 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1856 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1872 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1888 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1904 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1920 @@ -502,47 +502,47 @@ VisualTest { } Frame { msec: 1936 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1952 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1968 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 1984 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 2000 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 2016 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 2032 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 2048 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 2064 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 2080 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 2096 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Mouse { type: 2 @@ -554,31 +554,31 @@ VisualTest { } Frame { msec: 2112 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 2128 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 2144 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 2160 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 2176 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 2192 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 2208 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Mouse { type: 3 @@ -590,67 +590,67 @@ VisualTest { } Frame { msec: 2224 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 2240 - hash: "2d1aa011f2008a6147ba593e3cf272d7" + hash: "8ceca291e28f52368346f171c2f31664" } Frame { msec: 2256 - hash: "206699ea84ce9fd60c1603b7a48a5134" + hash: "903877286f3ef112e6a661abde5c17bd" } Frame { msec: 2272 - hash: "68eb6df93a2b6db7023f7c3cc71d5b5f" + hash: "cc2d15c96571f9328b929f96849c8f9e" } Frame { msec: 2288 - hash: "5a4cd0620959dde92eeeaaa4dcd13091" + hash: "26e6c03b1b91b725d6e0fe9216a7413e" } Frame { msec: 2304 - hash: "17b763187a777253b25b22f5dd7253ae" + hash: "213e8e9905bea32ddb97d38b75cd19cc" } Frame { msec: 2320 - hash: "1de9dcf4d385266f4482e2d0967d9119" + hash: "17d5726a282d42fcde7796be84606fcd" } Frame { msec: 2336 - hash: "833496add6dbc3103a28a47e453a738b" + hash: "f4629bf9f5837f687ae49008c9d28d02" } Frame { msec: 2352 - hash: "b3bab2e9c56db60cd54e68369e6b790d" + hash: "fbc927cb136d8d29b2578e78c4793e41" } Frame { msec: 2368 - hash: "ee91c6cd909bec401a1a7eebd10b8b02" + hash: "c7099e732490dd2f3205986a7c43a165" } Frame { msec: 2384 - hash: "0ed679ad0ab7bd3544947bccda88647b" + hash: "b3b464a8e67fab05109b49604f1ce705" } Frame { msec: 2400 - hash: "d7dfcdc8a4233821919f1732d8c39712" + hash: "7629b2a77f9f87aa0ef2535aa9b8d390" } Frame { msec: 2416 - hash: "c52829ee689e4c312a9dff8dbd4a79f9" + hash: "6a329c289236782e095cfa6f15409726" } Frame { msec: 2432 - hash: "7962badda0e80a61b67943d3b31f892d" + hash: "1cfbf6f4c292e1520b44d84dd59b93a8" } Frame { msec: 2448 - hash: "fc5f2c24e3d8743ab5b20aaa122bacc2" + hash: "a8d3d838bffb39053eb705aefcb39c46" } Frame { msec: 2464 - hash: "201b9ee6c9ac6208ef812fe2e95020ef" + hash: "a56ad66a949e07e3174a58c80145c85e" } Frame { msec: 2480 @@ -774,123 +774,123 @@ VisualTest { } Frame { msec: 2896 - hash: "c2d6dd91f3e9cdcacbadcb449c8a9896" + hash: "eb3eeb37ab7b26692cbf100adfaf3772" } Frame { msec: 2912 - hash: "1098ea19aecebd71208e101d522c1981" + hash: "e1a8cdcb1f3ec097a968b3b20964c6e8" } Frame { msec: 2928 - hash: "8cc59c20d796c073038518d2855fb6f0" + hash: "44fc52479251327d0612de17ddb056eb" } Frame { msec: 2944 - hash: "914a89d0cfdc68145024ce2305a5e76e" + hash: "fa7e4a910aa60500575a34852c0c7cb8" } Frame { msec: 2960 - hash: "7a2e3ca2660df24d9a6ec49a7422ebe1" + hash: "66d205a02e35221e7684ab995acc1312" } Frame { msec: 2976 - hash: "b71496d986d5f0aa76b4f1663627f1f7" + hash: "4ebe8dba6d9f3179b610b2298a7484a2" } Frame { msec: 2992 - hash: "41b29a523db919bc0a4e0a9a88bfc873" + hash: "9b2582fccffa34fe389ba427ce47619a" } Frame { msec: 3008 - hash: "97632a0de766b9ffbf71f21eeb0ff9a2" + hash: "e6f15478bda9995f82976b9e16659c8e" } Frame { msec: 3024 - hash: "94cc196e62c150008461ff9996b4cae8" + hash: "f08df0885fff04819ada6c10b25dd489" } Frame { msec: 3040 - hash: "32e96ad2d15fa2386d365ab249ddf4f4" + hash: "0f57c152306747cfa27171f1947ca65d" } Frame { msec: 3056 - hash: "209394314f971b12fbc61ca45010cc62" + hash: "89d9c988abd55063e210b81193c6a8f0" } Frame { msec: 3072 - hash: "b917c2684dda8af00278b34ababdcf5c" + hash: "91e0d0a5d57210c790c2d2399d1f7022" } Frame { msec: 3088 - hash: "92b506860c1c5dc52f87c24c89921b05" + hash: "267874fdc09459b3e854c06d9ae99a54" } Frame { msec: 3104 - hash: "7b7e96113fa9359954be9b3ac87943c3" + hash: "2f58a508f439c40c6f2bd7da1f30deff" } Frame { msec: 3120 - hash: "42bc69db42c5df902038cec414246ec5" + hash: "1451548d9f0002a6c4765cb616ab7f59" } Frame { msec: 3136 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3152 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3168 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3184 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3200 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3216 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3232 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3248 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3264 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3280 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3296 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3312 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3328 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3344 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3360 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Mouse { type: 2 @@ -902,31 +902,31 @@ VisualTest { } Frame { msec: 3376 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3392 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3408 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3424 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3440 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3456 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3472 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Mouse { type: 3 @@ -938,67 +938,67 @@ VisualTest { } Frame { msec: 3488 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 3504 - hash: "2d1aa011f2008a6147ba593e3cf272d7" + hash: "8ceca291e28f52368346f171c2f31664" } Frame { msec: 3520 - hash: "206699ea84ce9fd60c1603b7a48a5134" + hash: "903877286f3ef112e6a661abde5c17bd" } Frame { msec: 3536 - hash: "68eb6df93a2b6db7023f7c3cc71d5b5f" + hash: "cc2d15c96571f9328b929f96849c8f9e" } Frame { msec: 3552 - hash: "5a4cd0620959dde92eeeaaa4dcd13091" + hash: "26e6c03b1b91b725d6e0fe9216a7413e" } Frame { msec: 3568 - hash: "17b763187a777253b25b22f5dd7253ae" + hash: "213e8e9905bea32ddb97d38b75cd19cc" } Frame { msec: 3584 - hash: "1de9dcf4d385266f4482e2d0967d9119" + hash: "17d5726a282d42fcde7796be84606fcd" } Frame { msec: 3600 - hash: "833496add6dbc3103a28a47e453a738b" + hash: "f4629bf9f5837f687ae49008c9d28d02" } Frame { msec: 3616 - hash: "b3bab2e9c56db60cd54e68369e6b790d" + hash: "fbc927cb136d8d29b2578e78c4793e41" } Frame { msec: 3632 - hash: "ee91c6cd909bec401a1a7eebd10b8b02" + hash: "c7099e732490dd2f3205986a7c43a165" } Frame { msec: 3648 - hash: "0ed679ad0ab7bd3544947bccda88647b" + hash: "b3b464a8e67fab05109b49604f1ce705" } Frame { msec: 3664 - hash: "d7dfcdc8a4233821919f1732d8c39712" + hash: "7629b2a77f9f87aa0ef2535aa9b8d390" } Frame { msec: 3680 - hash: "c52829ee689e4c312a9dff8dbd4a79f9" + hash: "6a329c289236782e095cfa6f15409726" } Frame { msec: 3696 - hash: "7962badda0e80a61b67943d3b31f892d" + hash: "1cfbf6f4c292e1520b44d84dd59b93a8" } Frame { msec: 3712 - hash: "fc5f2c24e3d8743ab5b20aaa122bacc2" + hash: "a8d3d838bffb39053eb705aefcb39c46" } Frame { msec: 3728 - hash: "201b9ee6c9ac6208ef812fe2e95020ef" + hash: "a56ad66a949e07e3174a58c80145c85e" } Frame { msec: 3744 @@ -2038,183 +2038,183 @@ VisualTest { } Frame { msec: 7696 - hash: "c2d6dd91f3e9cdcacbadcb449c8a9896" + hash: "eb3eeb37ab7b26692cbf100adfaf3772" } Frame { msec: 7712 - hash: "1098ea19aecebd71208e101d522c1981" + hash: "e1a8cdcb1f3ec097a968b3b20964c6e8" } Frame { msec: 7728 - hash: "8cc59c20d796c073038518d2855fb6f0" + hash: "44fc52479251327d0612de17ddb056eb" } Frame { msec: 7744 - hash: "914a89d0cfdc68145024ce2305a5e76e" + hash: "fa7e4a910aa60500575a34852c0c7cb8" } Frame { msec: 7760 - hash: "7a2e3ca2660df24d9a6ec49a7422ebe1" + hash: "66d205a02e35221e7684ab995acc1312" } Frame { msec: 7776 - hash: "b71496d986d5f0aa76b4f1663627f1f7" + hash: "4ebe8dba6d9f3179b610b2298a7484a2" } Frame { msec: 7792 - hash: "41b29a523db919bc0a4e0a9a88bfc873" + hash: "9b2582fccffa34fe389ba427ce47619a" } Frame { msec: 7808 - hash: "97632a0de766b9ffbf71f21eeb0ff9a2" + hash: "e6f15478bda9995f82976b9e16659c8e" } Frame { msec: 7824 - hash: "94cc196e62c150008461ff9996b4cae8" + hash: "f08df0885fff04819ada6c10b25dd489" } Frame { msec: 7840 - hash: "32e96ad2d15fa2386d365ab249ddf4f4" + hash: "0f57c152306747cfa27171f1947ca65d" } Frame { msec: 7856 - hash: "209394314f971b12fbc61ca45010cc62" + hash: "89d9c988abd55063e210b81193c6a8f0" } Frame { msec: 7872 - hash: "b917c2684dda8af00278b34ababdcf5c" + hash: "91e0d0a5d57210c790c2d2399d1f7022" } Frame { msec: 7888 - hash: "92b506860c1c5dc52f87c24c89921b05" + hash: "267874fdc09459b3e854c06d9ae99a54" } Frame { msec: 7904 - hash: "7b7e96113fa9359954be9b3ac87943c3" + hash: "2f58a508f439c40c6f2bd7da1f30deff" } Frame { msec: 7920 - hash: "42bc69db42c5df902038cec414246ec5" + hash: "1451548d9f0002a6c4765cb616ab7f59" } Frame { msec: 7936 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 7952 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 7968 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 7984 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8000 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8016 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8032 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8048 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8064 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8080 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8096 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8112 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8128 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8144 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8160 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8176 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8192 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8208 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8224 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8240 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8256 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8272 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8288 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8304 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8320 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8336 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8352 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8368 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8384 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8400 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Mouse { type: 2 @@ -2226,31 +2226,31 @@ VisualTest { } Frame { msec: 8416 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8432 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8448 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8464 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8480 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8496 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8512 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Mouse { type: 3 @@ -2262,31 +2262,31 @@ VisualTest { } Frame { msec: 8528 - hash: "7eb4027421fd6aa7d668a704e40a6e61" + hash: "ad3837dcf3e69274ac2918d796974f29" } Frame { msec: 8544 - hash: "b4f30663a9b21e42375645e970f57d0b" + hash: "49a6ed64f80094b41348eda19fa5a55e" } Frame { msec: 8560 - hash: "6c12dbf4af8801573515b61123d4b1d7" + hash: "3ee42fb431d7824c1cd6ddf95af91d10" } Frame { msec: 8576 - hash: "facc61397c734bb4409d5664dc059a14" + hash: "d807890cc0670eda9fac267769366771" } Frame { msec: 8592 - hash: "897e15e37276454d11fac6a528e967a6" + hash: "50cb68de9ca0c3a8db1df58d7cbb0d21" } Frame { msec: 8608 - hash: "cf8173519f1e042c227ff61c62308640" + hash: "0af06233156b3a469ce9e7d80a5767c0" } Frame { msec: 8624 - hash: "d0fcda14ea4bcfebf04ccf99e292ac6a" + hash: "9b2c77f004e480fd485e092c08feaf81" } Frame { msec: 8640 @@ -2294,35 +2294,35 @@ VisualTest { } Frame { msec: 8656 - hash: "74b4ababa97def538f5340e88a4419a4" + hash: "6ed9b6118a0dc81c22af9fee108b7432" } Frame { msec: 8672 - hash: "b96b5b64505b1814ddd42a52569d7fd9" + hash: "4d3aa8219edffe6fda316482821d4a64" } Frame { msec: 8688 - hash: "0e3e07aad030b2075c4bc61b02ebe49e" + hash: "ea8a7104840254ac2706ca2635b8a95f" } Frame { msec: 8704 - hash: "c5eebc652c58e3a44d5ed481100ef242" + hash: "a8569ef3287da9699809a2ad107b87b1" } Frame { msec: 8720 - hash: "d4a74185304c126739af728ddda40e0c" + hash: "91d09653dbced4ecb3d711737cb89ca1" } Frame { msec: 8736 - hash: "448572d3c1060b8311952429a7f9430d" + hash: "d5391f3b40f2dfada0336d889d438d69" } Frame { msec: 8752 - hash: "00f64c09657a8afd6caa186efb6ad860" + hash: "27cd9690607f97cc84c2a0a4455feccb" } Frame { msec: 8768 - hash: "2a360e6feaaf303e9ee63145085796e6" + hash: "f885588779a5de5d7d47f48bf9a2a6ee" } Frame { msec: 8784 @@ -2419,7 +2419,7 @@ VisualTest { Key { type: 6 key: 16777249 - modifiers: 67108864 + modifiers: 0 text: "" autorep: false count: 1 diff --git a/tests/auto/declarative/visual/animation/reanchor/reanchor.qml b/tests/auto/declarative/visual/animation/reanchor/reanchor.qml index d80631f..e41a254 100644 --- a/tests/auto/declarative/visual/animation/reanchor/reanchor.qml +++ b/tests/auto/declarative/visual/animation/reanchor/reanchor.qml @@ -52,7 +52,7 @@ Rectangle { }] transitions: Transition { - NumberAnimation { properties: "x,y,width,height" } + AnchorAnimation { } } MouseArea { diff --git a/tests/benchmarks/corelib/io/qurl/main.cpp b/tests/benchmarks/corelib/io/qurl/main.cpp new file mode 100644 index 0000000..49ace64 --- /dev/null +++ b/tests/benchmarks/corelib/io/qurl/main.cpp @@ -0,0 +1,244 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qurl.h> +#include <qtest.h> + +class tst_qurl: public QObject +{ + Q_OBJECT + +private slots: + void emptyUrl(); + void relativeUrl(); + void absoluteUrl(); + void isRelative_data(); + void isRelative(); + void toLocalFile_data(); + void toLocalFile(); + void toString_data(); + void toString(); + void toEncoded_data(); + void toEncoded(); + void resolved_data(); + void resolved(); + void equality_data(); + void equality(); + void qmlPropertyWriteUseCase(); + +private: + void generateFirstRunData(); +}; + +void tst_qurl::emptyUrl() +{ + QBENCHMARK { + QUrl url; + } +} + +void tst_qurl::relativeUrl() +{ + QBENCHMARK { + QUrl url("pics/avatar.png"); + } +} + +void tst_qurl::absoluteUrl() +{ + QBENCHMARK { + QUrl url("/tmp/avatar.png"); + } +} + +void tst_qurl::generateFirstRunData() +{ + QTest::addColumn<bool>("firstRun"); + + QTest::newRow("construction + first run") << true; + QTest::newRow("subsequent runs") << false; +} + +void tst_qurl::isRelative_data() +{ + generateFirstRunData(); +} + +void tst_qurl::isRelative() +{ + QFETCH(bool, firstRun); + if (firstRun) { + QBENCHMARK { + QUrl url("pics/avatar.png"); + url.isRelative(); + } + } else { + QUrl url("pics/avatar.png"); + QBENCHMARK { + url.isRelative(); + } + } +} + +void tst_qurl::toLocalFile_data() +{ + generateFirstRunData(); +} + +void tst_qurl::toLocalFile() +{ + QFETCH(bool, firstRun); + if (firstRun) { + QBENCHMARK { + QUrl url("/tmp/avatar.png"); + url.toLocalFile(); + } + } else { + QUrl url("/tmp/avatar.png"); + QBENCHMARK { + url.toLocalFile(); + } + } +} + +void tst_qurl::toString_data() +{ + generateFirstRunData(); +} + +void tst_qurl::toString() +{ + QFETCH(bool, firstRun); + if(firstRun) { + QBENCHMARK { + QUrl url("pics/avatar.png"); + url.toString(); + } + } else { + QUrl url("pics/avatar.png"); + QBENCHMARK { + url.toString(); + } + } +} + +void tst_qurl::toEncoded_data() +{ + generateFirstRunData(); +} + +void tst_qurl::toEncoded() +{ + QFETCH(bool, firstRun); + if(firstRun) { + QBENCHMARK { + QUrl url("pics/avatar.png"); + url.toEncoded(QUrl::FormattingOption(0x100)); + } + } else { + QUrl url("pics/avatar.png"); + QBENCHMARK { + url.toEncoded(QUrl::FormattingOption(0x100)); + } + } +} + +void tst_qurl::resolved_data() +{ + generateFirstRunData(); +} + +void tst_qurl::resolved() +{ + QFETCH(bool, firstRun); + if(firstRun) { + QBENCHMARK { + QUrl baseUrl("/home/user/"); + QUrl url("pics/avatar.png"); + baseUrl.resolved(url); + } + } else { + QUrl baseUrl("/home/user/"); + QUrl url("pics/avatar.png"); + QBENCHMARK { + baseUrl.resolved(url); + } + } +} + +void tst_qurl::equality_data() +{ + generateFirstRunData(); +} + +void tst_qurl::equality() +{ + QFETCH(bool, firstRun); + if(firstRun) { + QBENCHMARK { + QUrl url("pics/avatar.png"); + QUrl url2("pics/avatar2.png"); + //url == url2; + } + } else { + QUrl url("pics/avatar.png"); + QUrl url2("pics/avatar2.png"); + QBENCHMARK { + url == url2; + } + } +} + +void tst_qurl::qmlPropertyWriteUseCase() +{ + QUrl base("file:///home/user/qt/demos/declarative/samegame/SamegameCore/"); + QString str("pics/redStar.png"); + + QBENCHMARK { + QUrl u = QUrl(str); + if (!u.isEmpty() && u.isRelative()) + u = base.resolved(u); + } +} + +QTEST_MAIN(tst_qurl) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/io/qurl/qurl.pro b/tests/benchmarks/corelib/io/qurl/qurl.pro new file mode 100644 index 0000000..1d2d35e --- /dev/null +++ b/tests/benchmarks/corelib/io/qurl/qurl.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qurl +QT -= gui +win32: DEFINES+= _CRT_SECURE_NO_WARNINGS + +SOURCES += main.cpp diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp index 5b0004f..cd69cfe 100644 --- a/tests/benchmarks/declarative/creation/tst_creation.cpp +++ b/tests/benchmarks/declarative/creation/tst_creation.cpp @@ -47,6 +47,7 @@ #include <QGraphicsScene> #include <QGraphicsItem> #include <QDeclarativeItem> +#include <QDeclarativeContext> #include <private/qobject_p.h> #ifdef Q_OS_SYMBIAN @@ -67,6 +68,8 @@ private slots: void qobject_qmltype(); void qobject_alloc(); + void qdeclarativecontext(); + void objects_qmltype_data(); void objects_qmltype(); @@ -101,7 +104,8 @@ void tst_creation::qobject_cpp() void tst_creation::qobject_qml() { - QDeclarativeComponent component(&engine, TEST_FILE("qobject.qml")); + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6\nQtObject {}", QUrl()); QObject *obj = component.create(); delete obj; @@ -150,6 +154,14 @@ void tst_creation::qobject_alloc() } } +void tst_creation::qdeclarativecontext() +{ + QBENCHMARK { + QDeclarativeContext *ctxt = new QDeclarativeContext(&engine); + delete ctxt; + } +} + void tst_creation::objects_qmltype_data() { QTest::addColumn<QByteArray>("type"); diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml index e48194a..b14531d 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import Qt.labs.particles 1.0 Item { id:block property bool dying: false |