diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-01-22 15:20:47 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-01-22 15:21:06 +0100 |
commit | f286db98ee41a8aa71b9a65a235b6d3e265d79f4 (patch) | |
tree | 16e17d4c52d35f7e55fc2103db5c96850e9bdfff /tests | |
parent | ce093497f2d4164fa8abc06cf976f9e36798e11e (diff) | |
parent | b60a5dc9405ce89d7a742abc81b906d5c8cf5f7d (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I4af0bf8ec1569097d97f8ce0bb8bf1a0e4a989ec
Diffstat (limited to 'tests')
9 files changed, 309 insertions, 12 deletions
diff --git a/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp index 8bf1feea7e..ee417bb480 100644 --- a/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp +++ b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp @@ -109,6 +109,7 @@ void tst_qmlplugindump::singleton() const QString &result = dumper.readAllStandardOutput(); QVERIFY(result.contains(QLatin1String("exports: [\"Singleton 1.0\"]"))); + QVERIFY(result.contains(QLatin1String("exportMetaObjectRevisions: [0]"))); } QTEST_MAIN(tst_qmlplugindump) diff --git a/tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml b/tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml new file mode 100644 index 0000000000..5d2e867da4 --- /dev/null +++ b/tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Ford Motor Company +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtTest 1.1 +import QtQml.StateMachine 1.0 + +TestCase { + id: testCase + + property string mystr + property bool mybool + property int myint + + StateMachine { + id: machine + initialState: startState + running: true + State { + id: startState + SignalTransition { + id: signalTrans + signal: testCase.mysignal + onTriggered: { + testCase.mystr = mystr + testCase.mybool = mybool + testCase.myint = myint + } + targetState: finalState + } + } + FinalState { + id: finalState + } + } + + signal mysignal(string mystr, bool mybool, int myint) + + name: "testTriggeredArguments1" + function test_triggeredArguments() + { + tryCompare(startState, "active", true) + + // Emit the signalTrans.signal + testCase.mysignal("test1", true, 2) + compare(testCase.mystr, "test1") + compare(testCase.mybool, true) + compare(testCase.myint, 2) + } +} diff --git a/tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml b/tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml new file mode 100644 index 0000000000..f60f2ff78c --- /dev/null +++ b/tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Ford Motor Company +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtTest 1.1 +import QtQml.StateMachine 1.0 + +TestCase { + id: testCase + + property string mystr + property bool mybool + property int myint + + StateMachine { + id: machine + initialState: startState + running: true + State { + id: startState + SignalTransition { + id: signalTrans + signal: testCase.mysignal + onTriggered: function(strarg, boolarg, intarg) { + testCase.mystr = strarg + testCase.mybool = boolarg + testCase.myint = intarg + } + targetState: finalState + } + } + FinalState { + id: finalState + } + } + + signal mysignal(string mystr, bool mybool, int myint) + + name: "testTriggeredArguments2" + function test_triggeredArguments() + { + tryCompare(startState, "active", true) + + // Emit the signalTrans.signal + testCase.mysignal("test1", true, 2) + expectFail("", "QTBUG-50328") + compare(testCase.mystr, "test1") + compare(testCase.mybool, true) + compare(testCase.myint, 2) + } +} diff --git a/tests/auto/quick/qquickitem2/data/qtbug_50516.qml b/tests/auto/quick/qquickitem2/data/qtbug_50516.qml new file mode 100644 index 0000000000..5e2a60b26f --- /dev/null +++ b/tests/auto/quick/qquickitem2/data/qtbug_50516.qml @@ -0,0 +1,9 @@ +import QtQuick 2.1 +import Test 1.0 + +TabFence { + objectName: "root" + focus: true + width: 800 + height: 600 +} diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index 34209ee610..607dbccaed 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -69,6 +69,7 @@ private slots: void nextItemInFocusChain3(); void tabFence(); + void qtbug_50516(); void keys(); void standardKeys_data(); @@ -1190,6 +1191,27 @@ void tst_QQuickItem::tabFence() verifyTabFocusChain(window, fence1BacktabFocusChain, false /* forward */); } +void tst_QQuickItem::qtbug_50516() +{ + QQuickView *window = new QQuickView(0); + window->setBaseSize(QSize(800,600)); + + window->setSource(testFileUrl("qtbug_50516.qml")); + window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); + QVERIFY(QGuiApplication::focusWindow() == window); + QVERIFY(window->rootObject()->hasActiveFocus()); + + QQuickItem *contentItem = window->rootObject(); + QQuickItem *next = contentItem->nextItemInFocusChain(true); + QCOMPARE(next, contentItem); + next = contentItem->nextItemInFocusChain(false); + QCOMPARE(next, contentItem); + + delete window; +} + void tst_QQuickItem::keys() { QQuickView *window = new QQuickView(0); diff --git a/tests/auto/quick/qquicklistview/data/qtbug50097.qml b/tests/auto/quick/qquicklistview/data/qtbug50097.qml new file mode 100644 index 0000000000..24d506b804 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/qtbug50097.qml @@ -0,0 +1,47 @@ +import QtQuick 2.6 + +ListView { + id: lv + + // How many rows per page + property int pageSize: 5 + + // The current page number + property int currentPage: 1 + + // How large a single item is + property int itemSize: 100 + + // Arbitrary + property int totalPages: 5 + + height: itemSize * pageSize // display one full page at a time + width: 500 // arbitrary. + model: pageSize * totalPages + delegate: Text { + height: itemSize + text: "Item " + (index + 1) + " of " + lv.count + } + + // contentY should be < 0 to account for header visibility + onContentYChanged: console.log(contentY) + + headerPositioning: ListView.OverlayHeader + header: Rectangle { + height: itemSize + width: 500 + z: 1000 + visible: false + color: "black" + + Text { + anchors.centerIn: parent + color: "red" + text: "List header" + } + } + + onCurrentPageChanged: { + lv.positionViewAtIndex((currentPage - 1) * pageSize, ListView.Beginning); + } +} diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 8f0e1a3651..1e3d1d95b3 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -249,6 +249,7 @@ private slots: void QTBUG_50105(); void keyNavigationEnabled(); + void QTBUG_50097_stickyHeader_positionViewAtIndex(); private: template <class T> void items(const QUrl &source); @@ -7476,7 +7477,7 @@ void tst_QQuickListView::stickyPositioning() QFETCH(QPointF, headerPos); QFETCH(QPointF, footerPos); - QQuickView *window = createView(); + QQuickView *window = getView(); QaimModel model; for (int i = 0; i < 20; i++) @@ -7519,7 +7520,7 @@ void tst_QQuickListView::stickyPositioning() QCOMPARE(actualPos, footerPos); } - delete window; + releaseView(window); } void tst_QQuickListView::stickyPositioning_data() @@ -7546,7 +7547,7 @@ void tst_QQuickListView::stickyPositioning_data() QTest::newRow("top header") << "stickyPositioning-header.qml" << Qt::Vertical << Qt::LeftToRight << QQuickListView::TopToBottom << 0 << QQuickItemView::Beginning << QList<QPointF>() - << QPointF(0,-10) << QPointF(); + << QPointF(0,0) << QPointF(); QTest::newRow("top header: 1/2 up") << "stickyPositioning-header.qml" << Qt::Vertical << Qt::LeftToRight << QQuickListView::TopToBottom @@ -7573,7 +7574,7 @@ void tst_QQuickListView::stickyPositioning_data() QTest::newRow("top footer") << "stickyPositioning-footer.qml" << Qt::Vertical << Qt::LeftToRight << QQuickListView::BottomToTop << 19 << QQuickItemView::End << QList<QPointF>() - << QPointF() << QPointF(0,-10); + << QPointF() << QPointF(0,0); QTest::newRow("top footer: 1/2 up") << "stickyPositioning-footer.qml" << Qt::Vertical << Qt::LeftToRight << QQuickListView::BottomToTop @@ -7600,7 +7601,7 @@ void tst_QQuickListView::stickyPositioning_data() QTest::newRow("bottom header") << "stickyPositioning-header.qml" << Qt::Vertical << Qt::LeftToRight << QQuickListView::BottomToTop << 0 << QQuickItemView::Beginning << QList<QPointF>() - << QPointF(0,100) << QPointF(); + << QPointF(0,90) << QPointF(); QTest::newRow("bottom header: 1/2 down") << "stickyPositioning-header.qml" << Qt::Vertical << Qt::LeftToRight << QQuickListView::BottomToTop @@ -7627,7 +7628,7 @@ void tst_QQuickListView::stickyPositioning_data() QTest::newRow("bottom footer") << "stickyPositioning-footer.qml" << Qt::Vertical << Qt::LeftToRight << QQuickListView::TopToBottom << 19 << QQuickItemView::End << QList<QPointF>() - << QPointF() << QPointF(0,100); + << QPointF() << QPointF(0,90); QTest::newRow("bottom footer: 1/2 down") << "stickyPositioning-footer.qml" << Qt::Vertical << Qt::LeftToRight << QQuickListView::TopToBottom @@ -7654,7 +7655,7 @@ void tst_QQuickListView::stickyPositioning_data() QTest::newRow("top header & bottom footer") << "stickyPositioning-both.qml" << Qt::Vertical << Qt::LeftToRight << QQuickListView::TopToBottom << 0 << QQuickItemView::Beginning << QList<QPointF>() - << QPointF(0,-10) << QPointF(0,90); + << QPointF(0,0) << QPointF(0,100); QTest::newRow("top header & bottom footer: 1/2 up") << "stickyPositioning-both.qml" << Qt::Vertical << Qt::LeftToRight << QQuickListView::TopToBottom @@ -7707,7 +7708,7 @@ void tst_QQuickListView::stickyPositioning_data() QTest::newRow("left header") << "stickyPositioning-header.qml" << Qt::Horizontal << Qt::LeftToRight << QQuickListView::TopToBottom << 0 << QQuickItemView::Beginning << QList<QPointF>() - << QPointF(-10,0) << QPointF(); + << QPointF(0,0) << QPointF(); QTest::newRow("left header: 1/2 left") << "stickyPositioning-header.qml" << Qt::Horizontal << Qt::LeftToRight << QQuickListView::TopToBottom @@ -7734,7 +7735,7 @@ void tst_QQuickListView::stickyPositioning_data() QTest::newRow("left footer") << "stickyPositioning-footer.qml" << Qt::Horizontal << Qt::RightToLeft << QQuickListView::TopToBottom << 19 << QQuickItemView::End << QList<QPointF>() - << QPointF() << QPointF(-10,0); + << QPointF() << QPointF(0,0); QTest::newRow("left footer: 1/2 left") << "stickyPositioning-footer.qml" << Qt::Horizontal << Qt::RightToLeft << QQuickListView::TopToBottom @@ -7761,7 +7762,7 @@ void tst_QQuickListView::stickyPositioning_data() QTest::newRow("right header") << "stickyPositioning-header.qml" << Qt::Horizontal << Qt::RightToLeft << QQuickListView::TopToBottom << 0 << QQuickItemView::Beginning << QList<QPointF>() - << QPointF(100,0) << QPointF(); + << QPointF(90,0) << QPointF(); QTest::newRow("right header: 1/2 right") << "stickyPositioning-header.qml" << Qt::Horizontal << Qt::RightToLeft << QQuickListView::TopToBottom @@ -7788,7 +7789,7 @@ void tst_QQuickListView::stickyPositioning_data() QTest::newRow("right footer") << "stickyPositioning-footer.qml" << Qt::Horizontal << Qt::LeftToRight << QQuickListView::TopToBottom << 19 << QQuickItemView::End << QList<QPointF>() - << QPointF() << QPointF(100,0); + << QPointF() << QPointF(90,0); QTest::newRow("right footer: 1/2 right") << "stickyPositioning-footer.qml" << Qt::Horizontal << Qt::LeftToRight << QQuickListView::TopToBottom @@ -7815,7 +7816,7 @@ void tst_QQuickListView::stickyPositioning_data() QTest::newRow("left header & right footer") << "stickyPositioning-both.qml" << Qt::Horizontal << Qt::LeftToRight << QQuickListView::TopToBottom << 0 << QQuickItemView::Beginning << QList<QPointF>() - << QPointF(-10,0) << QPointF(90,0); + << QPointF(0,0) << QPointF(100,0); QTest::newRow("left header & right footer: 1/2 left") << "stickyPositioning-both.qml" << Qt::Horizontal << Qt::LeftToRight << QQuickListView::TopToBottom @@ -8513,6 +8514,22 @@ void tst_QQuickListView::QTBUG_50105() QVERIFY(QTest::qWaitForWindowExposed(window.data())); } +void tst_QQuickListView::QTBUG_50097_stickyHeader_positionViewAtIndex() +{ + QQuickView *window = createView(); + window->setSource(testFileUrl("qtbug50097.qml")); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); + + QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); + QVERIFY(listview != 0); + QTRY_COMPARE(listview->contentY(), -100.0); // the header size, since the header is overlaid + listview->setProperty("currentPage", 2); + QTRY_COMPARE(listview->contentY(), 400.0); // a full page of items down, sans the original negative header position + listview->setProperty("currentPage", 1); + QTRY_COMPARE(listview->contentY(), -100.0); // back to the same position: header visible, items not under the header. +} + QTEST_MAIN(tst_QQuickListView) #include "tst_qquicklistview.moc" diff --git a/tests/auto/quick/qquickmousearea/data/qtbug49100.qml b/tests/auto/quick/qquickmousearea/data/qtbug49100.qml new file mode 100644 index 0000000000..39b293c8fa --- /dev/null +++ b/tests/auto/quick/qquickmousearea/data/qtbug49100.qml @@ -0,0 +1,29 @@ +import QtQuick 2.2 + +ListView { + id: list + width: 200 + height: 200 + model: 50 + delegate: Text { + text: index + 1 + height: 30 + width: parent.width + MouseArea { + anchors.fill: parent + } + Rectangle { + anchors.fill: parent + opacity: 0.5 + MouseArea { + anchors.fill: parent + propagateComposedEvents: true + onReleased: { + list.currentIndex = 0; + list.positionViewAtIndex(list.currentIndex, ListView.Contain) + } + } + } + } + Component.onCompleted: list.positionViewAtIndex(40, ListView.Beginning) +} diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index d97d43abfc..d2994ca0b4 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -1144,6 +1144,19 @@ void tst_QQuickMouseArea::clickThrough() QCOMPARE(window->rootObject()->property("clicksEnabled").toInt(), 2); QCOMPARE(window->rootObject()->property("clicksDisabled").toInt(), 1); //disabled, shouldn't increment + + window.reset(new QQuickView); + + //QTBUG-49100 + QVERIFY2(initView(*window.data(), testFileUrl("qtbug49100.qml"), true, &errorMessage), errorMessage.constData()); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); + QVERIFY(window->rootObject() != 0); + + QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + + QVERIFY(window->rootObject() != 0); } void tst_QQuickMouseArea::hoverPosition() |