summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2017-09-26 12:20:30 +0200
committerGatis Paeglis <gatis.paeglis@qt.io>2017-10-17 13:58:36 +0000
commit377d2502e3d3116c4cbe7398c2aa6f4afbe32851 (patch)
treed58b7e445e2c69cd3265595ce998f5efba0e9f74 /tests
parent0aba5546ef69bddeb42c3dabe22e2856f0213b19 (diff)
tests: make exposeEventOnShrink_QTBUG54040 not flakey on xcb
From: https://tronche.com/gui/x/xlib/events/exposure/expose.html "The circumstances in which the X server generates Expose events are not as definite as those for other events." On windows with XCB_GRAVITY_NORTH_WEST flag set we should not get expose events according to e2665600c09358854bb0b29389cc873a2684f77b, but as stated earlier this might not always be true. Nevertheless, sometimes we get expose event from X server when shrinking window, but most of the time we don't. Make the test not flakey by checking that we get at least 1 expose event, instead of exactly 1. Now running test 500 times in a loop does not fail. Task-number: QTBUG-63424 Change-Id: I8004e622020cc09e11b7d592faf6d9ee1b9cfee2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 542e11ab2bd4a607fda8f559cc7efc32371b4e0e) Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index e1366ce2eb..6452b9ecd0 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -394,13 +394,17 @@ void tst_QWindow::exposeEventOnShrink_QTBUG54040()
QVERIFY(QTest::qWaitForWindowExposed(&window));
- const int initialExposeCount = window.received(QEvent::Expose);
+ int exposeCount = window.received(QEvent::Expose);
window.resize(window.width(), window.height() - 5);
- QTRY_COMPARE(window.received(QEvent::Expose), initialExposeCount + 1);
+ QTRY_VERIFY(window.received(QEvent::Expose) > exposeCount);
+
+ exposeCount = window.received(QEvent::Expose);
window.resize(window.width() - 5, window.height());
- QTRY_COMPARE(window.received(QEvent::Expose), initialExposeCount + 2);
+ QTRY_VERIFY(window.received(QEvent::Expose) > exposeCount);
+
+ exposeCount = window.received(QEvent::Expose);
window.resize(window.width() - 5, window.height() - 5);
- QTRY_COMPARE(window.received(QEvent::Expose), initialExposeCount + 3);
+ QTRY_VERIFY(window.received(QEvent::Expose) > exposeCount);
}
void tst_QWindow::positioning_data()