qt6-bb10/tests/auto/widgets
Gatis Paeglis 2f2bfc4e59 widgets: fix QWidget::save/restoreGeometry()
QWidget::restoreGeometry() is calling QWidget::move() with restoredFrameGeometry,
which internally calls setGeometry() and sets positionPolicy = QWindowPrivate::WindowFrameExclusive,
which is invalid: restoredFrameGeometry is WindowFrameInclusive geometry.
QPA plugins rely on correctly set policies when interpreting x,y. QWidget::move()
was not designed for this AFAICT, so making it to accept frame geometry is
no-op. It is widely used legacy code, changing it could cause regressions.

Save/restore API was introduced in Qt 4.2, at that time we did not have APIs
like QWindow::setFramePosition(), so its unclear why geometry() was not stored
instead. The documentation also is somewhat unclear:

"[..] save the geometry when the window closes [..]"

Frame or client geometry? It does not specify. And from the code we see
that frame geometry was passed as client geometry, not making the original
intention clearer. Besides that, restoreGeometry() is full of other undocumented
assumptions where to place windows and when to fail (fortunately its easy
to write your own save/restore logic). Added a Qt 6 note in the source code.

What this patch changes:

Now we store geometry() in saveGeometry() and use that value in restoreGeometry()
by setGeometry(). This does not cause any behavior difference in window
positioning (tst_QWidget::saveRestoreGeometry still works). Geometry restored
from data saved with earlier versions of saveGeometry() might be positioned at:
x + leftMargin, y + topMargin.

This patch makes tst_QWidget::saveRestoreGeometry to always fail instead
of being flaky. Blacklisting for XCB instead of selected distros.

Also enabled excluded code paths for XCB on tst_QDockWidget::restoreDockWidget().
It does not seem to be flaky, maybe it was in 2015, but lot of things have changed
since then.

Task-number: QTBUG-66708
Change-Id: Ic86a6fd091e2c71b7550b2f476386da704253cd4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2018-06-25 13:41:06 +00:00
..
dialogs winrt: make dialog auto tests pass 2018-06-22 05:02:43 +00:00
effects tst_QGraphicsEffect: Allow multiple paint events in itemHasNoContents() 2018-05-21 06:05:15 +00:00
graphicsview Merge remote-tracking branch 'origin/5.11' into dev 2018-06-07 19:10:53 +02:00
itemviews QListView: do not delete item on internal move 2018-06-22 20:05:11 +00:00
kernel widgets: fix QWidget::save/restoreGeometry() 2018-06-25 13:41:06 +00:00
styles winrt: Make widgets/styles auto tests pass 2018-05-25 11:02:21 +00:00
util winrt: Make widgets/util auto tests pass 2018-05-25 11:02:23 +00:00
widgets widgets: fix QWidget::save/restoreGeometry() 2018-06-25 13:41:06 +00:00
widgets.pro Move QGestureRecognizer test to widgets/kernel 2017-06-02 18:36:11 +00:00