diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-12-10 01:01:06 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-12-10 01:01:06 +0100 |
commit | 9dee7b331c4139cadd649da3e90a716447da4134 (patch) | |
tree | b3091c9e33c92b4a41dc6d4515ec541d81a0de76 /tests/auto/quick/qquicktableview | |
parent | b753d40f67e20031a307d0fe016d63e3a1463f14 (diff) | |
parent | 7f0faddfed02707f49ab9af33e55518f17c56420 (diff) |
Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Iadbdd0fb63ca2a9e0b186343f8b730e4114cd71b
Diffstat (limited to 'tests/auto/quick/qquicktableview')
-rw-r--r-- | tests/auto/quick/qquicktableview/data/replaceModelTableView.qml | 23 | ||||
-rw-r--r-- | tests/auto/quick/qquicktableview/tst_qquicktableview.cpp | 24 |
2 files changed, 24 insertions, 23 deletions
diff --git a/tests/auto/quick/qquicktableview/data/replaceModelTableView.qml b/tests/auto/quick/qquicktableview/data/replaceModelTableView.qml index 2b17e055a7..cc109bb469 100644 --- a/tests/auto/quick/qquicktableview/data/replaceModelTableView.qml +++ b/tests/auto/quick/qquicktableview/data/replaceModelTableView.qml @@ -8,12 +8,15 @@ Item { height: 480 property alias tableView: tv + property alias objectModel: om + property alias listModel: lm + property alias delegateModel: dm ObjectModel { id: om - Rectangle { height: 30; width: 80; color: "red" } - Rectangle { height: 30; width: 80; color: "green" } - Rectangle { height: 30; width: 80; color: "blue" } + Rectangle { implicitHeight: 30; implicitWidth: 80; color: "red" } + Rectangle { implicitHeight: 30; implicitWidth: 80; color: "green" } + Rectangle { implicitHeight: 30; implicitWidth: 80; color: "blue" } } ListModel { @@ -29,8 +32,8 @@ Item { ListElement { name: "Orange" } } delegate: Rectangle { - height: 25 - width: 100 + implicitHeight: 25 + implicitWidth: 100 Text { text: "Name: " + name} } } @@ -38,16 +41,6 @@ Item { id: tv visible: true anchors.fill: parent - property int modelId: 0 - - model: { - switch (modelId) { - case 0: return lm; - case 1: return om; - case 2: return dm; - default: return null; - } - } delegate: Rectangle { id: dlg diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp index 10004bb775..ef39a91a65 100644 --- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp +++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp @@ -394,7 +394,7 @@ void tst_QQuickTableView::checkColumnWidthProviderInvalidReturnValues() tableView->setModel(model); - QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*implicitHeight.*zero")); + QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*implicit.*zero")); WAIT_UNTIL_POLISHED; @@ -491,7 +491,7 @@ void tst_QQuickTableView::checkRowHeightProviderInvalidReturnValues() tableView->setModel(model); - QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*implicitHeight.*zero")); + QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*implicit.*zero")); WAIT_UNTIL_POLISHED; @@ -2750,14 +2750,22 @@ void tst_QQuickTableView::replaceModel() { LOAD_TABLEVIEW("replaceModelTableView.qml"); - tableView->setProperty("modelId", 0); + const auto objectModel = view->rootObject()->property("objectModel"); + const auto listModel = view->rootObject()->property("listModel"); + const auto delegateModel = view->rootObject()->property("delegateModel"); + + tableView->setModel(listModel); QTRY_COMPARE(tableView->rows(), 2); - tableView->setProperty("modelId", 1); - QTRY_COMPARE(tableView->rows(), 0); - tableView->setProperty("modelId", 2); - QTRY_COMPARE(tableView->rows(), 0); - tableView->setProperty("modelId", 0); + tableView->setModel(objectModel); + QTRY_COMPARE(tableView->rows(), 3); + tableView->setModel(delegateModel); QTRY_COMPARE(tableView->rows(), 2); + tableView->setModel(listModel); + QTRY_COMPARE(tableView->rows(), 2); + tableView->setModel(QVariant()); + QTRY_COMPARE(tableView->rows(), 0); + QCOMPARE(tableView->contentWidth(), 0); + QCOMPARE(tableView->contentHeight(), 0); } QTEST_MAIN(tst_QQuickTableView) |