diff options
Diffstat (limited to 'tests/auto')
19 files changed, 104 insertions, 43 deletions
diff --git a/tests/auto/declarative/layouts/data/layouts.qml b/tests/auto/declarative/layouts/data/layouts.qml index 00d785d..1792500 100644 --- a/tests/auto/declarative/layouts/data/layouts.qml +++ b/tests/auto/declarative/layouts/data/layouts.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import Qt.widgets 4.6 Item { id: resizable diff --git a/tests/auto/declarative/qmlecmascript/testtypes.cpp b/tests/auto/declarative/qmlecmascript/testtypes.cpp index 3c6b256..6a04704 100644 --- a/tests/auto/declarative/qmlecmascript/testtypes.cpp +++ b/tests/auto/declarative/qmlecmascript/testtypes.cpp @@ -72,11 +72,14 @@ private: int m_value; }; -QML_DEFINE_TYPE(Qt.test, 1,0, MyQmlObject,MyQmlObject); -QML_DEFINE_TYPE(Qt.test, 1,0, MyDeferredObject,MyDeferredObject); -QML_DEFINE_TYPE(Qt.test, 1,0, MyQmlContainer,MyQmlContainer); -QML_DEFINE_EXTENDED_TYPE(Qt.test, 1,0, MyBaseExtendedObject,MyBaseExtendedObject,BaseExtensionObject); -QML_DEFINE_EXTENDED_TYPE(Qt.test, 1,0, MyExtendedObject,MyExtendedObject,ExtensionObject); -QML_DEFINE_TYPE(Qt.test, 1,0, MyTypeObject, MyTypeObject); +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); +} #include "testtypes.moc" diff --git a/tests/auto/declarative/qmlecmascript/testtypes.h b/tests/auto/declarative/qmlecmascript/testtypes.h index f511c29..9d7d0a7 100644 --- a/tests/auto/declarative/qmlecmascript/testtypes.h +++ b/tests/auto/declarative/qmlecmascript/testtypes.h @@ -592,5 +592,7 @@ private: QVariantList m_actuals; }; +void registerTypes(); + #endif // TESTTYPES_H diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index b30ad1c..88f06ad 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -76,6 +76,7 @@ public: tst_qmlecmascript() {} private slots: + void initTestCase(); void assignBasicTypes(); void idShortcutInvalidates(); void boolPropertiesEvaluateAsBool(); @@ -129,6 +130,8 @@ private: QmlEngine engine; }; +void tst_qmlecmascript::initTestCase() { registerTypes(); } + void tst_qmlecmascript::assignBasicTypes() { { diff --git a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp index 5089dc5..27db5fe 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp +++ b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp @@ -239,7 +239,7 @@ void tst_QmlGraphicsPositioners::test_vertical_animated() void tst_QmlGraphicsPositioners::test_grid() { - QmlView *canvas = createView("data/grid.qml"); + QmlView *canvas = createView(SRCDIR "/data/grid.qml"); QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); @@ -266,7 +266,7 @@ void tst_QmlGraphicsPositioners::test_grid() void tst_QmlGraphicsPositioners::test_grid_spacing() { - QmlView *canvas = createView("data/grid-spacing.qml"); + QmlView *canvas = createView(SRCDIR "/data/grid-spacing.qml"); QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); @@ -421,7 +421,7 @@ void tst_QmlGraphicsPositioners::test_propertychanges() void tst_QmlGraphicsPositioners::test_repeater() { - QmlView *canvas = createView("data/repeater.qml"); + QmlView *canvas = createView(SRCDIR "/data/repeater.qml"); QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); diff --git a/tests/auto/declarative/qmlgraphicswebview/testtypes.cpp b/tests/auto/declarative/qmlgraphicswebview/testtypes.cpp index 00c1b67..676d19a 100644 --- a/tests/auto/declarative/qmlgraphicswebview/testtypes.cpp +++ b/tests/auto/declarative/qmlgraphicswebview/testtypes.cpp @@ -46,4 +46,7 @@ void MyWebView::drawContents(QPainter *p, const QRect &r) QmlGraphicsWebView::drawContents(p,r); } -QML_DEFINE_TYPE(Test,1,0,MyWebView,MyWebView); +void registerTypes() +{ + QML_REGISTER_TYPE(Test,1,0,MyWebView,MyWebView); +} diff --git a/tests/auto/declarative/qmlgraphicswebview/testtypes.h b/tests/auto/declarative/qmlgraphicswebview/testtypes.h index 0b3176d..fa9a301 100644 --- a/tests/auto/declarative/qmlgraphicswebview/testtypes.h +++ b/tests/auto/declarative/qmlgraphicswebview/testtypes.h @@ -61,4 +61,6 @@ private: QML_DECLARE_TYPE(MyWebView); +void registerTypes(); + #endif // TESTTYPES_H diff --git a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp index 5815e22..f4f8a33 100644 --- a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp +++ b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp @@ -60,6 +60,7 @@ public: tst_qmlgraphicswebview() {} private slots: + void initTestCase(); void basicProperties(); void settings(); void historyNav(); @@ -86,6 +87,11 @@ private: } }; +void tst_qmlgraphicswebview::initTestCase() +{ + registerTypes(); +} + static QString strippedHtml(QString html) { html.replace(QRegExp("\\s+"),""); diff --git a/tests/auto/declarative/qmllanguage/testtypes.cpp b/tests/auto/declarative/qmllanguage/testtypes.cpp index a295054..9ffe28a 100644 --- a/tests/auto/declarative/qmllanguage/testtypes.cpp +++ b/tests/auto/declarative/qmllanguage/testtypes.cpp @@ -40,15 +40,18 @@ ****************************************************************************/ #include "testtypes.h" -QML_DEFINE_INTERFACE(MyInterface); -QML_DEFINE_TYPE(Test,1,0,MyQmlObject,MyQmlObject); -QML_DEFINE_TYPE(Test,1,0,MyTypeObject,MyTypeObject); -QML_DEFINE_TYPE(Test,1,0,MyContainer,MyContainer); -QML_DEFINE_TYPE(Test,1,0,MyPropertyValueSource,MyPropertyValueSource); -QML_DEFINE_TYPE(Test,1,0,MyDotPropertyObject,MyDotPropertyObject); -QML_DEFINE_TYPE(Test,1,0,MyNamespacedType,MyNamespace::MyNamespacedType); -QML_DEFINE_TYPE(Test,1,0,MySecondNamespacedType,MyNamespace::MySecondNamespacedType); -QML_DEFINE_NOCREATE_TYPE(MyGroupedObject); +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); +} QVariant myCustomVariantTypeConverter(const QString &data) { diff --git a/tests/auto/declarative/qmllanguage/testtypes.h b/tests/auto/declarative/qmllanguage/testtypes.h index 27b45e4..9fd0973 100644 --- a/tests/auto/declarative/qmllanguage/testtypes.h +++ b/tests/auto/declarative/qmllanguage/testtypes.h @@ -542,4 +542,6 @@ namespace MyNamespace { QML_DECLARE_TYPE(MyNamespace::MyNamespacedType); QML_DECLARE_TYPE(MyNamespace::MySecondNamespacedType); +void registerTypes(); + #endif // TESTTYPES_H diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp index 4d27e32..ecdd33a 100644 --- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp +++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp @@ -182,6 +182,15 @@ inline QUrl TEST_FILE(const char *filename) void tst_qmllanguage::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) + // Create locale-specific file // For POSIX, this will just be data/I18nType.qml, since POSIX is 7-bit // For iso8859-1 locale, this will just be data/I18nType?????.qml where ????? is 5 8-bit characters @@ -1058,13 +1067,6 @@ void tst_qmllanguage::testType(const QString& qml, const QString& type) QML_DECLARE_TYPE(TestType) QML_DECLARE_TYPE(TestType2) -QML_DEFINE_TYPE(com.nokia.Test, 0, 0, TestTP, TestType) -QML_DEFINE_TYPE(com.nokia.Test, 1, 0, Test, TestType) -QML_DEFINE_TYPE(com.nokia.Test, 1, 5, Test, TestType) -QML_DEFINE_TYPE(com.nokia.Test, 1, 8, Test, TestType2) -QML_DEFINE_TYPE(com.nokia.Test, 1, 9, OldTest, TestType) -QML_DEFINE_TYPE(com.nokia.Test, 1, 12, Test, TestType2) - // Import tests (QT-558) void tst_qmllanguage::importsBuiltin_data() diff --git a/tests/auto/declarative/qmllistreference/tst_qmllistreference.cpp b/tests/auto/declarative/qmllistreference/tst_qmllistreference.cpp index 6122f1e..db9f218 100644 --- a/tests/auto/declarative/qmllistreference/tst_qmllistreference.cpp +++ b/tests/auto/declarative/qmllistreference/tst_qmllistreference.cpp @@ -67,6 +67,7 @@ public: tst_qmllistreference() {} private slots: + void initTestCase(); void qmllistreference(); void qmllistreference_invalid(); void isValid(); @@ -101,7 +102,11 @@ public: QmlListProperty<TestType> property; }; QML_DECLARE_TYPE(TestType); -QML_DEFINE_NOCREATE_TYPE(TestType); + +void tst_qmllistreference::initTestCase() +{ + QML_REGISTER_NOCREATE_TYPE(TestType); +} void tst_qmllistreference::qmllistreference() { diff --git a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp index 540d658..7bb3e96 100644 --- a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp +++ b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp @@ -54,7 +54,6 @@ public: }; QML_DECLARE_TYPE(MyQmlObject); -QML_DEFINE_TYPE(Test,1,0,MyQmlObject,MyQmlObject); class MyAttached : public QObject { @@ -88,7 +87,6 @@ private: }; QML_DECLARE_TYPE(MyContainer); -QML_DEFINE_TYPE(Test,1,0,MyContainer,MyContainer); QML_DECLARE_TYPEINFO(MyContainer, QML_HAS_ATTACHED_PROPERTIES) class tst_qmlmetaproperty : public QObject @@ -98,6 +96,7 @@ public: tst_qmlmetaproperty() {} private slots: + void initTestCase(); // Constructors void qmlmetaproperty(); @@ -126,6 +125,13 @@ private: QmlEngine engine; }; +void tst_qmlmetaproperty::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); +} + void tst_qmlmetaproperty::qmlmetaproperty() { QmlMetaProperty prop; @@ -209,7 +215,6 @@ private: }; QML_DECLARE_TYPE(PropertyObject); -QML_DEFINE_TYPE(Test,1,0,PropertyObject,PropertyObject); void tst_qmlmetaproperty::qmlmetaproperty_object() { diff --git a/tests/auto/declarative/qmlmetatype/tst_qmlmetatype.cpp b/tests/auto/declarative/qmlmetatype/tst_qmlmetatype.cpp index 750ccf8..027b607 100644 --- a/tests/auto/declarative/qmlmetatype/tst_qmlmetatype.cpp +++ b/tests/auto/declarative/qmlmetatype/tst_qmlmetatype.cpp @@ -60,6 +60,8 @@ public: tst_qmlmetatype() {} private slots: + void initTestCase(); + void copy(); void qmlParserStatusCast(); @@ -81,7 +83,6 @@ public: int foo() { return 0; } }; QML_DECLARE_TYPE(TestType); -QML_DEFINE_TYPE(Test, 1, 0, TestType, TestType); class ParserStatusTestType : public QObject, public QmlParserStatus { @@ -89,7 +90,6 @@ class ParserStatusTestType : public QObject, public QmlParserStatus Q_CLASSINFO("DefaultProperty", "foo"); // Missing default property }; QML_DECLARE_TYPE(ParserStatusTestType); -QML_DEFINE_TYPE(Test, 1, 0, ParserStatusTestType, ParserStatusTestType); class ValueSourceTestType : public QObject, public QmlPropertyValueSource { @@ -99,7 +99,6 @@ public: virtual void setTarget(const QmlMetaProperty &) {} }; QML_DECLARE_TYPE(ValueSourceTestType); -QML_DEFINE_TYPE(Test, 1, 0, ValueSourceTestType, ValueSourceTestType); class ValueInterceptorTestType : public QObject, public QmlPropertyValueInterceptor { @@ -110,7 +109,6 @@ public: virtual void write(const QVariant &) {} }; QML_DECLARE_TYPE(ValueInterceptorTestType); -QML_DEFINE_TYPE(Test, 1, 0, ValueInterceptorTestType, ValueInterceptorTestType); #define COPY_TEST(cpptype, metatype, value, defaultvalue) \ @@ -131,6 +129,14 @@ QML_DEFINE_TYPE(Test, 1, 0, ValueInterceptorTestType, ValueInterceptorTestType); QVERIFY(v == (value)); \ } +void tst_qmlmetatype::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); +} + void tst_qmlmetatype::copy() { QVERIFY(QmlMetaType::copy(QMetaType::Void, 0, 0)); diff --git a/tests/auto/declarative/qmlmoduleplugin/plugin/plugin.cpp b/tests/auto/declarative/qmlmoduleplugin/plugin/plugin.cpp index ddd1e5e..8af9c0d 100644 --- a/tests/auto/declarative/qmlmoduleplugin/plugin/plugin.cpp +++ b/tests/auto/declarative/qmlmoduleplugin/plugin/plugin.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <QtDeclarative/qmlmoduleplugin.h> +#include <QtDeclarative/qmlextensionplugin.h> #include <QtDeclarative/qml.h> #include <QDebug> @@ -61,10 +61,9 @@ private: }; QML_DECLARE_TYPE(MyPluginType); -QML_DEFINE_TYPE(com.nokia.AutoTestQmlPluginType,1,0,MyPluginType,MyPluginType); -class MyPlugin : public QmlModulePlugin +class MyPlugin : public QmlExtensionPlugin { Q_OBJECT public: @@ -78,9 +77,10 @@ public: return QStringList() << QLatin1String("com.nokia.AutoTestQmlPluginType"); } - void defineModule(const QString& uri) + void initialize(QmlEngine*, const char *uri) { - Q_ASSERT(uri == "com.nokia.AutoTestQmlPluginType"); + Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlPluginType"); + QML_REGISTER_TYPE(com.nokia.AutoTestQmlPluginType,1,0,MyPluginType,MyPluginType); } }; diff --git a/tests/auto/declarative/qmlstates/tst_qmlstates.cpp b/tests/auto/declarative/qmlstates/tst_qmlstates.cpp index b910c85..c372a15 100644 --- a/tests/auto/declarative/qmlstates/tst_qmlstates.cpp +++ b/tests/auto/declarative/qmlstates/tst_qmlstates.cpp @@ -56,6 +56,8 @@ private: static QByteArray fullDataPath(const QString &path); private slots: + void initTestCase(); + void basicChanges(); void basicExtension(); void basicBinding(); @@ -344,7 +346,11 @@ Q_SIGNALS: }; QML_DECLARE_TYPE(MyRect) -QML_DEFINE_TYPE(Qt.test, 1, 0, MyRectangle,MyRect); + +void tst_qmlstates::initTestCase() +{ + QML_REGISTER_TYPE(Qt.test, 1, 0, MyRectangle,MyRect); +} void tst_qmlstates::signalOverride() { diff --git a/tests/auto/declarative/qmlvaluetypes/testtypes.cpp b/tests/auto/declarative/qmlvaluetypes/testtypes.cpp index c51b777..aa8bd6e 100644 --- a/tests/auto/declarative/qmlvaluetypes/testtypes.cpp +++ b/tests/auto/declarative/qmlvaluetypes/testtypes.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "testtypes.h" -QML_DEFINE_TYPE(Test, 1, 0, MyTypeObject, MyTypeObject); -QML_DEFINE_TYPE(Test, 1, 0, MyConstantValueSource, MyConstantValueSource); -QML_DEFINE_TYPE(Test, 1, 0, MyOffsetValueInterceptor, MyOffsetValueInterceptor); +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); +} diff --git a/tests/auto/declarative/qmlvaluetypes/testtypes.h b/tests/auto/declarative/qmlvaluetypes/testtypes.h index b57fbff..5f9dde1 100644 --- a/tests/auto/declarative/qmlvaluetypes/testtypes.h +++ b/tests/auto/declarative/qmlvaluetypes/testtypes.h @@ -149,4 +149,6 @@ private: }; QML_DECLARE_TYPE(MyOffsetValueInterceptor); +void registerTypes(); + #endif // TESTTYPES_H diff --git a/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp b/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp index 4faa0bc..f28dc51 100644 --- a/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp +++ b/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp @@ -53,6 +53,8 @@ public: tst_qmlvaluetypes() {} private slots: + void initTestCase(); + void point(); void pointf(); void size(); @@ -80,6 +82,11 @@ private: QmlEngine engine; }; +void tst_qmlvaluetypes::initTestCase() +{ + registerTypes(); +} + inline QUrl TEST_FILE(const QString &filename) { return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); |