diff options
author | Tasuku Suzuki <stasuku@gmail.com> | 2012-11-25 04:36:33 +0900 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-29 17:48:46 +0100 |
commit | e0cb13a510c0099784fee00d5b4b7c608dd42dd2 (patch) | |
tree | 8d61daaaa70df2fa7b26a0c989d748fc3718e15f /tests | |
parent | 55f6a109e99ea2eb3359fa941a1826d4b4e11bf8 (diff) |
Move no-Gui related QML types from QtQuick into QtQml
Task-number: QTBUG-26340
Change-Id: I9049128db2598bf3c7a9d677b774eaae53b54eb5
Reviewed-by: Alan Alpert <aalpert@rim.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'tests')
42 files changed, 162 insertions, 171 deletions
diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro index a9fa7648dd..bbef36167e 100644 --- a/tests/auto/qml/qml.pro +++ b/tests/auto/qml/qml.pro @@ -41,16 +41,17 @@ PRIVATETESTS += \ qqmlsqldatabase \ qqmlvaluetypes \ qqmlvaluetypeproviders \ - qquickbinding \ + qqmlbinding \ qquickchangeset \ - qquickconnection \ + qqmlconnections \ qquicklistcompositor \ qquicklistmodel \ qquicklistmodelworkerscript \ qquickworkerscript \ qqmlbundle \ qrcqml \ - v4 + v4 \ + qqmltimer !contains(QT_CONFIG, no-widgets) { PUBLICTESTS += \ diff --git a/tests/auto/qml/qquickbinding/data/deletedObject.qml b/tests/auto/qml/qqmlbinding/data/deletedObject.qml index f9cf869ba3..f9cf869ba3 100644 --- a/tests/auto/qml/qquickbinding/data/deletedObject.qml +++ b/tests/auto/qml/qqmlbinding/data/deletedObject.qml diff --git a/tests/auto/qml/qquickbinding/data/restoreBinding.qml b/tests/auto/qml/qqmlbinding/data/restoreBinding.qml index 9491c0f1d3..9491c0f1d3 100644 --- a/tests/auto/qml/qquickbinding/data/restoreBinding.qml +++ b/tests/auto/qml/qqmlbinding/data/restoreBinding.qml diff --git a/tests/auto/qml/qquickbinding/data/restoreBindingWithLoop.qml b/tests/auto/qml/qqmlbinding/data/restoreBindingWithLoop.qml index ee07104817..ee07104817 100644 --- a/tests/auto/qml/qquickbinding/data/restoreBindingWithLoop.qml +++ b/tests/auto/qml/qqmlbinding/data/restoreBindingWithLoop.qml diff --git a/tests/auto/qml/qquickbinding/data/restoreBindingWithoutCrash.qml b/tests/auto/qml/qqmlbinding/data/restoreBindingWithoutCrash.qml index 0c63a16213..0c63a16213 100644 --- a/tests/auto/qml/qquickbinding/data/restoreBindingWithoutCrash.qml +++ b/tests/auto/qml/qqmlbinding/data/restoreBindingWithoutCrash.qml diff --git a/tests/auto/qml/qquickbinding/data/test-binding.qml b/tests/auto/qml/qqmlbinding/data/test-binding.qml index 87aabe975a..87aabe975a 100644 --- a/tests/auto/qml/qquickbinding/data/test-binding.qml +++ b/tests/auto/qml/qqmlbinding/data/test-binding.qml diff --git a/tests/auto/qml/qquickbinding/data/test-binding2.qml b/tests/auto/qml/qqmlbinding/data/test-binding2.qml index 4a08141d11..4a08141d11 100644 --- a/tests/auto/qml/qquickbinding/data/test-binding2.qml +++ b/tests/auto/qml/qqmlbinding/data/test-binding2.qml diff --git a/tests/auto/qml/qquickbinding/qquickbinding.pro b/tests/auto/qml/qqmlbinding/qqmlbinding.pro index e209f8144b..35a5f1ca74 100644 --- a/tests/auto/qml/qquickbinding/qquickbinding.pro +++ b/tests/auto/qml/qqmlbinding/qqmlbinding.pro @@ -1,8 +1,8 @@ CONFIG += testcase -TARGET = tst_qquickbinding +TARGET = tst_qqmlbinding macx:CONFIG -= app_bundle -SOURCES += tst_qquickbinding.cpp +SOURCES += tst_qqmlbinding.cpp include (../../shared/util.pri) diff --git a/tests/auto/qml/qquickbinding/tst_qquickbinding.cpp b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp index 9d9b5ff79c..4c411fb5ec 100644 --- a/tests/auto/qml/qquickbinding/tst_qquickbinding.cpp +++ b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp @@ -41,15 +41,15 @@ #include <qtest.h> #include <QtQml/qqmlengine.h> #include <QtQml/qqmlcomponent.h> -#include <private/qquickbind_p.h> +#include <private/qqmlbind_p.h> #include <QtQuick/private/qquickrectangle_p.h> #include "../../shared/util.h" -class tst_qquickbinding : public QQmlDataTest +class tst_qqmlbinding : public QQmlDataTest { Q_OBJECT public: - tst_qquickbinding(); + tst_qqmlbinding(); private slots: void binding(); @@ -63,18 +63,18 @@ private: QQmlEngine engine; }; -tst_qquickbinding::tst_qquickbinding() +tst_qqmlbinding::tst_qqmlbinding() { } -void tst_qquickbinding::binding() +void tst_qqmlbinding::binding() { QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("test-binding.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); QVERIFY(rect != 0); - QQuickBind *binding3 = qobject_cast<QQuickBind*>(rect->findChild<QQuickBind*>("binding3")); + QQmlBind *binding3 = qobject_cast<QQmlBind*>(rect->findChild<QQmlBind*>("binding3")); QVERIFY(binding3 != 0); QCOMPARE(rect->color(), QColor("yellow")); @@ -86,7 +86,7 @@ void tst_qquickbinding::binding() QCOMPARE(binding3->when(), true); - QQuickBind *binding = qobject_cast<QQuickBind*>(rect->findChild<QQuickBind*>("binding1")); + QQmlBind *binding = qobject_cast<QQmlBind*>(rect->findChild<QQmlBind*>("binding1")); QVERIFY(binding != 0); QCOMPARE(binding->object(), qobject_cast<QObject*>(rect)); QCOMPARE(binding->property(), QLatin1String("text")); @@ -95,7 +95,7 @@ void tst_qquickbinding::binding() delete rect; } -void tst_qquickbinding::whenAfterValue() +void tst_qqmlbinding::whenAfterValue() { QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("test-binding2.qml")); @@ -111,7 +111,7 @@ void tst_qquickbinding::whenAfterValue() delete rect; } -void tst_qquickbinding::restoreBinding() +void tst_qqmlbinding::restoreBinding() { QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("restoreBinding.qml")); @@ -141,7 +141,7 @@ void tst_qquickbinding::restoreBinding() delete rect; } -void tst_qquickbinding::restoreBindingWithLoop() +void tst_qqmlbinding::restoreBindingWithLoop() { QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("restoreBindingWithLoop.qml")); @@ -177,7 +177,7 @@ void tst_qquickbinding::restoreBindingWithLoop() delete rect; } -void tst_qquickbinding::restoreBindingWithoutCrash() +void tst_qqmlbinding::restoreBindingWithoutCrash() { QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("restoreBindingWithoutCrash.qml")); @@ -217,7 +217,7 @@ void tst_qquickbinding::restoreBindingWithoutCrash() } //QTBUG-20692 -void tst_qquickbinding::deletedObject() +void tst_qqmlbinding::deletedObject() { QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("deletedObject.qml")); @@ -232,6 +232,6 @@ void tst_qquickbinding::deletedObject() delete rect; } -QTEST_MAIN(tst_qquickbinding) +QTEST_MAIN(tst_qqmlbinding) -#include "tst_qquickbinding.moc" +#include "tst_qqmlbinding.moc" diff --git a/tests/auto/qml/qquickconnection/data/connection-targetchange.qml b/tests/auto/qml/qqmlconnections/data/connection-targetchange.qml index 154c309c9c..154c309c9c 100644 --- a/tests/auto/qml/qquickconnection/data/connection-targetchange.qml +++ b/tests/auto/qml/qqmlconnections/data/connection-targetchange.qml diff --git a/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-ignored.qml b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-ignored.qml new file mode 100644 index 0000000000..0780dd1509 --- /dev/null +++ b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-ignored.qml @@ -0,0 +1,8 @@ +import QtQml 2.0 + +QtObject { + id: root + + property Connections c1: Connections { target: root; onNotFooBar1: {} ignoreUnknownSignals: true } + property Connections c2: Connections { objectName: "connections"; onNotFooBar2: {} ignoreUnknownSignals: true } +} diff --git a/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-notarget.qml b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-notarget.qml new file mode 100644 index 0000000000..3da3e0f5d1 --- /dev/null +++ b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-notarget.qml @@ -0,0 +1,5 @@ +import QtQml 2.0 + +QtObject { + property Connections c1: Connections { objectName: "connections"; target: null; onNotFooBar: {} } +} diff --git a/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-parent.qml b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-parent.qml new file mode 100644 index 0000000000..2c55215579 --- /dev/null +++ b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals-parent.qml @@ -0,0 +1,5 @@ +import QtQml 2.0 + +QtObject { + property Connections c1: Connections { objectName: "connections"; onFooBar: {} } +} diff --git a/tests/auto/qml/qqmlconnections/data/connection-unknownsignals.qml b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals.qml new file mode 100644 index 0000000000..a351016b4a --- /dev/null +++ b/tests/auto/qml/qqmlconnections/data/connection-unknownsignals.qml @@ -0,0 +1,7 @@ +import QtQml 2.0 + +QtObject { + id: screen + + property Connections c1: Connections { objectName: "connections"; target: screen; onFooBar: {} } +} diff --git a/tests/auto/qml/qqmlconnections/data/error-object.qml b/tests/auto/qml/qqmlconnections/data/error-object.qml new file mode 100644 index 0000000000..8594811aa1 --- /dev/null +++ b/tests/auto/qml/qqmlconnections/data/error-object.qml @@ -0,0 +1,5 @@ +import QtQml 2.0 + +Connections { + onClicked: Timer {} +} diff --git a/tests/auto/qml/qqmlconnections/data/error-property.qml b/tests/auto/qml/qqmlconnections/data/error-property.qml new file mode 100644 index 0000000000..b08a4a504a --- /dev/null +++ b/tests/auto/qml/qqmlconnections/data/error-property.qml @@ -0,0 +1,3 @@ +import QtQml 2.0 + +Connections { fakeProperty: {} } diff --git a/tests/auto/qml/qqmlconnections/data/error-property2.qml b/tests/auto/qml/qqmlconnections/data/error-property2.qml new file mode 100644 index 0000000000..fcfbf5b412 --- /dev/null +++ b/tests/auto/qml/qqmlconnections/data/error-property2.qml @@ -0,0 +1,3 @@ +import QtQml 2.0 + +Connections { onfakeProperty: {} } diff --git a/tests/auto/qml/qqmlconnections/data/error-syntax.qml b/tests/auto/qml/qqmlconnections/data/error-syntax.qml new file mode 100644 index 0000000000..62c841bdb1 --- /dev/null +++ b/tests/auto/qml/qqmlconnections/data/error-syntax.qml @@ -0,0 +1,7 @@ +import QtQml 2.0 + +Connections { + onClicked { + onPressed: {} + } +} diff --git a/tests/auto/qml/qquickconnection/data/rewriteError-global.qml b/tests/auto/qml/qqmlconnections/data/rewriteError-global.qml index bd18b9df9a..1d0b557069 100644 --- a/tests/auto/qml/qquickconnection/data/rewriteError-global.qml +++ b/tests/auto/qml/qqmlconnections/data/rewriteError-global.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQml 2.0 import Test 1.0 TestObject { diff --git a/tests/auto/qml/qquickconnection/data/rewriteError-unnamed.qml b/tests/auto/qml/qqmlconnections/data/rewriteError-unnamed.qml index a4849e994b..a4849e994b 100644 --- a/tests/auto/qml/qquickconnection/data/rewriteError-unnamed.qml +++ b/tests/auto/qml/qqmlconnections/data/rewriteError-unnamed.qml diff --git a/tests/auto/qml/qquickconnection/data/singletontype-target.qml b/tests/auto/qml/qqmlconnections/data/singletontype-target.qml index df6f8a0301..7de488c2dd 100644 --- a/tests/auto/qml/qquickconnection/data/singletontype-target.qml +++ b/tests/auto/qml/qqmlconnections/data/singletontype-target.qml @@ -1,7 +1,7 @@ -import QtQuick 2.0 +import QtQml 2.0 import MyTestSingletonType 1.0 as MyTestSingletonType -Item { +QtObject { id: rootObject objectName: "rootObject" property int newIntPropValue: 12 @@ -14,7 +14,7 @@ Item { newIntPropValue = newIntPropValue + 1; } - Connections { + property Connections c: Connections { target: MyTestSingletonType.Api onIntPropChanged: moduleIntPropChangedCount = moduleIntPropChangedCount + 1; onOtherSignal: moduleOtherSignalCount = moduleOtherSignalCount + 1; diff --git a/tests/auto/qml/qquickconnection/data/test-connection.qml b/tests/auto/qml/qqmlconnections/data/test-connection.qml index ce851fc3db..ce851fc3db 100644 --- a/tests/auto/qml/qquickconnection/data/test-connection.qml +++ b/tests/auto/qml/qqmlconnections/data/test-connection.qml diff --git a/tests/auto/qml/qquickconnection/data/test-connection2.qml b/tests/auto/qml/qqmlconnections/data/test-connection2.qml index b23d2fc145..a7e264c332 100644 --- a/tests/auto/qml/qquickconnection/data/test-connection2.qml +++ b/tests/auto/qml/qqmlconnections/data/test-connection2.qml @@ -1,3 +1,3 @@ -import QtQuick 2.0 +import QtQml 2.0 Connections { id: connection; target: connection; onTargetChanged: 1 == 1 } diff --git a/tests/auto/qml/qqmlconnections/data/test-connection3.qml b/tests/auto/qml/qqmlconnections/data/test-connection3.qml new file mode 100644 index 0000000000..9aaca2213a --- /dev/null +++ b/tests/auto/qml/qqmlconnections/data/test-connection3.qml @@ -0,0 +1,3 @@ +import QtQml 2.0 + +Connections {} diff --git a/tests/auto/qml/qqmlconnections/data/trimming.qml b/tests/auto/qml/qqmlconnections/data/trimming.qml new file mode 100644 index 0000000000..4c37eb22af --- /dev/null +++ b/tests/auto/qml/qqmlconnections/data/trimming.qml @@ -0,0 +1,10 @@ +import QtQml 2.0 + +QtObject { + id: root + + property string tested + signal testMe(int param1, string param2) + + property Connections c: Connections { target: root; onTestMe: root.tested = param2 + param1 } +} diff --git a/tests/auto/qml/qquickconnection/qquickconnection.pro b/tests/auto/qml/qqmlconnections/qqmlconnections.pro index b00bc070e7..52f85f6219 100644 --- a/tests/auto/qml/qquickconnection/qquickconnection.pro +++ b/tests/auto/qml/qqmlconnections/qqmlconnections.pro @@ -1,8 +1,8 @@ CONFIG += testcase -TARGET = tst_qquickconnection +TARGET = tst_qqmlconnections macx:CONFIG -= app_bundle -SOURCES += tst_qquickconnection.cpp +SOURCES += tst_qqmlconnections.cpp include (../../shared/util.pri) diff --git a/tests/auto/qml/qquickconnection/tst_qquickconnection.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp index d54e5a9db4..b9e31d2216 100644 --- a/tests/auto/qml/qquickconnection/tst_qquickconnection.cpp +++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp @@ -41,16 +41,16 @@ #include <qtest.h> #include <QtQml/qqmlengine.h> #include <QtQml/qqmlcomponent.h> -#include <private/qquickconnections_p.h> +#include <private/qqmlconnections_p.h> #include <private/qquickitem_p.h> #include "../../shared/util.h" #include <QtQml/qqmlscriptstring.h> -class tst_qquickconnection : public QQmlDataTest +class tst_qqmlconnections : public QQmlDataTest { Q_OBJECT public: - tst_qquickconnection(); + tst_qqmlconnections(); private slots: void defaultValues(); @@ -69,15 +69,15 @@ private: QQmlEngine engine; }; -tst_qquickconnection::tst_qquickconnection() +tst_qqmlconnections::tst_qqmlconnections() { } -void tst_qquickconnection::defaultValues() +void tst_qqmlconnections::defaultValues() { QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("test-connection3.qml")); - QQuickConnections *item = qobject_cast<QQuickConnections*>(c.create()); + QQmlConnections *item = qobject_cast<QQmlConnections*>(c.create()); QVERIFY(item != 0); QVERIFY(item->target() == 0); @@ -85,11 +85,11 @@ void tst_qquickconnection::defaultValues() delete item; } -void tst_qquickconnection::properties() +void tst_qqmlconnections::properties() { QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("test-connection2.qml")); - QQuickConnections *item = qobject_cast<QQuickConnections*>(c.create()); + QQmlConnections *item = qobject_cast<QQmlConnections*>(c.create()); QVERIFY(item != 0); @@ -99,7 +99,7 @@ void tst_qquickconnection::properties() delete item; } -void tst_qquickconnection::connection() +void tst_qqmlconnections::connection() { QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("test-connection.qml")); @@ -116,35 +116,35 @@ void tst_qquickconnection::connection() delete item; } -void tst_qquickconnection::trimming() +void tst_qqmlconnections::trimming() { QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("trimming.qml")); - QQuickItem *item = qobject_cast<QQuickItem*>(c.create()); + QObject *object = c.create(); - QVERIFY(item != 0); + QVERIFY(object != 0); - QCOMPARE(item->property("tested").toString(), QString("")); - int index = item->metaObject()->indexOfSignal("testMe(int,QString)"); - QMetaMethod method = item->metaObject()->method(index); - method.invoke(item, + QCOMPARE(object->property("tested").toString(), QString("")); + int index = object->metaObject()->indexOfSignal("testMe(int,QString)"); + QMetaMethod method = object->metaObject()->method(index); + method.invoke(object, Qt::DirectConnection, Q_ARG(int, 5), Q_ARG(QString, "worked")); - QCOMPARE(item->property("tested").toString(), QString("worked5")); + QCOMPARE(object->property("tested").toString(), QString("worked5")); - delete item; + delete object; } // Confirm that target can be changed by one of our signal handlers -void tst_qquickconnection::targetChanged() +void tst_qqmlconnections::targetChanged() { QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("connection-targetchange.qml")); QQuickItem *item = qobject_cast<QQuickItem*>(c.create()); QVERIFY(item != 0); - QQuickConnections *connections = item->findChild<QQuickConnections*>("connections"); + QQmlConnections *connections = item->findChild<QQmlConnections*>("connections"); QVERIFY(connections); QQuickItem *item1 = item->findChild<QQuickItem*>("item1"); @@ -161,18 +161,18 @@ void tst_qquickconnection::targetChanged() delete item; } -void tst_qquickconnection::unknownSignals_data() +void tst_qqmlconnections::unknownSignals_data() { QTest::addColumn<QString>("file"); QTest::addColumn<QString>("error"); - QTest::newRow("basic") << "connection-unknownsignals.qml" << ":6:5: QML Connections: Cannot assign to non-existent property \"onFooBar\""; - QTest::newRow("parent") << "connection-unknownsignals-parent.qml" << ":6:5: QML Connections: Cannot assign to non-existent property \"onFooBar\""; + QTest::newRow("basic") << "connection-unknownsignals.qml" << ":6:30: QML Connections: Cannot assign to non-existent property \"onFooBar\""; + QTest::newRow("parent") << "connection-unknownsignals-parent.qml" << ":4:30: QML Connections: Cannot assign to non-existent property \"onFooBar\""; QTest::newRow("ignored") << "connection-unknownsignals-ignored.qml" << ""; // should be NO error QTest::newRow("notarget") << "connection-unknownsignals-notarget.qml" << ""; // should be NO error } -void tst_qquickconnection::unknownSignals() +void tst_qqmlconnections::unknownSignals() { QFETCH(QString, file); QFETCH(QString, error); @@ -186,20 +186,20 @@ void tst_qquickconnection::unknownSignals() QQmlEngine engine; QQmlComponent c(&engine, url); - QQuickItem *item = qobject_cast<QQuickItem*>(c.create()); - QVERIFY(item != 0); + QObject *object = c.create(); + QVERIFY(object != 0); // check that connection is created (they are all runtime errors) - QQuickConnections *connections = item->findChild<QQuickConnections*>("connections"); + QQmlConnections *connections = object->findChild<QQmlConnections*>("connections"); QVERIFY(connections); if (file == "connection-unknownsignals-ignored.qml") QVERIFY(connections->ignoreUnknownSignals()); - delete item; + delete object; } -void tst_qquickconnection::errors_data() +void tst_qqmlconnections::errors_data() { QTest::addColumn<QString>("file"); QTest::addColumn<QString>("error"); @@ -210,7 +210,7 @@ void tst_qquickconnection::errors_data() QTest::newRow("grouped object") << "error-syntax.qml" << "Connections: syntax error"; } -void tst_qquickconnection::errors() +void tst_qqmlconnections::errors() { QFETCH(QString, file); QFETCH(QString, error); @@ -245,7 +245,7 @@ private: bool m_ran; }; -void tst_qquickconnection::rewriteErrors() +void tst_qqmlconnections::rewriteErrors() { qmlRegisterType<TestObject>("Test", 1, 0, "TestObject"); { @@ -312,7 +312,7 @@ static QObject *module_api_factory(QQmlEngine *engine, QJSEngine *scriptEngine) } // QTBUG-20937 -void tst_qquickconnection::singletonTypeTarget() +void tst_qqmlconnections::singletonTypeTarget() { qmlRegisterSingletonType<MyTestSingletonType>("MyTestSingletonType", 1, 0, "Api", module_api_factory); QQmlComponent component(&engine, testFileUrl("singletontype-target.qml")); @@ -338,6 +338,6 @@ void tst_qquickconnection::singletonTypeTarget() delete object; } -QTEST_MAIN(tst_qquickconnection) +QTEST_MAIN(tst_qqmlconnections) -#include "tst_qquickconnection.moc" +#include "tst_qqmlconnections.moc" diff --git a/tests/auto/qml/qqmlengine/data/qtqmlModule.5.qml b/tests/auto/qml/qqmlengine/data/qtqmlModule.5.qml index 7a4fe5ed24..26018b5782 100644 --- a/tests/auto/qml/qqmlengine/data/qtqmlModule.5.qml +++ b/tests/auto/qml/qqmlengine/data/qtqmlModule.5.qml @@ -2,4 +2,7 @@ import QtQml 2.0 QtObject { property Component c + property Timer timer + property Connections connections: Connections {} + property Binding binding } diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index 937a8b1c56..128294bbcb 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -593,7 +593,7 @@ void tst_qqmlengine::qtqmlModule_data() << QString(testFileUrl("qtqmlModule.4.qml").toString() + QLatin1String(":1 module \"QtQml\" version 2.5 is not installed\n")) << QStringList(); - QTest::newRow("QtQml 2.0 module provides Component and QtObject") + QTest::newRow("QtQml 2.0 module provides Component, QtObject, Connections, Binding and Timer") << testFileUrl("qtqmlModule.5.qml") << QString() << QStringList(); diff --git a/tests/auto/quick/qquicktimer/qquicktimer.pro b/tests/auto/qml/qqmltimer/qqmltimer.pro index 60f862a508..28f8e6959f 100644 --- a/tests/auto/quick/qquicktimer/qquicktimer.pro +++ b/tests/auto/qml/qqmltimer/qqmltimer.pro @@ -1,8 +1,8 @@ CONFIG += testcase -TARGET = tst_qquicktimer +TARGET = tst_qqmltimer macx:CONFIG -= app_bundle -SOURCES += tst_qquicktimer.cpp +SOURCES += tst_qqmltimer.cpp CONFIG += parallel_test QT += core-private gui-private qml-private quick-private gui testlib diff --git a/tests/auto/quick/qquicktimer/tst_qquicktimer.cpp b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp index 8d5da84821..87010c28ee 100644 --- a/tests/auto/quick/qquicktimer/tst_qquicktimer.cpp +++ b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp @@ -42,15 +42,15 @@ #include <qtest.h> #include <QtQml/qqmlengine.h> #include <QtQml/qqmlcomponent.h> -#include <QtQuick/private/qquicktimer_p.h> +#include <QtQml/private/qqmltimer_p.h> #include <QtQuick/qquickitem.h> #include <QDebug> -class tst_qquicktimer : public QObject +class tst_qqmltimer : public QObject { Q_OBJECT public: - tst_qquicktimer(); + tst_qqmltimer(); private slots: void notRepeating(); @@ -84,16 +84,16 @@ public slots: #define TIMEOUT_TIMEOUT 200 -tst_qquicktimer::tst_qquicktimer() +tst_qqmltimer::tst_qqmltimer() { } -void tst_qquicktimer::notRepeating() +void tst_qqmltimer::notRepeating() { QQmlEngine engine; QQmlComponent component(&engine); component.setData(QByteArray("import QtQuick 2.0\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile("")); - QQuickTimer *timer = qobject_cast<QQuickTimer*>(component.create()); + QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); QVERIFY(timer != 0); QVERIFY(timer->isRunning()); QVERIFY(!timer->isRepeating()); @@ -109,12 +109,12 @@ void tst_qquicktimer::notRepeating() QVERIFY(timer->isRunning() == false); } -void tst_qquicktimer::notRepeatingStart() +void tst_qqmltimer::notRepeatingStart() { QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QByteArray("import QtQuick 2.0\nTimer { interval: 100 }"), QUrl::fromLocalFile("")); - QQuickTimer *timer = qobject_cast<QQuickTimer*>(component.create()); + component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100 }"), QUrl::fromLocalFile("")); + QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); QVERIFY(timer != 0); QVERIFY(!timer->isRunning()); @@ -134,12 +134,12 @@ void tst_qquicktimer::notRepeatingStart() delete timer; } -void tst_qquicktimer::repeat() +void tst_qqmltimer::repeat() { QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QByteArray("import QtQuick 2.0\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile("")); - QQuickTimer *timer = qobject_cast<QQuickTimer*>(component.create()); + component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile("")); + QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); QVERIFY(timer != 0); TimerHelper helper; @@ -176,12 +176,12 @@ void tst_qquicktimer::repeat() delete timer; } -void tst_qquicktimer::triggeredOnStart() +void tst_qqmltimer::triggeredOnStart() { QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QByteArray("import QtQuick 2.0\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile("")); - QQuickTimer *timer = qobject_cast<QQuickTimer*>(component.create()); + component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile("")); + QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); QVERIFY(timer != 0); QVERIFY(timer->triggeredOnStart()); @@ -211,12 +211,12 @@ void tst_qquicktimer::triggeredOnStart() delete timer; } -void tst_qquicktimer::triggeredOnStartRepeat() +void tst_qqmltimer::triggeredOnStartRepeat() { QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QByteArray("import QtQuick 2.0\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile("")); - QQuickTimer *timer = qobject_cast<QQuickTimer*>(component.create()); + component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile("")); + QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); QVERIFY(timer != 0); TimerHelper helper; @@ -234,15 +234,15 @@ void tst_qquicktimer::triggeredOnStartRepeat() delete timer; } -void tst_qquicktimer::noTriggerIfNotRunning() +void tst_qqmltimer::noTriggerIfNotRunning() { QQmlEngine engine; QQmlComponent component(&engine); component.setData(QByteArray( - "import QtQuick 2.0\n" - "Item { property bool ok: true\n" - "Timer { id: t1; interval: 100; repeat: true; running: true; onTriggered: if (!running) ok=false }" - "Timer { interval: 10; running: true; onTriggered: t1.running=false }" + "import QtQml 2.0\n" + "QtObject { property bool ok: true\n" + "property Timer timer1: Timer { id: t1; interval: 100; repeat: true; running: true; onTriggered: if (!running) ok=false }" + "property Timer timer2: Timer { interval: 10; running: true; onTriggered: t1.running=false }" "}" ), QUrl::fromLocalFile("")); QObject *item = component.create(); @@ -253,12 +253,12 @@ void tst_qquicktimer::noTriggerIfNotRunning() delete item; } -void tst_qquicktimer::changeDuration() +void tst_qqmltimer::changeDuration() { QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QByteArray("import QtQuick 2.0\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile("")); - QQuickTimer *timer = qobject_cast<QQuickTimer*>(component.create()); + component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile("")); + QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); QVERIFY(timer != 0); TimerHelper helper; @@ -289,12 +289,12 @@ void tst_qquicktimer::changeDuration() delete timer; } -void tst_qquicktimer::restart() +void tst_qqmltimer::restart() { QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QByteArray("import QtQuick 2.0\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); - QQuickTimer *timer = qobject_cast<QQuickTimer*>(component.create()); + component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); + QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); QVERIFY(timer != 0); TimerHelper helper; @@ -316,18 +316,18 @@ void tst_qquicktimer::restart() delete timer; } -void tst_qquicktimer::restartFromTriggered() +void tst_qqmltimer::restartFromTriggered() { QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QByteArray("import QtQuick 2.0\nTimer { " + component.setData(QByteArray("import QtQml 2.0\nTimer { " "interval: 500; " "repeat: false; " "running: true; " "onTriggered: restart()" " }"), QUrl::fromLocalFile("")); QScopedPointer<QObject> object(component.create()); - QQuickTimer *timer = qobject_cast<QQuickTimer*>(object.data()); + QQmlTimer *timer = qobject_cast<QQmlTimer*>(object.data()); QVERIFY(timer != 0); TimerHelper helper; @@ -343,11 +343,11 @@ void tst_qquicktimer::restartFromTriggered() QVERIFY(timer->isRunning()); } -void tst_qquicktimer::runningFromTriggered() +void tst_qqmltimer::runningFromTriggered() { QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QByteArray("import QtQuick 2.0\nTimer { " + component.setData(QByteArray("import QtQml 2.0\nTimer { " "property bool ok: false; " "interval: 500; " "repeat: false; " @@ -355,7 +355,7 @@ void tst_qquicktimer::runningFromTriggered() "onTriggered: { ok = !running; running = true }" " }"), QUrl::fromLocalFile("")); QScopedPointer<QObject> object(component.create()); - QQuickTimer *timer = qobject_cast<QQuickTimer*>(object.data()); + QQmlTimer *timer = qobject_cast<QQmlTimer*>(object.data()); QVERIFY(timer != 0); TimerHelper helper; @@ -373,14 +373,14 @@ void tst_qquicktimer::runningFromTriggered() QVERIFY(timer->isRunning()); } -void tst_qquicktimer::parentProperty() +void tst_qqmltimer::parentProperty() { QQmlEngine engine; QQmlComponent component(&engine); component.setData(QByteArray("import QtQuick 2.0\nItem { Timer { objectName: \"timer\"; running: parent.visible } }"), QUrl::fromLocalFile("")); QQuickItem *item = qobject_cast<QQuickItem*>(component.create()); QVERIFY(item != 0); - QQuickTimer *timer = item->findChild<QQuickTimer*>("timer"); + QQmlTimer *timer = item->findChild<QQmlTimer*>("timer"); QVERIFY(timer != 0); QVERIFY(timer->isRunning()); @@ -388,6 +388,6 @@ void tst_qquicktimer::parentProperty() delete timer; } -QTEST_MAIN(tst_qquicktimer) +QTEST_MAIN(tst_qqmltimer) -#include "tst_qquicktimer.moc" +#include "tst_qqmltimer.moc" diff --git a/tests/auto/qml/qquickconnection/data/connection-unknownsignals-ignored.qml b/tests/auto/qml/qquickconnection/data/connection-unknownsignals-ignored.qml deleted file mode 100644 index 05d06bda94..0000000000 --- a/tests/auto/qml/qquickconnection/data/connection-unknownsignals-ignored.qml +++ /dev/null @@ -1,8 +0,0 @@ -import QtQuick 2.0 - -Item { - id: screen - - Connections { target: screen; onNotFooBar1: {} ignoreUnknownSignals: true } - Connections { objectName: "connections"; onNotFooBar2: {} ignoreUnknownSignals: true } -} diff --git a/tests/auto/qml/qquickconnection/data/connection-unknownsignals-notarget.qml b/tests/auto/qml/qquickconnection/data/connection-unknownsignals-notarget.qml deleted file mode 100644 index 9d25cba649..0000000000 --- a/tests/auto/qml/qquickconnection/data/connection-unknownsignals-notarget.qml +++ /dev/null @@ -1,7 +0,0 @@ -import QtQuick 2.0 - -Item { - id: screen - - Connections { objectName: "connections"; target: null; onNotFooBar: {} } -} diff --git a/tests/auto/qml/qquickconnection/data/connection-unknownsignals-parent.qml b/tests/auto/qml/qquickconnection/data/connection-unknownsignals-parent.qml deleted file mode 100644 index bcd281256f..0000000000 --- a/tests/auto/qml/qquickconnection/data/connection-unknownsignals-parent.qml +++ /dev/null @@ -1,7 +0,0 @@ -import QtQuick 2.0 - -Item { - id: screen - - Connections { objectName: "connections"; onFooBar: {} } -} diff --git a/tests/auto/qml/qquickconnection/data/connection-unknownsignals.qml b/tests/auto/qml/qquickconnection/data/connection-unknownsignals.qml deleted file mode 100644 index ad8d4d91a8..0000000000 --- a/tests/auto/qml/qquickconnection/data/connection-unknownsignals.qml +++ /dev/null @@ -1,7 +0,0 @@ -import QtQuick 2.0 - -Item { - id: screen - - Connections { objectName: "connections"; target: screen; onFooBar: {} } -} diff --git a/tests/auto/qml/qquickconnection/data/error-object.qml b/tests/auto/qml/qquickconnection/data/error-object.qml deleted file mode 100644 index 256b2626a7..0000000000 --- a/tests/auto/qml/qquickconnection/data/error-object.qml +++ /dev/null @@ -1,7 +0,0 @@ -import QtQuick 2.0 - -Item { - Connections { - onClicked: Item {} - } -} diff --git a/tests/auto/qml/qquickconnection/data/error-property.qml b/tests/auto/qml/qquickconnection/data/error-property.qml deleted file mode 100644 index a602479783..0000000000 --- a/tests/auto/qml/qquickconnection/data/error-property.qml +++ /dev/null @@ -1,5 +0,0 @@ -import QtQuick 2.0 - -Item { - Connections { fakeProperty: {} } -} diff --git a/tests/auto/qml/qquickconnection/data/error-property2.qml b/tests/auto/qml/qquickconnection/data/error-property2.qml deleted file mode 100644 index 8123afe707..0000000000 --- a/tests/auto/qml/qquickconnection/data/error-property2.qml +++ /dev/null @@ -1,5 +0,0 @@ -import QtQuick 2.0 - -Item { - Connections { onfakeProperty: {} } -} diff --git a/tests/auto/qml/qquickconnection/data/error-syntax.qml b/tests/auto/qml/qquickconnection/data/error-syntax.qml deleted file mode 100644 index 16c0534b68..0000000000 --- a/tests/auto/qml/qquickconnection/data/error-syntax.qml +++ /dev/null @@ -1,9 +0,0 @@ -import QtQuick 2.0 - -Item { - Connections { - onClicked { - onPressed: {} - } - } -} diff --git a/tests/auto/qml/qquickconnection/data/test-connection3.qml b/tests/auto/qml/qquickconnection/data/test-connection3.qml deleted file mode 100644 index 9e88f0ff8f..0000000000 --- a/tests/auto/qml/qquickconnection/data/test-connection3.qml +++ /dev/null @@ -1,3 +0,0 @@ -import QtQuick 2.0 - -Connections {} diff --git a/tests/auto/qml/qquickconnection/data/trimming.qml b/tests/auto/qml/qquickconnection/data/trimming.qml deleted file mode 100644 index 6692050deb..0000000000 --- a/tests/auto/qml/qquickconnection/data/trimming.qml +++ /dev/null @@ -1,10 +0,0 @@ -import QtQuick 2.0 - -Item { - id: screen; width: 50 - - property string tested - signal testMe(int param1, string param2) - - Connections { target: screen; onTestMe: screen.tested = param2 + param1 } -} diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro index abc5e7a4af..5f18fc94bf 100644 --- a/tests/auto/quick/quick.pro +++ b/tests/auto/quick/quick.pro @@ -25,7 +25,6 @@ PRIVATETESTS += \ qquickstyledtext \ qquickstates \ qquicksystempalette \ - qquicktimer \ qquickxmllistmodel # This test requires the xmlpatterns module |