diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-23 12:02:52 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-23 12:02:52 (GMT) |
commit | de4332a4728e739b37e9c7b04c021e150e096270 (patch) | |
tree | 619aae505826654f3d89492efa53f758214fea6f /tests/auto/declarative/qmllanguage | |
parent | a419d587a666aaf55310b3a18e9f9e1993fef16e (diff) | |
parent | 3db40b0be40c946f547f238ed3f0af813892115e (diff) | |
download | Qt-de4332a4728e739b37e9c7b04c021e150e096270.zip Qt-de4332a4728e739b37e9c7b04c021e150e096270.tar.gz Qt-de4332a4728e739b37e9c7b04c021e150e096270.tar.bz2 |
Merge remote branch 'origin/master'
Conflicts:
doc/src/declarative/advtutorial1.qdoc
doc/src/declarative/tutorial2.qdoc
doc/src/declarative/tutorial3.qdoc
src/declarative/graphicsitems/qmlgraphicsmousearea.cpp
src/multimedia/playback/qmediaplayer.cpp
Diffstat (limited to 'tests/auto/declarative/qmllanguage')
6 files changed, 27 insertions, 55 deletions
diff --git a/tests/auto/declarative/qmllanguage/data/interfaceQmlList.qml b/tests/auto/declarative/qmllanguage/data/interfaceQmlList.qml deleted file mode 100644 index 8392bea..0000000 --- a/tests/auto/declarative/qmllanguage/data/interfaceQmlList.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Test 1.0 -MyContainer { - qmllistInterfaces: [ - MyQmlObject {}, - MyQmlObject {} - ] -} diff --git a/tests/auto/declarative/qmllanguage/data/listAssignment.1.errors.txt b/tests/auto/declarative/qmllanguage/data/listAssignment.1.errors.txt deleted file mode 100644 index d68d487..0000000 --- a/tests/auto/declarative/qmllanguage/data/listAssignment.1.errors.txt +++ /dev/null @@ -1 +0,0 @@ -3:24:Cannot assign primitives to lists diff --git a/tests/auto/declarative/qmllanguage/data/listAssignment.1.qml b/tests/auto/declarative/qmllanguage/data/listAssignment.1.qml deleted file mode 100644 index 4240425..0000000 --- a/tests/auto/declarative/qmllanguage/data/listAssignment.1.qml +++ /dev/null @@ -1,4 +0,0 @@ -import Test 1.0 -MyContainer { - qmllistInterfaces: 1 -} diff --git a/tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml b/tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml index 779c6d4..32b5b6c 100644 --- a/tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml +++ b/tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml @@ -23,7 +23,7 @@ Item { width: 200; height: 50 Text { text: name } Text { text: '$'+cost; anchors.right: parent.right } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: fruitModel.remove(index) } diff --git a/tests/auto/declarative/qmllanguage/testtypes.h b/tests/auto/declarative/qmllanguage/testtypes.h index 0dc957f..27b45e4 100644 --- a/tests/auto/declarative/qmllanguage/testtypes.h +++ b/tests/auto/declarative/qmllanguage/testtypes.h @@ -447,22 +447,19 @@ QML_DECLARE_TYPE(MyTypeObject); class MyContainer : public QObject { Q_OBJECT - Q_PROPERTY(QList<QObject*>* children READ children) - Q_PROPERTY(QList<MyInterface*>* qlistInterfaces READ qlistInterfaces) - Q_PROPERTY(QmlList<MyInterface*>* qmllistInterfaces READ qmllistInterfaces) + Q_PROPERTY(QmlListProperty<QObject> children READ children) + Q_PROPERTY(QmlListProperty<MyInterface> qlistInterfaces READ qlistInterfaces) Q_CLASSINFO("DefaultProperty", "children"); public: MyContainer() {} - QList<QObject*> *children() { return &m_children; } - QList<MyInterface *> *qlistInterfaces() { return &m_interfaces; } - QmlList<MyInterface *> *qmllistInterfaces() { return &m_qmlinterfaces; } - const QmlConcreteList<MyInterface *> &qmllistAccessor() const { return m_qmlinterfaces; } + QmlListProperty<QObject> children() { return QmlListProperty<QObject>(this, m_children); } + QList<QObject *> *getChildren() { return &m_children; } + QmlListProperty<MyInterface> qlistInterfaces() { return QmlListProperty<MyInterface>(this, m_interfaces); } + QList<MyInterface *> *getQListInterfaces() { return &m_interfaces; } -private: QList<QObject*> m_children; QList<MyInterface *> m_interfaces; - QmlConcreteList<MyInterface *> m_qmlinterfaces; }; QML_DECLARE_TYPE(MyContainer); @@ -534,12 +531,12 @@ namespace MyNamespace { class MySecondNamespacedType : public QObject { Q_OBJECT - Q_PROPERTY(QmlList<MyNamespace::MyNamespacedType *> *list READ list); + Q_PROPERTY(QmlListProperty<MyNamespace::MyNamespacedType> list READ list); public: - QmlList<MyNamespacedType *> *list() { return &m_list; } + QmlListProperty<MyNamespacedType> list() { return QmlListProperty<MyNamespacedType>(this, m_list); } private: - QmlConcreteList<MyNamespacedType *> m_list; + QList<MyNamespacedType *> m_list; }; } QML_DECLARE_TYPE(MyNamespace::MyNamespacedType); diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp index c4636f3..4090e1d 100644 --- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp +++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp @@ -76,7 +76,6 @@ private slots: void simpleObject(); void simpleContainer(); void interfaceProperty(); - void interfaceQmlList(); void interfaceQList(); void assignObjectToSignal(); void assignObjectToVariant(); @@ -233,7 +232,6 @@ void tst_qmllanguage::errors_data() QTest::newRow("readOnly.2") << "readOnly.2.qml" << "readOnly.2.errors.txt" << false; QTest::newRow("readOnly.3") << "readOnly.3.qml" << "readOnly.3.errors.txt" << false; - QTest::newRow("listAssignment.1") << "listAssignment.1.qml" << "listAssignment.1.errors.txt" << false; QTest::newRow("listAssignment.2") << "listAssignment.2.qml" << "listAssignment.2.errors.txt" << false; QTest::newRow("listAssignment.3") << "listAssignment.3.qml" << "listAssignment.3.errors.txt" << false; @@ -354,7 +352,7 @@ void tst_qmllanguage::simpleContainer() VERIFY_ERRORS(0); MyContainer *container= qobject_cast<MyContainer*>(component.create()); QVERIFY(container != 0); - QCOMPARE(container->children()->count(),2); + QCOMPARE(container->getChildren()->count(),2); } void tst_qmllanguage::interfaceProperty() @@ -367,26 +365,15 @@ void tst_qmllanguage::interfaceProperty() QVERIFY(object->interface()->id == 913); } -void tst_qmllanguage::interfaceQmlList() -{ - QmlComponent component(&engine, TEST_FILE("interfaceQmlList.qml")); - VERIFY_ERRORS(0); - MyContainer *container= qobject_cast<MyContainer*>(component.create()); - QVERIFY(container != 0); - QVERIFY(container->qmllistAccessor().count() == 2); - for(int ii = 0; ii < 2; ++ii) - QVERIFY(container->qmllistAccessor().at(ii)->id == 913); -} - void tst_qmllanguage::interfaceQList() { QmlComponent component(&engine, TEST_FILE("interfaceQList.qml")); VERIFY_ERRORS(0); MyContainer *container= qobject_cast<MyContainer*>(component.create()); QVERIFY(container != 0); - QVERIFY(container->qlistInterfaces()->count() == 2); + QVERIFY(container->getQListInterfaces()->count() == 2); for(int ii = 0; ii < 2; ++ii) - QVERIFY(container->qlistInterfaces()->at(ii)->id == 913); + QVERIFY(container->getQListInterfaces()->at(ii)->id == 913); } void tst_qmllanguage::assignObjectToSignal() @@ -425,8 +412,8 @@ void tst_qmllanguage::assignQmlComponent() VERIFY_ERRORS(0); MyContainer *object = qobject_cast<MyContainer *>(component.create()); QVERIFY(object != 0); - QVERIFY(object->children()->count() == 1); - QObject *child = object->children()->at(0); + QVERIFY(object->getChildren()->count() == 1); + QObject *child = object->getChildren()->at(0); QCOMPARE(child->property("x"), QVariant(10)); QCOMPARE(child->property("y"), QVariant(11)); } @@ -504,7 +491,7 @@ void tst_qmllanguage::rootAsQmlComponent() MyContainer *object = qobject_cast<MyContainer *>(component.create()); QVERIFY(object != 0); QCOMPARE(object->property("x"), QVariant(11)); - QCOMPARE(object->children()->count(), 2); + QCOMPARE(object->getChildren()->count(), 2); } // Tests that components can be specified inline @@ -514,8 +501,8 @@ void tst_qmllanguage::inlineQmlComponents() VERIFY_ERRORS(0); MyContainer *object = qobject_cast<MyContainer *>(component.create()); QVERIFY(object != 0); - QCOMPARE(object->children()->count(), 1); - QmlComponent *comp = qobject_cast<QmlComponent *>(object->children()->at(0)); + QCOMPARE(object->getChildren()->count(), 1); + QmlComponent *comp = qobject_cast<QmlComponent *>(object->getChildren()->at(0)); QVERIFY(comp != 0); MyQmlObject *compObject = qobject_cast<MyQmlObject *>(comp->create()); QVERIFY(compObject != 0); @@ -529,9 +516,9 @@ void tst_qmllanguage::idProperty() VERIFY_ERRORS(0); MyContainer *object = qobject_cast<MyContainer *>(component.create()); QVERIFY(object != 0); - QCOMPARE(object->children()->count(), 1); + QCOMPARE(object->getChildren()->count(), 1); MyTypeObject *child = - qobject_cast<MyTypeObject *>(object->children()->at(0)); + qobject_cast<MyTypeObject *>(object->getChildren()->at(0)); QVERIFY(child != 0); QCOMPARE(child->id(), QString("myObjectId")); QCOMPARE(object->property("object"), QVariant::fromValue((QObject *)child)); @@ -1034,13 +1021,13 @@ void tst_qmllanguage::defaultPropertyListOrder() MyContainer *container = qobject_cast<MyContainer *>(component.create()); QVERIFY(container != 0); - QCOMPARE(container->children()->count(), 6); - QCOMPARE(container->children()->at(0)->property("index"), QVariant(0)); - QCOMPARE(container->children()->at(1)->property("index"), QVariant(1)); - QCOMPARE(container->children()->at(2)->property("index"), QVariant(2)); - QCOMPARE(container->children()->at(3)->property("index"), QVariant(3)); - QCOMPARE(container->children()->at(4)->property("index"), QVariant(4)); - QCOMPARE(container->children()->at(5)->property("index"), QVariant(5)); + QCOMPARE(container->getChildren()->count(), 6); + QCOMPARE(container->getChildren()->at(0)->property("index"), QVariant(0)); + QCOMPARE(container->getChildren()->at(1)->property("index"), QVariant(1)); + QCOMPARE(container->getChildren()->at(2)->property("index"), QVariant(2)); + QCOMPARE(container->getChildren()->at(3)->property("index"), QVariant(3)); + QCOMPARE(container->getChildren()->at(4)->property("index"), QVariant(4)); + QCOMPARE(container->getChildren()->at(5)->property("index"), QVariant(5)); } void tst_qmllanguage::declaredPropertyValues() |