diff options
Diffstat (limited to 'tests/auto/quick')
-rw-r--r-- | tests/auto/quick/qquickgridview/data/qtbug49218.qml | 126 | ||||
-rw-r--r-- | tests/auto/quick/qquickgridview/tst_qquickgridview.cpp | 31 | ||||
-rw-r--r-- | tests/auto/quick/qquicklistview/data/addoncompleted.qml | 90 | ||||
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 47 | ||||
-rw-r--r-- | tests/auto/quick/qquickshortcut/data/shortcutsRect.qml | 54 | ||||
-rw-r--r-- | tests/auto/quick/qquickshortcut/qquickshortcut.pro | 3 | ||||
-rw-r--r-- | tests/auto/quick/qquickshortcut/tst_qquickshortcut.cpp | 124 | ||||
-rw-r--r-- | tests/auto/quick/touchmouse/BLACKLIST | 2 |
8 files changed, 476 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickgridview/data/qtbug49218.qml b/tests/auto/quick/qquickgridview/data/qtbug49218.qml new file mode 100644 index 0000000000..1a55fe5b3a --- /dev/null +++ b/tests/auto/quick/qquickgridview/data/qtbug49218.qml @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.4 + +Item { + width: 500 + height: 160 + visible: true + + property var model1: ["1","2","3","4","5","6","7","8","9","10", + "11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30", + "31","32","33","34","a"] + property var model2: ["a","b","c","d","e","f","g","h","i","j","k","l","m","1"] + property bool useModel1: true + + function changeModel() { + useModel1 = !useModel1 + grid.loadModel(useModel1 ? model1 : model2) + } + + function scrollToTop() { + grid.contentY = grid.originY; + } + + GridView { + id: grid + anchors.fill: parent + + model: ListModel { + } + + onCurrentIndexChanged: { + positionViewAtIndex(currentIndex, GridView.Contain) + } + + Component.onCompleted: { + loadModel(model1) + grid.currentIndex = 34 + grid.positionViewAtIndex(34, GridView.Contain) + } + + function loadModel(m) { + var remove = {}; + var add = {}; + var i; + for (i=0; i < model.count; ++i) + remove[model.get(i).name] = true; + for (i=0; i < m.length; ++i) + if (remove[m[i]]) + delete remove[m[i]]; + else + add[m[i]] = true; + + for (i=model.count-1; i>= 0; --i) + if (remove[model.get(i).name]) + model.remove(i, 1); + + for (i=0; i<m.length; ++i) + if (add[m[i]]) + model.insert(i, { "name": m[i] }) + } + + delegate: Rectangle { + height: grid.cellHeight + width: grid.cellWidth + color: GridView.isCurrentItem ? "gray" : "white" + Text { + anchors.fill: parent + text: name + } + MouseArea { + anchors.fill: parent + onClicked: { + grid.currentIndex = index + } + } + } + } +} diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index 2a4a9dbdd9..ce04dc3c80 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -210,6 +210,7 @@ private slots: void contentHeightWithDelayRemove(); void QTBUG_45640(); + void QTBUG_49218(); void QTBUG_48870_fastModelUpdates(); void keyNavigationEnabled(); @@ -6629,6 +6630,36 @@ void tst_QQuickGridView::QTBUG_45640() delete window; } +void tst_QQuickGridView::QTBUG_49218() +{ + QQuickView *window = createView(); + window->setSource(testFileUrl("qtbug49218.qml")); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); + + QQuickItem *rootItem = qobject_cast<QQuickItem*>(window->rootObject()); + QQuickGridView *gridview = qobject_cast<QQuickGridView *>(rootItem->childItems().first()); + QVERIFY(gridview != 0); + + auto processEventsAndForceLayout = [&gridview] () { + for (int pass = 0; pass < 2; ++pass) { + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); + gridview->forceLayout(); + } + }; + QMetaObject::invokeMethod(rootItem, "scrollToTop"); + processEventsAndForceLayout(); + QMetaObject::invokeMethod(rootItem, "changeModel"); + processEventsAndForceLayout(); + QMetaObject::invokeMethod(rootItem, "changeModel"); + processEventsAndForceLayout(); + QMetaObject::invokeMethod(rootItem, "scrollToTop"); + processEventsAndForceLayout(); + + QCOMPARE(gridview->indexAt(gridview->cellWidth() - 10, gridview->cellHeight() - 10), 0); + delete window; +} + void tst_QQuickGridView::keyNavigationEnabled() { QScopedPointer<QQuickView> window(createView()); diff --git a/tests/auto/quick/qquicklistview/data/addoncompleted.qml b/tests/auto/quick/qquicklistview/data/addoncompleted.qml new file mode 100644 index 0000000000..57265cb2c0 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/addoncompleted.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.9 + +Rectangle { + width: 640 + height: 480 + color: "green" + + ListModel { + id: listModel + ListElement { name: "a" } + ListElement { name: "b" } + ListElement { name: "c" } + ListElement { name: "d" } + ListElement { name: "e" } + ListElement { name: "f" } + ListElement { name: "g" } + ListElement { name: "h" } + ListElement { name: "i" } + ListElement { name: "j" } + } + + ListView { + anchors.fill: parent + model: listModel + objectName: "view" + + delegate: Rectangle { + height: 15 + width: 15 + color: "blue" + objectName: name + Component.onCompleted: { + if (name.length === 1 && listModel.get(index + 1).name.length === 1) { + for (var i = 0; i < 10; ++i) + listModel.insert(index + 1, {name: name + i}); + } + } + } + } +} diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 8827ad0f3a..dc8c727cbe 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -255,6 +255,7 @@ private slots: void QTBUG_50105(); void keyNavigationEnabled(); void QTBUG_61269_appendDuringScrollDown(); + void QTBUG_61269_appendDuringScrollDown_data(); void QTBUG_50097_stickyHeader_positionViewAtIndex(); void QTBUG_63974_stickyHeader_positionViewAtIndex_Contain(); void itemFiltered(); @@ -263,6 +264,8 @@ private slots: void QTBUG_34576_velocityZero(); void QTBUG_61537_modelChangesAsync(); + void addOnCompleted(); + private: template <class T> void items(const QUrl &source); template <class T> void changed(const QUrl &source); @@ -8468,8 +8471,19 @@ void tst_QQuickListView::keyNavigationEnabled() QCOMPARE(listView->currentIndex(), 1); } -void tst_QQuickListView::QTBUG_61269_appendDuringScrollDown() +void tst_QQuickListView::QTBUG_61269_appendDuringScrollDown_data() +{ + QTest::addColumn<QQuickListView::SnapMode>("snapMode"); + + QTest::newRow("NoSnap") << QQuickListView::NoSnap; + QTest::newRow("SnapToItem") << QQuickListView::SnapToItem; + QTest::newRow("SnapOneItem") << QQuickListView::SnapOneItem; +} + +void tst_QQuickListView::QTBUG_61269_appendDuringScrollDown() // AKA QTBUG-62864 { + QFETCH(QQuickListView::SnapMode, snapMode); + QScopedPointer<QQuickView> window(createView()); window->setSource(testFileUrl("appendDuringScrollDown.qml")); window->show(); @@ -8477,6 +8491,7 @@ void tst_QQuickListView::QTBUG_61269_appendDuringScrollDown() QVERIFY(QTest::qWaitForWindowActive(window.data())); QQuickListView *listView = qobject_cast<QQuickListView *>(window->rootObject()); + listView->setSnapMode(snapMode); QQuickItem *highlightItem = listView->highlightItem(); QVERIFY(listView); QCOMPARE(listView->isKeyNavigationEnabled(), true); @@ -8722,6 +8737,36 @@ void tst_QQuickListView::QTBUG_61537_modelChangesAsync() QCOMPARE(reportedCount, actualCount); } +void tst_QQuickListView::addOnCompleted() +{ + QScopedPointer<QQuickView> window(createView()); + window->setSource(testFileUrl("addoncompleted.qml")); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); + + QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view"); + QTRY_VERIFY(listview != 0); + + QQuickItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + qreal y = -1; + for (char name = 'a'; name <= 'j'; ++name) { + for (int num = 9; num >= 0; --num) { + const QString objName = QString::fromLatin1("%1%2").arg(name).arg(num); + QQuickItem *item = findItem<QQuickItem>(contentItem, objName); + if (!item) { + QVERIFY(name >= 'd'); + y = 9999999; + } else { + const qreal newY = item->y(); + QVERIFY2(newY > y, objName.toUtf8().constData()); + y = newY; + } + } + } +} + QTEST_MAIN(tst_QQuickListView) #include "tst_qquicklistview.moc" diff --git a/tests/auto/quick/qquickshortcut/data/shortcutsRect.qml b/tests/auto/quick/qquickshortcut/data/shortcutsRect.qml new file mode 100644 index 0000000000..9aced4e530 --- /dev/null +++ b/tests/auto/quick/qquickshortcut/data/shortcutsRect.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.5 + +Rectangle { + width: 300 + height: 300 + + property string activatedShortcut + property string ambiguousShortcut + + property alias shortcuts: repeater.model + + Repeater { + id: repeater + + Item { + Shortcut { + sequence: modelData.sequence + enabled: modelData.enabled + autoRepeat: modelData.autoRepeat + context: modelData.context + onActivated: activatedShortcut = sequence + onActivatedAmbiguously: ambiguousShortcut = sequence + } + } + } +} diff --git a/tests/auto/quick/qquickshortcut/qquickshortcut.pro b/tests/auto/quick/qquickshortcut/qquickshortcut.pro index d780d9061a..018bb91594 100644 --- a/tests/auto/quick/qquickshortcut/qquickshortcut.pro +++ b/tests/auto/quick/qquickshortcut/qquickshortcut.pro @@ -8,3 +8,6 @@ include (../../shared/util.pri) TESTDATA = data/* QT += core gui qml quick testlib +qtHaveModule(widgets) { + QT += quickwidgets +} diff --git a/tests/auto/quick/qquickshortcut/tst_qquickshortcut.cpp b/tests/auto/quick/qquickshortcut/tst_qquickshortcut.cpp index 75ccf26af9..4962690796 100644 --- a/tests/auto/quick/qquickshortcut/tst_qquickshortcut.cpp +++ b/tests/auto/quick/qquickshortcut/tst_qquickshortcut.cpp @@ -29,6 +29,11 @@ #include <QtTest/qtest.h> #include <QtQuick/qquickwindow.h> #include <QtQml/qqmlapplicationengine.h> +#include <QtQuick/qquickitem.h> +#include <QtTest/qsignalspy.h> +#ifdef QT_QUICKWIDGETS_LIB +#include <QtQuickWidgets/qquickwidget.h> +#endif #include "../../shared/util.h" @@ -47,6 +52,10 @@ private slots: void matcher(); void multiple_data(); void multiple(); +#ifdef QT_QUICKWIDGETS_LIB + void renderControlShortcuts_data(); + void renderControlShortcuts(); +#endif }; Q_DECLARE_METATYPE(Qt::Key) @@ -453,6 +462,121 @@ void tst_QQuickShortcut::multiple() QCOMPARE(window->property("activated").toBool(), activated); } +#ifdef QT_QUICKWIDGETS_LIB +void tst_QQuickShortcut::renderControlShortcuts_data() +{ + QTest::addColumn<QVariantList>("shortcuts"); + QTest::addColumn<Qt::Key>("key"); + QTest::addColumn<Qt::KeyboardModifiers>("modifiers"); + QTest::addColumn<QString>("activatedShortcut"); + QTest::addColumn<QString>("ambiguousShortcut"); + + QVariantList shortcuts; + shortcuts << shortcutMap("M") + << shortcutMap("Alt+M") + << shortcutMap("Ctrl+M") + << shortcutMap("Shift+M") + << shortcutMap("Ctrl+Alt+M") + << shortcutMap("+") + << shortcutMap("F1") + << shortcutMap("Shift+F1"); + + QTest::newRow("M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::NoModifier) << "M" << ""; + QTest::newRow("Alt+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::AltModifier) << "Alt+M" << ""; + QTest::newRow("Ctrl+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::ControlModifier) << "Ctrl+M" << ""; + QTest::newRow("Shift+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::ShiftModifier) << "Shift+M" << ""; + QTest::newRow("Ctrl+Alt+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::ControlModifier|Qt::AltModifier) << "Ctrl+Alt+M" << ""; + QTest::newRow("+") << shortcuts << Qt::Key_Plus << Qt::KeyboardModifiers(Qt::NoModifier) << "+" << ""; + QTest::newRow("F1") << shortcuts << Qt::Key_F1 << Qt::KeyboardModifiers(Qt::NoModifier) << "F1" << ""; + QTest::newRow("Shift+F1") << shortcuts << Qt::Key_F1 << Qt::KeyboardModifiers(Qt::ShiftModifier) << "Shift+F1" << ""; + + // ambiguous + shortcuts << shortcutMap("M") + << shortcutMap("Alt+M") + << shortcutMap("Ctrl+M") + << shortcutMap("Shift+M") + << shortcutMap("Ctrl+Alt+M") + << shortcutMap("+") + << shortcutMap("F1") + << shortcutMap("Shift+F1"); + + QTest::newRow("?M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::NoModifier) << "" << "M"; + QTest::newRow("?Alt+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::AltModifier) << "" << "Alt+M"; + QTest::newRow("?Ctrl+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::ControlModifier) << "" << "Ctrl+M"; + QTest::newRow("?Shift+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::ShiftModifier) << "" << "Shift+M"; + QTest::newRow("?Ctrl+Alt+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::ControlModifier|Qt::AltModifier) << "" << "Ctrl+Alt+M"; + QTest::newRow("?+") << shortcuts << Qt::Key_Plus << Qt::KeyboardModifiers(Qt::NoModifier) << "" << "+"; + QTest::newRow("?F1") << shortcuts << Qt::Key_F1 << Qt::KeyboardModifiers(Qt::NoModifier) << "" << "F1"; + QTest::newRow("?Shift+F1") << shortcuts << Qt::Key_F1 << Qt::KeyboardModifiers(Qt::ShiftModifier) << "" << "Shift+F1"; + + // disabled + shortcuts.clear(); + shortcuts << shortcutMap("M", DisabledShortcut) + << shortcutMap("Alt+M", DisabledShortcut) + << shortcutMap("Ctrl+M", DisabledShortcut) + << shortcutMap("Shift+M", DisabledShortcut) + << shortcutMap("Ctrl+Alt+M", DisabledShortcut) + << shortcutMap("+", DisabledShortcut) + << shortcutMap("F1", DisabledShortcut) + << shortcutMap("Shift+F1", DisabledShortcut); + + QTest::newRow("!M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::NoModifier) << "" << ""; + QTest::newRow("!Alt+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::AltModifier) << "" << ""; + QTest::newRow("!Ctrl+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::ControlModifier) << "" << ""; + QTest::newRow("!Shift+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::ShiftModifier) << "" << ""; + QTest::newRow("!Ctrl+Alt+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::ControlModifier|Qt::AltModifier) << "" << ""; + QTest::newRow("!+") << shortcuts << Qt::Key_Plus << Qt::KeyboardModifiers(Qt::NoModifier) << "" << ""; + QTest::newRow("!F1") << shortcuts << Qt::Key_F1 << Qt::KeyboardModifiers(Qt::NoModifier) << "" << ""; + QTest::newRow("!Shift+F1") << shortcuts << Qt::Key_F1 << Qt::KeyboardModifiers(Qt::ShiftModifier) << "" << ""; + + // unambigous because others disabled + shortcuts << shortcutMap("M") + << shortcutMap("Alt+M") + << shortcutMap("Ctrl+M") + << shortcutMap("Shift+M") + << shortcutMap("Ctrl+Alt+M") + << shortcutMap("+") + << shortcutMap("F1") + << shortcutMap("Shift+F1"); + + QTest::newRow("/M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::NoModifier) << "M" << ""; + QTest::newRow("/Alt+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::AltModifier) << "Alt+M" << ""; + QTest::newRow("/Ctrl+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::ControlModifier) << "Ctrl+M" << ""; + QTest::newRow("/Shift+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::ShiftModifier) << "Shift+M" << ""; + QTest::newRow("/Ctrl+Alt+M") << shortcuts << Qt::Key_M << Qt::KeyboardModifiers(Qt::ControlModifier|Qt::AltModifier) << "Ctrl+Alt+M" << ""; + QTest::newRow("/+") << shortcuts << Qt::Key_Plus << Qt::KeyboardModifiers(Qt::NoModifier) << "+" << ""; + QTest::newRow("/F1") << shortcuts << Qt::Key_F1 << Qt::KeyboardModifiers(Qt::NoModifier) << "F1" << ""; + QTest::newRow("/Shift+F1") << shortcuts << Qt::Key_F1 << Qt::KeyboardModifiers(Qt::ShiftModifier) << "Shift+F1" << ""; +} + +void tst_QQuickShortcut::renderControlShortcuts() +{ + QFETCH(QVariantList, shortcuts); + QFETCH(Qt::Key, key); + QFETCH(Qt::KeyboardModifiers, modifiers); + QFETCH(QString, activatedShortcut); + QFETCH(QString, ambiguousShortcut); + + QScopedPointer<QQuickWidget> quickWidget(new QQuickWidget); + quickWidget->resize(300,300); + + QSignalSpy spy(qApp, &QGuiApplication::focusObjectChanged); + + quickWidget->setSource(testFileUrl("shortcutsRect.qml")); + quickWidget->show(); + + spy.wait(); + + QVERIFY(qobject_cast<QQuickWidget*>(qApp->focusObject()) == quickWidget.data()); + + QQuickItem* item = quickWidget->rootObject(); + item->setProperty("shortcuts", shortcuts); + QTest::keyPress(quickWidget->quickWindow(), key, modifiers, 1500); + QCOMPARE(item->property("activatedShortcut").toString(), activatedShortcut); + QCOMPARE(item->property("ambiguousShortcut").toString(), ambiguousShortcut); +} +#endif // QT_QUICKWIDGETS_LIB + QTEST_MAIN(tst_QQuickShortcut) #include "tst_qquickshortcut.moc" diff --git a/tests/auto/quick/touchmouse/BLACKLIST b/tests/auto/quick/touchmouse/BLACKLIST index ac0352d10b..e0d4bff131 100644 --- a/tests/auto/quick/touchmouse/BLACKLIST +++ b/tests/auto/quick/touchmouse/BLACKLIST @@ -1,3 +1,5 @@ # QTBUG-40856 hover regression on pointerhandler branch: TODO fix before merging to dev [hoverEnabled] * +[buttonOnDelayedPressFlickable] +windows gcc developer-build |