diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-11-03 13:27:13 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-11-03 13:27:13 +0100 |
commit | f2244103ff7a9b61fc7bcb7e920d8cc6b2f5f226 (patch) | |
tree | 8fe753743c46d4a652f582a7a2a49e5709eaa6e0 /tests/auto/quick/qquickitem2 | |
parent | 57430b2bdad32150e0ed8ceb6893430363ee6670 (diff) | |
parent | 164af37710e5721cbc7d79a0af20f2387181c59c (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
tools/qmlprofiler/qmlprofilerclient.cpp
Change-Id: I1de8832fefd0e45fea16ca072b6c7ae44fa376d4
Diffstat (limited to 'tests/auto/quick/qquickitem2')
3 files changed, 131 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickitem2/data/childrenRectBottomRightCorner.qml b/tests/auto/quick/qquickitem2/data/childrenRectBottomRightCorner.qml new file mode 100644 index 0000000000..0b83e20b20 --- /dev/null +++ b/tests/auto/quick/qquickitem2/data/childrenRectBottomRightCorner.qml @@ -0,0 +1,47 @@ +import QtQuick 2.0 + +Item { + width: 300 + height: 300 + + Item { + anchors.centerIn: parent + + Rectangle { + objectName: "childrenRectProxy" + x: container.childrenRect.x + y: container.childrenRect.y + width: container.childrenRect.width + height: container.childrenRect.height + color: "red" + opacity: 0.5 + } + + Item { + id: container + + Rectangle { + x: -100 + y: -100 + width: 10 + height: 10 + color: "red" + } + + Rectangle { + x: -60 + y: -60 + width: 10 + height: 10 + color: "red" + } + } + + Rectangle { + id: origin + width: 5 + height: 5 + color: "black" + } + } +} diff --git a/tests/auto/quick/qquickitem2/data/keynavigationtest_loop.qml b/tests/auto/quick/qquickitem2/data/keynavigationtest_loop.qml new file mode 100644 index 0000000000..dfac1549f9 --- /dev/null +++ b/tests/auto/quick/qquickitem2/data/keynavigationtest_loop.qml @@ -0,0 +1,37 @@ +import QtQuick 2.0 + +Column { + width: 50; height: 200 + Rectangle { + id: item1 + objectName: "item1" + focus: true + width: 50; height: 50 + color: focus ? "red" : "lightgray" + KeyNavigation.down: item2 + } + Rectangle { + id: item2 + objectName: "item2" + enabled: false + width: 50; height: 50 + color: focus ? "red" : "lightgray" + KeyNavigation.down: item3 + } + Rectangle { + id: item3 + objectName: "item3" + enabled: false + width: 50; height: 50 + color: focus ? "red" : "lightgray" + KeyNavigation.down: item4 + } + Rectangle { + id: item4 + objectName: "item4" + enabled: false + width: 50; height: 50 + color: focus ? "red" : "lightgray" + KeyNavigation.down: item3 + } +} diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index f3351fcc4e..c7717b9cca 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -87,6 +87,7 @@ private slots: void keyNavigation_skipNotVisible(); void keyNavigation_implicitSetting(); void keyNavigation_focusReason(); + void keyNavigation_loop(); void layoutMirroring(); void layoutMirroringIllegalParent(); void smooth(); @@ -103,6 +104,7 @@ private slots: void childrenRectBug(); void childrenRectBug2(); void childrenRectBug3(); + void childrenRectBottomRightCorner(); void childrenProperty(); void resourcesProperty(); @@ -2102,6 +2104,31 @@ void tst_QQuickItem::keyNavigation_focusReason() delete window; } +void tst_QQuickItem::keyNavigation_loop() +{ + // QTBUG-47229 + QQuickView *window = new QQuickView(0); + window->setBaseSize(QSize(240,320)); + + window->setSource(testFileUrl("keynavigationtest_loop.qml")); + window->show(); + window->requestActivate(); + + QVERIFY(QTest::qWaitForWindowActive(window)); + QCOMPARE(QGuiApplication::focusWindow(), window); + + QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "item1"); + QVERIFY(item); + QVERIFY(item->hasActiveFocus()); + + QKeyEvent key = QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(key.isAccepted()); + QVERIFY(item->hasActiveFocus()); + + delete window; +} + void tst_QQuickItem::smooth() { QQmlComponent component(&engine); @@ -2569,6 +2596,22 @@ void tst_QQuickItem::childrenRectBug3() delete window; } +// QTBUG-38732 +void tst_QQuickItem::childrenRectBottomRightCorner() +{ + QQuickView *window = new QQuickView(0); + window->setSource(testFileUrl("childrenRectBottomRightCorner.qml")); + window->show(); + + QQuickItem *rect = window->rootObject()->findChild<QQuickItem*>("childrenRectProxy"); + QCOMPARE(rect->x(), qreal(-100)); + QCOMPARE(rect->y(), qreal(-100)); + QCOMPARE(rect->width(), qreal(50)); + QCOMPARE(rect->height(), qreal(50)); + + delete window; +} + // QTBUG-13893 void tst_QQuickItem::transformCrash() { @@ -2721,7 +2764,10 @@ void tst_QQuickItem::parentLoop() { QQuickView *window = new QQuickView(0); - QTest::ignoreMessage(QtWarningMsg, "QQuickItem::setParentItem: Parent is already part of this items subtree."); +#ifndef QT_NO_REGULAREXPRESSION + QRegularExpression msgRegexp = QRegularExpression("QQuickItem::setParentItem: Parent QQuickItem\\(.*\\) is already part of the subtree of QQuickItem\\(.*\\)"); + QTest::ignoreMessage(QtWarningMsg, msgRegexp); +#endif window->setSource(testFileUrl("parentLoop.qml")); QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject()); |