path: root/tests/auto
diff options
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-03-30 13:49:02 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-03-30 18:25:09 +0200
commit25532ae18f25f2c415efc0f2ee9a67e16c39813b (patch)
tree650894424dfa5227ff0affdb2a28299ce2dc6c8c /tests/auto
parentfe3b3c707e2bc41f2e98d315ba72f50d4929e064 (diff)
tst_qquickheaderview: wait for window to be active
The tst_QQuickHeaderView::listModel test fails on Ubuntu. From inspecting the build log, VerticalHeaderView has an empty size. Since HeaderView will only load items that end up visible in the view, it will load just one item in this case, even if the model contains five. Hence the test will fail when searching for the other missing items. Why VerticalTableView has an empty size is not well understood (and cannot be reproduced on my mac). The size is bound to the size of the window, which indicates that the window is not shown or ready by the time the test runs. So this patch will change how we create the window for the test, and wait for it to be active, which is standard procedure for many other tests. Hopefully this will also fix the test failure on Ubuntu. Task-number: QTBUG-83172 Change-Id: I7d3a188dbeb161f11eee7b95c103928404161f11 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto')
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/qquickheaderview/tst_qquickheaderview.cpp b/tests/auto/qquickheaderview/tst_qquickheaderview.cpp
index 64f769e8..611e39cb 100644
--- a/tests/auto/qquickheaderview/tst_qquickheaderview.cpp
+++ b/tests/auto/qquickheaderview/tst_qquickheaderview.cpp
@@ -359,6 +359,9 @@ void tst_QQuickHeaderView::listModel()
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");
auto vhv = root->findChild<QQuickVerticalHeaderView *>("verticalHeader");