diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-11-13 04:34:36 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-11-13 04:34:36 (GMT) |
commit | f7b6358f0d8ff9cad1fd1fcb9622fad40cb0f0b0 (patch) | |
tree | 0ca3736adf4e9c8ad029506b3aa0ba6dfc5ab3d7 /tests/auto | |
parent | 08405d50115aaf787f09c7c8151bd10f8b4d02ce (diff) | |
parent | ee4278059939902482c7f457089aaf484358113b (diff) | |
download | Qt-f7b6358f0d8ff9cad1fd1fcb9622fad40cb0f0b0.zip Qt-f7b6358f0d8ff9cad1fd1fcb9622fad40cb0f0b0.tar.gz Qt-f7b6358f0d8ff9cad1fd1fcb9622fad40cb0f0b0.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tests/auto')
3 files changed, 104 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlxmllistmodel/data/unique.qml b/tests/auto/declarative/qmlxmllistmodel/data/unique.qml new file mode 100644 index 0000000..ed0f293 --- /dev/null +++ b/tests/auto/declarative/qmlxmllistmodel/data/unique.qml @@ -0,0 +1,8 @@ +import Qt 4.6 + +XmlListModel { + source: "model.xml" + query: "/Pets/Pet" + XmlRole { name: "name"; query: "name/string()" } + XmlRole { name: "name"; query: "type/string()" } +} diff --git a/tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp b/tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp index 71bc4f9..a68006d 100644 --- a/tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp +++ b/tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp @@ -58,6 +58,7 @@ private slots: void attributes(); void roles(); void roleErrors(); + void uniqueRoleNames(); private: QmlEngine engine; @@ -175,6 +176,20 @@ void tst_qmlxmllistmodel::roleErrors() delete listModel; } +void tst_qmlxmllistmodel::uniqueRoleNames() +{ + QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/unique.qml")); + QTest::ignoreMessage(QtWarningMsg, "QML QmlXmlListModelRole (file://" SRCDIR "/data/unique.qml:7:5) \"name\" duplicates a previous role name and will be disabled."); + QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); + QVERIFY(listModel != 0); + QTRY_COMPARE(listModel->count(), 9); + + QList<int> roles = listModel->roles(); + QCOMPARE(roles.count(), 1); + + delete listModel; +} + QTEST_MAIN(tst_qmlxmllistmodel) #include "tst_qmlxmllistmodel.moc" diff --git a/tests/auto/declarative/visual/Package_Views/packageviews.qml b/tests/auto/declarative/visual/Package_Views/packageviews.qml new file mode 100644 index 0000000..a9719ca --- /dev/null +++ b/tests/auto/declarative/visual/Package_Views/packageviews.qml @@ -0,0 +1,81 @@ +import Qt 4.6 + +Rectangle { + id: root + width: 200 + height: 200 + color: "black" + + VisualDataModel { + id: Model + model: ListModel { + ListElement { itemColor: "red" } + ListElement { itemColor: "green" } + ListElement { itemColor: "blue" } + ListElement { itemColor: "orange" } + ListElement { itemColor: "purple" } + ListElement { itemColor: "yellow" } + ListElement { itemColor: "slategrey" } + ListElement { itemColor: "cyan" } + } + delegate: Package { + Rectangle { + id: listItem; Package.name: "list"; width:root.width/2; height: 50; color: "transparent"; border.color: "white" + MouseRegion { + anchors.fill: parent + onClicked: myState.state = myState.state == "list" ? "grid" : "list" + } + } + Rectangle { + id: gridItem; Package.name: "grid"; width:50; height: 50; color: "transparent"; border.color: "white" + MouseRegion { + anchors.fill: parent + onClicked: myState.state = myState.state == "list" ? "grid" : "list" + } + } + Rectangle { id: myContent; width:50; height: 50; color: itemColor } + + StateGroup { + id: myState + state: "list" + states: [ + State { + name: "list" + ParentChange { target: myContent; parent: listItem } + PropertyChanges { target: myContent; x: 0; y: 0; width: listItem.width } + }, + State { + name: "grid" + ParentChange { target: myContent; parent: gridItem } + PropertyChanges { target: myContent; x: 0; y: 0; width: gridItem.width } + } + ] + + transitions: [ + Transition { + from: "*"; to: "*" + SequentialAnimation { + ParentAction{} + NumberAnimation { matchProperties: "x,y,width"; easing: "easeInOutQuad" } + } + } + ] + } + } + } + + ListView { + width: parent.width/2 + height: parent.height + model: Model.parts.list + } + + GridView { + x: parent.width/2 + width: parent.width/2 + cellWidth: 50 + cellHeight: 50 + height: parent.height + model: Model.parts.grid + } +} |