diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-31 03:03:15 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-31 03:03:15 +0200 |
commit | 6d624d878ddedaf27bcd57c7ce1b66828d6d3b02 (patch) | |
tree | ca5e5d812b99e51f752ee3a42be3cd135a75c731 /tests/auto/qquickheaderview/tst_qquickheaderview.cpp | |
parent | 5579140836afeb9274a4061dd309829d6b1b7610 (diff) | |
parent | 25532ae18f25f2c415efc0f2ee9a67e16c39813b (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ie09cfdd17b00e56f3ba8677d25b24417dd4e42f6
Diffstat (limited to 'tests/auto/qquickheaderview/tst_qquickheaderview.cpp')
-rw-r--r-- | tests/auto/qquickheaderview/tst_qquickheaderview.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/qquickheaderview/tst_qquickheaderview.cpp b/tests/auto/qquickheaderview/tst_qquickheaderview.cpp index 5ce5439d..611e39cb 100644 --- a/tests/auto/qquickheaderview/tst_qquickheaderview.cpp +++ b/tests/auto/qquickheaderview/tst_qquickheaderview.cpp @@ -42,6 +42,7 @@ #include <QAbstractItemModelTester> #include <QtQml/QQmlEngine> #include <QtQuick/private/qquickwindow_p.h> +#include <QtQuick/private/qquicktext_p.h> #include <QtQuickTemplates2/private/qquickapplicationwindow_p.h> #include <QtQuickTemplates2/private/qquickheaderview_p.h> #include <private/qquickheaderview_p_p.h> @@ -218,6 +219,7 @@ private slots: void testHeaderDataProxyModel(); void testOrientation(); void testModel(); + void listModel(); private: QQmlEngine *engine; @@ -349,6 +351,41 @@ void tst_QQuickHeaderView::testModel() QCOMPARE(modelChangedSpy.count(), 2); } +void tst_QQuickHeaderView::listModel() +{ + QQmlComponent component(engine); + component.loadUrl(testFileUrl("ListModel.qml")); + + QScopedPointer<QObject> root(component.create()); + QVERIFY2(root, qPrintable(component.errorString())); + + if (!QTest::qWaitForWindowActive(qobject_cast<QWindow *>(root.data()))) + QSKIP("Window failed to become active!"); + + auto hhv = root->findChild<QQuickHorizontalHeaderView *>("horizontalHeader"); + QVERIFY(hhv); + auto vhv = root->findChild<QQuickVerticalHeaderView *>("verticalHeader"); + QVERIFY(vhv); + + auto hhvCell1 = hhv->childAt(0, 0)->childAt(0, 0)->findChild<QQuickText *>(); + QVERIFY(hhvCell1); + QCOMPARE(hhvCell1->property("text"), "AAA"); + + auto hhvCell2 = hhv->childAt(hhvCell1->width() + 5, 0)-> + childAt(hhvCell1->width() + 5, 0)->findChild<QQuickText *>(); + QVERIFY(hhvCell2); + QCOMPARE(hhvCell2->property("text"), "BBB"); + + auto vhvCell1 = vhv->childAt(0, 0)->childAt(0, 0)->findChild<QQuickText *>(); + QVERIFY(vhvCell1); + QCOMPARE(vhvCell1->property("text"), "111"); + + auto vhvCell2 = vhv->childAt(0, vhvCell1->height() + 5)-> + childAt(0, vhvCell1->height() + 5)->findChild<QQuickText *>(); + QVERIFY(vhvCell2); + QCOMPARE(vhvCell2->property("text"), "222"); +} + QTEST_MAIN(tst_QQuickHeaderView) #include "tst_qquickheaderview.moc" |