diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-11-21 10:34:41 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-11-21 10:34:41 +0100 |
commit | c08ec43406c4ebe2e93942a8b07871c73aafde51 (patch) | |
tree | 69e84f955ce6d0f66d39eae36b07ae0f8ef65e56 /tests/auto | |
parent | 242067390f3bd891b162164a2d01a3a982c64fa2 (diff) | |
parent | 5b82c1b7abc515274e6348136356bbf8f1374e4a (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I3567f741394f912d4312460e85555b6c39b61cb4
Diffstat (limited to 'tests/auto')
3 files changed, 71 insertions, 1 deletions
diff --git a/tests/auto/quick/qquicklistview/data/snapOneItemCurrentIndexRemoveAnimation.qml b/tests/auto/quick/qquicklistview/data/snapOneItemCurrentIndexRemoveAnimation.qml new file mode 100644 index 0000000000..215467f0cc --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/snapOneItemCurrentIndexRemoveAnimation.qml @@ -0,0 +1,39 @@ +import QtQuick 2.4 + +ListView { + id: root + height: 400 + width: height + model: ListModel { + id: lmodel + ListElement { dummy: 0 } + ListElement { dummy: 0 } + ListElement { dummy: 0 } + ListElement { dummy: 0 } + ListElement { dummy: 0 } + ListElement { dummy: 0 } + } + + function removeItemZero() + { + lmodel.remove(0); + } + + orientation: ListView.Horizontal + snapMode: ListView.SnapOneItem + highlightRangeMode: ListView.StrictlyEnforceRange + + property int transitionsRun: 0 + + removeDisplaced: Transition { + id: transition + PropertyAnimation { property: "x"; duration: 500 } + onRunningChanged: if (!running) transitionsRun++; + } + + delegate: Text { + text: index + " of " + lmodel.count + width: root.width + height: root.height + } +}
\ No newline at end of file diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index e02c053208..a5de266636 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -182,6 +182,7 @@ private slots: void snapOneItemResize_QTBUG_43555(); void snapOneItem_data(); void snapOneItem(); + void snapOneItemCurrentIndexRemoveAnimation(); void QTBUG_9791(); void QTBUG_11105(); @@ -5587,6 +5588,32 @@ void tst_QQuickListView::snapOneItem() releaseView(window); } +void tst_QQuickListView::snapOneItemCurrentIndexRemoveAnimation() +{ + QQuickView *window = createView(); + + window->setSource(testFileUrl("snapOneItemCurrentIndexRemoveAnimation.qml")); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); + + QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); + QTRY_VERIFY(listview != 0); + + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); + QTRY_COMPARE(listview->currentIndex(), 0); + QSignalSpy currentIndexSpy(listview, SIGNAL(currentIndexChanged())); + + QMetaObject::invokeMethod(window->rootObject(), "removeItemZero"); + QTRY_COMPARE(listview->property("transitionsRun").toInt(), 1); + + QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); + + QCOMPARE(listview->currentIndex(), 0); + QCOMPARE(currentIndexSpy.count(), 0); + + delete window; +} + void tst_QQuickListView::attachedProperties_QTBUG_32836() { QQuickView *window = createView(); diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp index 7cc5dfa7c6..79ff18011d 100644 --- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp +++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp @@ -75,8 +75,12 @@ void tst_qquickwidget::showHide() window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window, 5000)); + QVERIFY(childView->quickWindow()->isVisible()); + QVERIFY(childView->quickWindow()->visibility() != QWindow::Hidden); - childView->hide(); + window.hide(); + QVERIFY(!childView->quickWindow()->isVisible()); + QCOMPARE(childView->quickWindow()->visibility(), QWindow::Hidden); } void tst_qquickwidget::reparentAfterShow() |