diff options
author | Nils Jeisecke <jeisecke@saltation.de> | 2013-07-26 17:51:42 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-30 17:24:15 +0200 |
commit | cf3e435299ef2705fb217279bb5e93847cfc7d8c (patch) | |
tree | dde9b3eb3ee4a8262f325df25836a128bc5c09c9 /tests/auto/gui | |
parent | 5d192deed9ef7289e44cd936576d98b3afa2601a (diff) |
Cocoa: Make sure that resizeEvent is invoked after calling resize
The QWindow::resizeEvent documentation states that resizeEvent
is invoked after the windowing system has acknowledged a
setGeometry() or resize() request.
The Cocoa plugin however did set the platform window geometry
immediately so that the qnsview's updateGeometry returned too
early.
Task-number: QTBUG-32706
Change-Id: I1f359ab368833d174ab6740f4467b0848c290f13
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r-- | tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index b4208949b0..7ad7880330 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -59,6 +59,7 @@ class tst_QWindow: public QObject private slots: void eventOrderOnShow(); + void resizeEventAfterResize(); void mapGlobal(); void positioning(); void isExposed(); @@ -168,6 +169,25 @@ void tst_QWindow::eventOrderOnShow() QVERIFY(window.eventIndex(QEvent::Resize) < window.eventIndex(QEvent::Expose)); } +void tst_QWindow::resizeEventAfterResize() +{ + // Some platforms enforce minimum widths for windows, which can cause extra resize + // events, so set the width to suitably large value to avoid those. + QRect geometry(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(20, 20), QSize(300, 40)); + + Window window; + window.setGeometry(geometry); + window.show(); + + QTRY_COMPARE(window.received(QEvent::Resize), 1); + + // QTBUG-32706 + // Make sure we get a resizeEvent after calling resize + window.resize(400, 100); + + QTRY_COMPARE(window.received(QEvent::Resize), 2); +} + void tst_QWindow::positioning() { if (!QGuiApplicationPrivate::platformIntegration()->hasCapability( |