aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktestutils/quick/viewtestutils.cpp
diff options
context:
space:
mode:
authorFrédéric Lefebvre <frederic.lefebvre@qt.io>2025-01-13 15:30:14 +0100
committerFrederic Lefebvre <frederic.lefebvre@qt.io>2025-02-13 05:20:41 +0000
commit9e9ed403d92b86c00ab9022ee6f7a4f88be72237 (patch)
tree62f1038b18ec5a1c774c640cd789708c92a08b73 /src/quicktestutils/quick/viewtestutils.cpp
parenta9ee1b105741acbf85a9cb683aa38c52613efba3 (diff)
Check if showView uses updated position
ShowView sets a position to a qquickview. The position takes some time to be updated. In some cases a race condition can happen on Opensuse and the un-updated position is used. Check if the qquickview has a frame. If it does not have one, return true. If it has a frame, verify that its position is correct. Check if the starting framePosition and ending position of the qquickview are the same. Use qWaitFor to check if the position updated. Return false if it haven't. If the qquickview does not have a frame, the position check is not reached. Fixes: QTBUG-133341 Fixes: QTBUG-132648 Fixes: QTBUG-132630 Fixes: QTBUG-133342 Fixes: QTBUG-133343 Fixes: QTBUG-132941 Fixes: QTBUG-133344 Pick-to: 6.9 6.8 6.5 Task-number: QTBUG-133340 Change-Id: I866a9d2bd2499cafcbfa4ccd53a770846590a7bd Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Diffstat (limited to 'src/quicktestutils/quick/viewtestutils.cpp')
-rw-r--r--src/quicktestutils/quick/viewtestutils.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/quicktestutils/quick/viewtestutils.cpp b/src/quicktestutils/quick/viewtestutils.cpp
index 6deef8435f..50f4405828 100644
--- a/src/quicktestutils/quick/viewtestutils.cpp
+++ b/src/quicktestutils/quick/viewtestutils.cpp
@@ -490,6 +490,7 @@ namespace QQuickTest {
qCritical() << errorMessage;
return false;
}
+ const QPoint framePos(view.framePosition());
view.show();
if (!QTest::qWaitForWindowExposed(&view)) {
qCritical() << "qWaitForWindowExposed() failed";
@@ -502,6 +503,13 @@ namespace QQuickTest {
qCritical() << qPrintable(error.toString());
return false;
}
+ if (view.flags().testFlag(Qt::FramelessWindowHint))
+ return true;
+ const bool positionOk = QTest::qWaitFor([&]{ return framePos != view.position(); });
+ if (!positionOk) {
+ qCritical() << "Position failed to update";
+ return false;
+ }
return true;
}