aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicktableview
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-12-10 01:01:06 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-12-10 01:01:06 +0100
commit9dee7b331c4139cadd649da3e90a716447da4134 (patch)
treeb3091c9e33c92b4a41dc6d4515ec541d81a0de76 /tests/auto/quick/qquicktableview
parentb753d40f67e20031a307d0fe016d63e3a1463f14 (diff)
parent7f0faddfed02707f49ab9af33e55518f17c56420 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Diffstat (limited to 'tests/auto/quick/qquicktableview')
-rw-r--r--tests/auto/quick/qquicktableview/data/replaceModelTableView.qml23
-rw-r--r--tests/auto/quick/qquicktableview/tst_qquicktableview.cpp24
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)