diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-10-23 10:48:04 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-10-24 06:05:30 +0200 |
commit | 17c50b309ba2c74dc89532db03f9659aca422554 (patch) | |
tree | 6404500f500166b56abed9aaccec0dca9133f45e /src/quicktestutils/quick/viewtestutils.cpp | |
parent | a7c85e8048de8dbe7f4a899a77cc450e0d8c5e8f (diff) | |
download | qtdeclarative-17c50b309ba2c74dc89532db03f9659aca422554.tar.gz |
QQuickTest::initView: set minimum window width and height if unset
When writing a new test, it's easy to forget to set the root item's
width and height, and that's ok on any desktop platform: the QPA plugin
or the window system will give it a reasonable minimum size anyway
(100x100 or so). But on some embedded platforms the minimum window
size is much smaller, such as 1x1; and then we can end up with CI
failures that take too long to troubleshoot. So if width or height
is not set (and thus 0), set it to 100.
Fixes: QTBUG-107865
Change-Id: If6c300d6ff43e3ba8d9142c550579ef7d58d87fb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktestutils/quick/viewtestutils.cpp')
-rw-r--r-- | src/quicktestutils/quick/viewtestutils.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/quicktestutils/quick/viewtestutils.cpp b/src/quicktestutils/quick/viewtestutils.cpp index 19e29928bb..e8e5847548 100644 --- a/src/quicktestutils/quick/viewtestutils.cpp +++ b/src/quicktestutils/quick/viewtestutils.cpp @@ -475,6 +475,10 @@ namespace QQuickTest { } const QRect screenGeometry = view.screen()->availableGeometry(); const QSize size = view.size(); + if (view.width() == 0) + view.setWidth(100); + if (view.height() == 0) + view.setHeight(100); const QPoint offset = QPoint(size.width() / 2, size.height() / 2); view.setFramePosition(screenGeometry.center() - offset); #if QT_CONFIG(cursor) // Get the cursor out of the way. |