summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2014-12-03 12:09:50 +0100
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2014-12-04 12:00:43 +0100
commitbd5743f1d8472e70aeeccd08858130d4781bde41 (patch)
treebd5948659d5702078a9764aad1d13867be4940ce /tests
parentab6d645850e88f3e351d196bf009135b6189ba8a (diff)
Make tst_qwindow::positioning more reliable
Don't check for absolute counts of resize events but just check if we were resized. Also use QTest::qWaitForWindowExposed instead of QTRY_COMPARE and checking for QEvent::Expose. Change-Id: Ie383493a8ce6d88cad50bd6375d432ad1578449c Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp33
1 files changed, 11 insertions, 22 deletions
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index fac16ff8a3..46b33e5d39 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -233,17 +233,11 @@ void tst_QWindow::resizeEventAfterResize()
void tst_QWindow::positioning_data()
{
QTest::addColumn<int>("windowflags");
- QTest::addColumn<int>("resizecount");
- QTest::newRow("default") << int(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::WindowFullscreenButtonHint)
-#if defined(Q_OS_OSX) && MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
- << 4;
-#else
- << 3;
-#endif
+ QTest::newRow("default") << int(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::WindowFullscreenButtonHint);
#ifdef Q_OS_OSX
- QTest::newRow("fake") << int(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint) << 4;
+ QTest::newRow("fake") << int(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
#endif
}
@@ -262,7 +256,6 @@ void tst_QWindow::positioning()
const QRect geometry(m_availableTopLeft + QPoint(80, 80), m_testWindowSize);
QFETCH(int, windowflags);
- QFETCH(int, resizecount);
Window window((Qt::WindowFlags)windowflags);
window.setGeometry(QRect(m_availableTopLeft + QPoint(20, 20), m_testWindowSize));
window.setFramePosition(m_availableTopLeft + QPoint(40, 40)); // Move window around before show, size must not change.
@@ -273,8 +266,7 @@ void tst_QWindow::positioning()
window.showNormal();
QCoreApplication::processEvents();
- QTRY_COMPARE(window.received(QEvent::Resize), 1);
- QTRY_VERIFY(window.received(QEvent::Expose) > 0);
+ QTest::qWaitForWindowExposed(&window);
QMargins originalMargins = window.frameMargins();
@@ -284,25 +276,22 @@ void tst_QWindow::positioning()
QPoint originalPos = window.position();
QPoint originalFramePos = window.framePosition();
+ window.reset();
window.setWindowState(Qt::WindowFullScreen);
QCoreApplication::processEvents();
-#if defined(Q_OS_BLACKBERRY) // "window" is the "root" window and will always be shown fullscreen
- // so we only expect one resize event
- Q_UNUSED(resizecount);
- QTRY_COMPARE(window.received(QEvent::Resize), 1);
-#else
- QTRY_COMPARE(window.received(QEvent::Resize), 2);
+ // On BB10 the window is the root window and fullscreen, so nothing is resized.
+#if !defined(Q_OS_BLACKBERRY)
+ QTRY_VERIFY(window.received(QEvent::Resize) > 0);
#endif
QTest::qWait(2000);
+ window.reset();
window.setWindowState(Qt::WindowNoState);
QCoreApplication::processEvents();
-#if defined(Q_OS_BLACKBERRY) // "window" is the "root" window and will always be shown fullscreen
- // so we only expect one resize event
- QTRY_COMPARE(window.received(QEvent::Resize), 1);
-#else
- QTRY_COMPARE(window.received(QEvent::Resize), resizecount);
+ // On BB10 the window is the root window and fullscreen, so nothing is resized.
+#if !defined(Q_OS_BLACKBERRY)
+ QTRY_VERIFY(window.received(QEvent::Resize) > 0);
#endif
QTRY_COMPARE(originalPos, window.position());