From f9e4bd23f3a126df00302448d7b48cb3eb277c01 Mon Sep 17 00:00:00 2001
From: Pierre Rossi <pierre.rossi@theqtcompany.com>
Date: Thu, 26 Mar 2015 15:01:16 +0100
Subject: [PATCH] Fix openWindowDefaultSize QWebEnginePage test

Add some qWait statements for timing-sensitive popup test.
Replace QVERIFY with QCOMPARE for better reporting when it fails.

Change-Id: I75eb2e774851beb01376042f0b60614db005970c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
---
 .../widgets/qwebenginepage/tst_qwebenginepage.cpp | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 85939a686..970ebf20a 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -3588,22 +3588,23 @@ void tst_QWebEnginePage::openWindowDefaultSize()
     page.settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true);
     // Open a default window.
     page.runJavaScript("window.open()");
+    QTest::qWait(200);
     // Open a too small window.
-    evaluateJavaScriptSync(&page, "window.open('', '', 'width=10,height=10')");
+    evaluateJavaScriptSync(&page, "window.open('','about:blank','width=10,height=10')");
 
-    QTest::qWait(500);
+    QTest::qWait(200);
     // The number of popups created should be two.
-    QVERIFY(page.createdWindows.size() == 2);
+    QCOMPARE(page.createdWindows.size(), 2);
 
     QRect requestedGeometry = page.createdWindows[0]->requestedGeometry;
     // Check default size has been requested.
-    QVERIFY(requestedGeometry.width() == 0);
-    QVERIFY(requestedGeometry.height() == 0);
+    QCOMPARE(requestedGeometry.width(), 0);
+    QCOMPARE(requestedGeometry.height(), 0);
 
     requestedGeometry = page.createdWindows[1]->requestedGeometry;
     // Check minimum size has been requested.
-    QVERIFY(requestedGeometry.width() == 100);
-    QVERIFY(requestedGeometry.height() == 100);
+    QCOMPARE(requestedGeometry.width(), 100);
+    QCOMPARE(requestedGeometry.height(), 100);
 }
 
 void tst_QWebEnginePage::cssMediaTypeGlobalSetting()
-- 
GitLab