summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-01-08 14:37:40 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-17 14:58:55 +0100
commit13416b2db167dc1849e4af94391d3c6ae602ec76 (patch)
treeb0adcf4565663bc43a262ec2e535b6f3c4505a18 /tests
parentdb2c0781218b7dfa03f7bc39b1e2115dbf4a0fb0 (diff)
Fix QWebEngineView to page reattachment.
This fixes the crash in tst_QWebEngineView::reusePage. Also add a test to check the case where show() would react incorrectly. Change-Id: I40247c7c225d74b26675b6a7fa5ff1f06d3bb3e6 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 6ca8e0d8e..a670903fe 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -152,6 +152,7 @@ private Q_SLOTS:
void userAgentApplicationName();
void userAgentNewlineStripping();
void undoActionHaveCustomText();
+ void renderWidgetHostViewNotShowTopLevel();
void viewModes();
@@ -3534,6 +3535,28 @@ void tst_QWebEnginePage::undoActionHaveCustomText()
#endif
}
+void tst_QWebEnginePage::renderWidgetHostViewNotShowTopLevel()
+{
+ QWebEnginePage page;
+ QSignalSpy spyLoadFinished(&page, SIGNAL(loadFinished(bool)));
+
+ page.load(QUrl("http://qt-project.org"));
+ if (!spyLoadFinished.wait(10000) || !spyLoadFinished.at(0).at(0).toBool())
+ QSKIP("Couldn't load page from network, skipping test.");
+ spyLoadFinished.clear();
+
+ // Loading a different domain will force the creation of a separate render
+ // process and should therefore create a new RenderWidgetHostViewQtDelegateWidget.
+ page.load(QUrl("http://www.wikipedia.org/"));
+ if (!spyLoadFinished.wait(10000) || !spyLoadFinished.at(0).at(0).toBool())
+ QSKIP("Couldn't load page from network, skipping test.");
+
+ // Make sure that RenderWidgetHostViewQtDelegateWidgets are not shown as top-level.
+ // They should only be made visible when parented to a QWebEngineView.
+ foreach (QWidget *widget, QApplication::topLevelWidgets())
+ QCOMPARE(widget->isVisible(), false);
+}
+
void tst_QWebEnginePage::openWindowDefaultSize()
{
#if !defined(QWEBENGINEPAGE_EVALUATEJAVASCRIPT)