From 542e11ab2bd4a607fda8f559cc7efc32371b4e0e Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 26 Sep 2017 12:20:30 +0200 Subject: tests: make exposeEventOnShrink_QTBUG54040 not flakey on xcb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tests/auto/gui/kernel/qwindow/tst_qwindow.cpp') diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index fc9f50b15c..38f291cf4d 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -409,13 +409,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() -- cgit v1.2.3 From 08e083e682d92290e36e4fb09abaf0318575dd41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 8 Sep 2017 18:42:25 +0200 Subject: Ensure result of all QTest::qWaitFor are verified The qWaitFor functions themselves can not trigger a test failure, as that will not result in the test function exiting early, so every single call to qWaitFor needs to be wrapped in a QVERIFY. Change-Id: Id15a1549f31d06cdbf788e1d84ea431c28636ec8 Reviewed-by: Thiago Macieira --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto/gui/kernel/qwindow/tst_qwindow.cpp') diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 38f291cf4d..039d095ce6 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -490,7 +490,7 @@ void tst_QWindow::positioning() window.showNormal(); QCoreApplication::processEvents(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QMargins originalMargins = window.frameMargins(); @@ -1483,7 +1483,7 @@ void tst_QWindow::activateAndClose() window.showNormal(); #if defined(Q_OS_QNX) // We either need to create a eglSurface or a create a backing store // and then post the window in order for screen to show the window - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QOpenGLContext context; context.create(); context.makeCurrent(&window); -- cgit v1.2.3