aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickitem2
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-06-24 11:26:22 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-06-24 11:48:46 +0200
commit1a9759855639b9e2b3cdc0687d3381dcbf6c9815 (patch)
treeb2da51f6eddddb83c2d97cdcfac24d38d2e67a4e /tests/auto/quick/qquickitem2
parent8217ec1b888f3ff93f004801b018c5f85362c484 (diff)
parente1fc2793aef53b84a3f1e19b6d6bdf1141340074 (diff)
Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into wip/v4
Conflicts: src/imports/qtquick2/plugins.qmltypes src/qml/debugger/qv8debugservice.cpp src/qml/qml/qml.pri src/qml/qml/qqmlcompiler.cpp src/qml/qml/qqmlcomponent.cpp src/qml/qml/qqmlcontext.cpp src/qml/qml/qqmldata_p.h src/qml/qml/qqmlengine_p.h src/qml/qml/qqmljavascriptexpression.cpp src/qml/qml/qqmlxmlhttprequest.cpp src/qml/qml/v4/qv4bindings.cpp src/qml/qml/v4/qv4irbuilder.cpp src/qml/qml/v4/qv4jsonobject_p.h src/qml/qml/v8/qqmlbuiltinfunctions.cpp src/qml/qml/v8/qv8bindings.cpp src/qml/qml/v8/qv8contextwrapper.cpp src/qml/qml/v8/qv8listwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper_p.h src/qml/qml/v8/qv8sequencewrapper_p_p.h src/qml/qml/v8/qv8typewrapper.cpp src/qml/qml/v8/qv8valuetypewrapper.cpp src/qml/types/qqmldelegatemodel.cpp src/quick/items/context2d/qquickcanvasitem.cpp src/quick/items/context2d/qquickcontext2d.cpp sync.profile tests/auto/qml/qjsengine/tst_qjsengine.cpp tests/benchmarks/qml/animation/animation.pro tools/qmlprofiler/qmlprofiler.pro Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
Diffstat (limited to 'tests/auto/quick/qquickitem2')
-rw-r--r--tests/auto/quick/qquickitem2/data/activeFocusOnTab6.qml144
-rw-r--r--tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml36
-rw-r--r--tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml36
-rw-r--r--tests/auto/quick/qquickitem2/data/resourcesProperty.qml23
-rw-r--r--tests/auto/quick/qquickitem2/tst_qquickitem.cpp330
5 files changed, 556 insertions, 13 deletions
diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab6.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab6.qml
new file mode 100644
index 0000000000..22b4d249f0
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab6.qml
@@ -0,0 +1,144 @@
+import QtQuick 2.1
+
+Item {
+ id: main
+ objectName: "main"
+ width: 800
+ height: 600
+ focus: true
+ Component.onCompleted: button12.focus = true
+ Item {
+ id: sub1
+ objectName: "sub1"
+ width: 230
+ height: 600
+ anchors.top: parent.top
+ anchors.left: parent.left
+ Item {
+ id: button11
+ objectName: "button11"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Accessible.role: Accessible.Table
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: parent.top
+ anchors.topMargin: 100
+ }
+ Item {
+ id: button12
+ objectName: "button12"
+ activeFocusOnTab: true
+ Accessible.role: Accessible.List
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ width: 100
+ height: 50
+
+ anchors.top: button11.bottom
+ anchors.bottomMargin: 100
+ }
+ Item {
+ id: button13
+ objectName: "button13"
+ enabled: false
+ activeFocusOnTab: true
+ Accessible.role: Accessible.Table
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ width: 100
+ height: 50
+
+ anchors.top: button12.bottom
+ anchors.bottomMargin: 100
+ }
+ Item {
+ id: button14
+ objectName: "button14"
+ visible: false
+ activeFocusOnTab: true
+ Accessible.role: Accessible.List
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ width: 100
+ height: 50
+
+ anchors.top: button12.bottom
+ anchors.bottomMargin: 100
+ }
+ }
+ Item {
+ id: sub2
+ objectName: "sub2"
+ activeFocusOnTab: true
+ Accessible.role: Accessible.Row
+ width: 230
+ height: 600
+ anchors.top: parent.top
+ anchors.left: sub1.right
+ Item {
+ id: button21
+ objectName: "button21"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Accessible.role: Accessible.PushButton
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: parent.top
+ anchors.topMargin: 100
+ }
+ Item {
+ id: button22
+ objectName: "button22"
+ width: 100
+ height: 50
+ activeFocusOnTab: true
+ Accessible.role: Accessible.RadioButton
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+
+ anchors.top: button21.bottom
+ anchors.bottomMargin: 100
+ }
+ }
+ Item {
+ id: sub3
+ objectName: "sub3"
+ width: 230
+ height: 600
+ anchors.top: parent.top
+ anchors.left: sub2.right
+ TextEdit {
+ id: edit
+ objectName: "edit"
+ width: 230
+ height: 400
+ readOnly: false
+ activeFocusOnTab: true
+ Accessible.role: Accessible.EditableText
+ wrapMode: TextEdit.Wrap
+ textFormat: TextEdit.RichText
+
+ text: "aaa\n"
+ +"bbb\n"
+ +"ccc\n"
+ +"ddd\n"
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml
new file mode 100644
index 0000000000..e81d9be950
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.1
+
+Item {
+ id: main
+ objectName: "main"
+ width: 300
+ height: 300
+ Item {
+ id: button1
+ objectName: "button1"
+ width: 300
+ height: 150
+ activeFocusOnTab: true
+ Accessible.role: Accessible.Button
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ anchors.top: parent.top
+ anchors.left: parent.left
+ }
+ Item {
+ id: button2
+ objectName: "button2"
+ width: 300
+ height: 150
+ activeFocusOnTab: true
+ Accessible.role: Accessible.Button
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml
new file mode 100644
index 0000000000..641a39c1fa
--- /dev/null
+++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.1
+
+Item {
+ id: main
+ objectName: "main"
+ width: 300
+ height: 300
+ Item {
+ id: button1
+ objectName: "button1"
+ width: 300
+ height: 150
+ activeFocusOnTab: true
+ Accessible.role: Accessible.Table
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ anchors.top: parent.top
+ anchors.left: parent.left
+ }
+ Item {
+ id: button2
+ objectName: "button2"
+ width: 300
+ height: 150
+ activeFocusOnTab: true
+ Accessible.role: Accessible.Table
+ Rectangle {
+ anchors.fill: parent
+ color: parent.activeFocus ? "red" : "black"
+ }
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ }
+}
diff --git a/tests/auto/quick/qquickitem2/data/resourcesProperty.qml b/tests/auto/quick/qquickitem2/data/resourcesProperty.qml
index b8f18bb375..2c4c0aa5c1 100644
--- a/tests/auto/quick/qquickitem2/data/resourcesProperty.qml
+++ b/tests/auto/quick/qquickitem2/data/resourcesProperty.qml
@@ -8,14 +8,27 @@ Item {
property bool test3
property bool test4
property bool test5
+ property bool test6
Component.onCompleted: {
- test1 = (root.resources.length >= 3)
- test2 = root.resources[0] == item1
- test3 = root.resources[1] == item2
- test4 = root.resources[2] == item3
- test5 = root.resources[10] == null
+ test1 = (root.resources.length === 4)
+ test2 = root.resources[0] === item1
+ test3 = root.resources[1] === item2
+ test4 = root.resources[2] === item3
+ test5 = root.resources[3] === otherObject
+ test6 = root.resources[10] == null
}
+ //Resources can be used explicitly
resources: [ Item { id: item1 }, Item { id: item2 }, Item { id: item3 } ]
+
+ Item {
+ //Item in Data go the children property.
+ }
+
+ QtObject {
+ //Objects in Data which are not items are put in resources.
+ id: otherObject
+ objectName: "subObject";
+ }
}
diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
index f2d25e81ed..992e81aa64 100644
--- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp
@@ -47,6 +47,7 @@
#include <QtGui/private/qinputmethod_p.h>
#include <QtQuick/private/qquickrectangle_p.h>
#include <QtQuick/private/qquicktextinput_p.h>
+#include <QtGui/qpa/qplatformtheme.h>
#include <private/qquickitem_p.h>
#include "../../shared/util.h"
#include "../shared/visualtestutil.h"
@@ -69,6 +70,12 @@ private slots:
void activeFocusOnTab3();
void activeFocusOnTab4();
void activeFocusOnTab5();
+ void activeFocusOnTab6();
+ void activeFocusOnTab7();
+ void activeFocusOnTab8();
+
+ void nextItemInFocusChain();
+ void nextItemInFocusChain2();
void keys();
void keysProcessingOrder();
@@ -108,6 +115,11 @@ private slots:
private:
QQmlEngine engine;
+ bool qt_tab_all_widgets() {
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ return theme->themeHint(QPlatformTheme::TabAllWidgets).toBool();
+ return true;
+ }
};
class KeysTestObject : public QObject
@@ -281,6 +293,9 @@ void tst_QQuickItem::cleanup()
void tst_QQuickItem::activeFocusOnTab()
{
+ if (!qt_tab_all_widgets())
+ QSKIP("This function doesn't support NOT iterating all.");
+
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(800,600));
@@ -390,6 +405,9 @@ void tst_QQuickItem::activeFocusOnTab()
void tst_QQuickItem::activeFocusOnTab2()
{
+ if (!qt_tab_all_widgets())
+ QSKIP("This function doesn't support NOT iterating all.");
+
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(800,600));
@@ -427,6 +445,9 @@ void tst_QQuickItem::activeFocusOnTab2()
void tst_QQuickItem::activeFocusOnTab3()
{
+ if (!qt_tab_all_widgets())
+ QSKIP("This function doesn't support NOT iterating all.");
+
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(800,600));
@@ -606,6 +627,9 @@ void tst_QQuickItem::activeFocusOnTab3()
void tst_QQuickItem::activeFocusOnTab4()
{
+ if (!qt_tab_all_widgets())
+ QSKIP("This function doesn't support NOT iterating all.");
+
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(800,600));
@@ -635,6 +659,9 @@ void tst_QQuickItem::activeFocusOnTab4()
void tst_QQuickItem::activeFocusOnTab5()
{
+ if (!qt_tab_all_widgets())
+ QSKIP("This function doesn't support NOT iterating all.");
+
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(800,600));
@@ -664,6 +691,273 @@ void tst_QQuickItem::activeFocusOnTab5()
delete window;
}
+void tst_QQuickItem::activeFocusOnTab6()
+{
+ if (qt_tab_all_widgets())
+ QSKIP("This function doesn't support iterating all.");
+
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab6.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ // original: button12
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button12");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // Tab: button12->edit
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "edit");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: edit->button12
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button12");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button12->button11
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "button11");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button11->edit
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ item = findItem<QQuickItem>(window->rootObject(), "edit");
+ QVERIFY(item);
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::activeFocusOnTab7()
+{
+ if (qt_tab_all_widgets())
+ QSKIP("This function doesn't support iterating all.");
+
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(300,300));
+
+ window->setSource(testFileUrl("activeFocusOnTab7.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button1");
+ QVERIFY(item);
+ item->forceActiveFocus();
+ QVERIFY(item->hasActiveFocus());
+
+ // Tab: button1->button1
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(!key.isAccepted());
+
+ QVERIFY(item->hasActiveFocus());
+
+ // BackTab: button1->button1
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(!key.isAccepted());
+
+ QVERIFY(item->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::activeFocusOnTab8()
+{
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(300,300));
+
+ window->setSource(testFileUrl("activeFocusOnTab8.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QQuickItem *content = window->contentItem();
+ QVERIFY(content);
+ QVERIFY(content->hasActiveFocus());
+
+ QQuickItem *button1 = findItem<QQuickItem>(window->rootObject(), "button1");
+ QVERIFY(button1);
+ QVERIFY(!button1->hasActiveFocus());
+
+ QQuickItem *button2 = findItem<QQuickItem>(window->rootObject(), "button2");
+ QVERIFY(button2);
+ QVERIFY(!button2->hasActiveFocus());
+
+ // Tab: contentItem->button1
+ QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ QVERIFY(button1->hasActiveFocus());
+
+ // Tab: button1->button2
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ QVERIFY(button2->hasActiveFocus());
+ QVERIFY(!button1->hasActiveFocus());
+
+ // BackTab: button2->button1
+ key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1);
+ QGuiApplication::sendEvent(window, &key);
+ QVERIFY(key.isAccepted());
+
+ QVERIFY(button1->hasActiveFocus());
+ QVERIFY(!button2->hasActiveFocus());
+
+ delete window;
+}
+
+void tst_QQuickItem::nextItemInFocusChain()
+{
+ if (!qt_tab_all_widgets())
+ QSKIP("This function doesn't support NOT iterating all.");
+
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QQuickItem *button11 = findItem<QQuickItem>(window->rootObject(), "button11");
+ QVERIFY(button11);
+ QQuickItem *button12 = findItem<QQuickItem>(window->rootObject(), "button12");
+ QVERIFY(button12);
+
+ QQuickItem *sub2 = findItem<QQuickItem>(window->rootObject(), "sub2");
+ QVERIFY(sub2);
+ QQuickItem *button21 = findItem<QQuickItem>(window->rootObject(), "button21");
+ QVERIFY(button21);
+ QQuickItem *button22 = findItem<QQuickItem>(window->rootObject(), "button22");
+ QVERIFY(button22);
+
+ QQuickItem *edit = findItem<QQuickItem>(window->rootObject(), "edit");
+ QVERIFY(edit);
+
+ QQuickItem *next, *prev;
+
+ next = button11->nextItemInFocusChain(true);
+ QVERIFY(next);
+ QCOMPARE(next, button12);
+ prev = button11->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, edit);
+
+ next = button12->nextItemInFocusChain();
+ QVERIFY(next);
+ QCOMPARE(next, sub2);
+ prev = button12->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, button11);
+
+ next = sub2->nextItemInFocusChain(true);
+ QVERIFY(next);
+ QCOMPARE(next, button21);
+ prev = sub2->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, button12);
+
+ next = button21->nextItemInFocusChain();
+ QVERIFY(next);
+ QCOMPARE(next, button22);
+ prev = button21->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, sub2);
+
+ next = button22->nextItemInFocusChain(true);
+ QVERIFY(next);
+ QCOMPARE(next, edit);
+ prev = button22->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, button21);
+
+ next = edit->nextItemInFocusChain();
+ QVERIFY(next);
+ QCOMPARE(next, button11);
+ prev = edit->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, button22);
+
+ delete window;
+}
+
+void tst_QQuickItem::nextItemInFocusChain2()
+{
+ if (qt_tab_all_widgets())
+ QSKIP("This function doesn't support iterating all.");
+
+ QQuickView *window = new QQuickView(0);
+ window->setBaseSize(QSize(800,600));
+
+ window->setSource(testFileUrl("activeFocusOnTab6.qml"));
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+
+ QQuickItem *button11 = findItem<QQuickItem>(window->rootObject(), "button11");
+ QVERIFY(button11);
+ QQuickItem *button12 = findItem<QQuickItem>(window->rootObject(), "button12");
+ QVERIFY(button12);
+
+ QQuickItem *edit = findItem<QQuickItem>(window->rootObject(), "edit");
+ QVERIFY(edit);
+
+ QQuickItem *next, *prev;
+
+ next = button11->nextItemInFocusChain(true);
+ QVERIFY(next);
+ QCOMPARE(next, button12);
+ prev = button11->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, edit);
+
+ next = button12->nextItemInFocusChain();
+ QVERIFY(next);
+ QCOMPARE(next, edit);
+ prev = button12->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, button11);
+
+ next = edit->nextItemInFocusChain();
+ QVERIFY(next);
+ QCOMPARE(next, button11);
+ prev = edit->nextItemInFocusChain(false);
+ QVERIFY(prev);
+ QCOMPARE(prev, button12);
+
+ delete window;
+}
+
void tst_QQuickItem::keys()
{
QQuickView *window = new QQuickView(0);
@@ -1633,15 +1927,35 @@ void tst_QQuickItem::resourcesProperty()
{
QQmlComponent component(&engine, testFileUrl("resourcesProperty.qml"));
- QObject *o = component.create();
- QVERIFY(o != 0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
- QCOMPARE(o->property("test1").toBool(), true);
- QCOMPARE(o->property("test2").toBool(), true);
- QCOMPARE(o->property("test3").toBool(), true);
- QCOMPARE(o->property("test4").toBool(), true);
- QCOMPARE(o->property("test5").toBool(), true);
- delete o;
+ QQmlProperty property(object, "resources", component.creationContext());
+
+ QVERIFY(property.isValid());
+ QQmlListReference list = qvariant_cast<QQmlListReference>(property.read());
+ QVERIFY(list.isValid());
+
+ QCOMPARE(list.count(), 4);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+ QCOMPARE(object->property("test3").toBool(), true);
+ QCOMPARE(object->property("test4").toBool(), true);
+ QCOMPARE(object->property("test5").toBool(), true);
+ QCOMPARE(object->property("test6").toBool(), true);
+
+ QObject *subObject = object->findChild<QObject *>("subObject");
+
+ QVERIFY(subObject);
+
+ QCOMPARE(object, subObject->parent());
+
+ delete subObject;
+
+ QCOMPARE(list.count(), 3);
+
+ delete object;
}
void tst_QQuickItem::propertyChanges()