summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPierre Rossi <pierre.rossi@digia.com>2014-10-09 17:55:18 +0200
committerPierre Rossi <pierre.rossi@digia.com>2014-10-09 18:12:08 +0200
commitc2ad449616b5c863a27ddb7388d78aee6b68b893 (patch)
treed4fc7cc374048627c082ddb846f56149c41c0541 /tests
parenta0bd967d820f075128cd913d39334da47aac3f97 (diff)
parentd609bdf73958d30a6ec8a1097f595f68c7422804 (diff)
Merge remote-tracking branch 'origin/1.0' into dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qmltests/data/tst_loadFail.qml11
-rw-r--r--tests/auto/quick/qmltests/data/tst_loadUrl.qml5
-rw-r--r--tests/auto/quick/qmltests/qmltests.pro1
-rw-r--r--tests/auto/quick/shared/qt_webengine_quicktest.h1
-rw-r--r--tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp74
-rw-r--r--tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp44
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp48
-rw-r--r--tests/quicktestbrowser/quickwindow.qml27
8 files changed, 118 insertions, 93 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_loadFail.qml b/tests/auto/quick/qmltests/data/tst_loadFail.qml
index e2282129f..7b0a1849e 100644
--- a/tests/auto/quick/qmltests/data/tst_loadFail.qml
+++ b/tests/auto/quick/qmltests/data/tst_loadFail.qml
@@ -50,6 +50,12 @@ TestWebEngineView {
property variant testUrl
+ SignalSpy {
+ id: spyIconChanged
+ target: webEngineView
+ signalName: "iconChanged"
+ }
+
TestCase {
id: test
name: "WebEngineViewLoadFail"
@@ -57,6 +63,11 @@ TestWebEngineView {
testUrl = Qt.resolvedUrl("file_that_does_not_exist.html")
webEngineView.url = testUrl
verify(webEngineView.waitForLoadFailed())
+ spyIconChanged.clear()
+
+ // If this testcase finishes too early, we can not handle the received replacement content.
+ // So we should wait to ignore this error page.
+ spyIconChanged.wait()
}
}
diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml
index be7ede626..41faa6bc3 100644
--- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml
+++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml
@@ -124,9 +124,9 @@ TestWebEngineView {
var handleLoadFailed = function(loadRequest) {
if (loadRequest.status == WebEngineView.LoadFailedStatus) {
+ webEngineView.loadHtml("load failed", bogusSite)
compare(webEngineView.url, bogusSite)
compare(loadRequest.url, bogusSite)
- webEngineView.loadHtml("load failed", bogusSite)
}
}
webEngineView.loadingChanged.connect(handleLoadFailed)
@@ -166,8 +166,7 @@ TestWebEngineView {
}
lastUrl = webEngineView.url
webEngineView.loadingChanged.connect(handleLoadRequest)
- webEngineView.forceActiveFocus()
- keyPress(Qt.Key_Return) // Link is focused
+ mouseClick(webEngineView, 10, 10, Qt.LeftButton, Qt.NoModifiers, 50)
verify(webEngineView.waitForLoadSucceeded())
compare(webEngineView.url, url)
webEngineView.loadingChanged.disconnect(handleLoadRequest)
diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro
index b4514edc9..b25878dc9 100644
--- a/tests/auto/quick/qmltests/qmltests.pro
+++ b/tests/auto/quick/qmltests/qmltests.pro
@@ -34,4 +34,3 @@ OTHER_FILES += \
load(qt_build_paths)
DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD$${QMAKE_DIR_SEP}data\\\"\"
-DEFINES += QWP_PATH=\"\\\"$${MODULE_BASE_OUTDIR}$${QMAKE_DIR_SEP}libexec$${QMAKE_DIR_SEP}$${QTWEBENGINEPROCESS_NAME}\\\"\"
diff --git a/tests/auto/quick/shared/qt_webengine_quicktest.h b/tests/auto/quick/shared/qt_webengine_quicktest.h
index 2fd168e9d..4c4087ae6 100644
--- a/tests/auto/quick/shared/qt_webengine_quicktest.h
+++ b/tests/auto/quick/shared/qt_webengine_quicktest.h
@@ -69,7 +69,6 @@ QT_BEGIN_NAMESPACE
int main(int argc, char **argv) \
{ \
Application* app = 0; \
- qputenv("QTWEBENGINEPROCESS_PATH", QWP_PATH); \
if (!QCoreApplication::instance()) \
app = new Application(argc, argv); \
QtWebEngine::initialize(); \
diff --git a/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp b/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
index 7668a12ab..2a92693e1 100644
--- a/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
+++ b/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
@@ -75,7 +75,7 @@ void tst_QWebEngineView::noPage()
QCOMPARE(view->role(), QAccessible::Client);
QCOMPARE(view->childCount(), 1);
QAccessibleInterface *document = view->child(0);
- QCOMPARE(document->role(), QAccessible::Document);
+ QCOMPARE(document->role(), QAccessible::WebDocument);
QCOMPARE(document->parent(), view);
QCOMPARE(document->childCount(), 0);
}
@@ -97,7 +97,7 @@ void tst_QWebEngineView::hierarchy()
// Wait for accessibility to be fully initialized
QTRY_VERIFY(view->child(0)->childCount() == 1);
QAccessibleInterface *document = view->child(0);
- QCOMPARE(document->role(), QAccessible::Document);
+ QCOMPARE(document->role(), QAccessible::WebDocument);
QCOMPARE(document->parent(), view);
QCOMPARE(view->indexOfChild(document), 0);
QCOMPARE(document->childCount(), 1);
@@ -144,33 +144,67 @@ void tst_QWebEngineView::text()
QWebEngineView webView;
webView.setHtml("<html><body>" \
"<input type='text' value='Good morning!'></input>" \
+ "<p id='labelName'>Enter your name here:</p>" \
+ "<input type='text' value='my name' aria-labelledby='labelName' aria-describedby='explanation'></input>" \
+ "<p id='explanation'>Provide both first and last name.</p>" \
+ "<input type='text' value='Good day!' placeholder='day'></input>" \
"</body></html>");
webView.show();
::waitForSignal(&webView, SIGNAL(loadFinished(bool)));
QAccessibleInterface *view = QAccessible::queryAccessibleInterface(&webView);
// Wait for accessibility to be fully initialized
- QTRY_VERIFY(view->child(0)->childCount() == 1);
- QAccessibleInterface *document = view->child(0);
- QAccessibleInterface *grouping = document->child(0);
- QVERIFY(grouping);
- QAccessibleInterface *input = grouping->child(0);
- QCOMPARE(input->role(), QAccessible::EditableText);
- QCOMPARE(input->text(QAccessible::Name), QString());
- QCOMPARE(input->text(QAccessible::Description), QString());
- QCOMPARE(input->text(QAccessible::Value), QStringLiteral("Good morning!"));
-
- QAccessibleTextInterface *textInterface = input->textInterface();
- QVERIFY(textInterface);
- QCOMPARE(textInterface->characterCount(), 13);
- QCOMPARE(textInterface->selectionCount(), 0);
- QCOMPARE(textInterface->text(2, 9), QStringLiteral("od morn"));
+ QTRY_VERIFY(view->child(0)->childCount() == 5);
+ QAccessibleInterface *document = view->child(0);
+ QVERIFY(document);
+
+ // Good morning! [edit]
+ QAccessibleInterface *grouping1 = document->child(0);
+ QAccessibleInterface *input1 = grouping1->child(0);
+ QCOMPARE(input1->role(), QAccessible::EditableText);
+ QCOMPARE(input1->text(QAccessible::Name), QString());
+ QCOMPARE(input1->text(QAccessible::Description), QString());
+ QCOMPARE(input1->text(QAccessible::Value), QStringLiteral("Good morning!"));
+
+ QAccessibleTextInterface *textInterface1 = input1->textInterface();
+ QVERIFY(textInterface1);
+ QCOMPARE(textInterface1->characterCount(), 13);
+ QCOMPARE(textInterface1->selectionCount(), 0);
+ QCOMPARE(textInterface1->text(2, 9), QStringLiteral("od morn"));
int start = -1;
int end = -1;
- QCOMPARE(textInterface->textAtOffset(8, QAccessible::WordBoundary, &start, &end), QStringLiteral("morning"));
- textInterface->setCursorPosition(3);
- QTRY_COMPARE(textInterface->cursorPosition(), 3);
+ QCOMPARE(textInterface1->textAtOffset(8, QAccessible::WordBoundary, &start, &end), QStringLiteral("morning"));
+
+ // Enter your name here:
+ // my name [edit]
+ // Provide both first and last name here.
+ QAccessibleInterface *grouping2 = document->child(1);
+ QAccessibleInterface *label1 = grouping2->child(0);
+ QCOMPARE(label1->role(), QAccessible::StaticText);
+ QCOMPARE(label1->text(QAccessible::Name), QString());
+ QCOMPARE(label1->text(QAccessible::Description), QString());
+ QCOMPARE(label1->text(QAccessible::Value), QStringLiteral("Enter your name here:"));
+ QAccessibleInterface *grouping3 = document->child(2);
+ QAccessibleInterface *input2 = grouping3->child(0);
+ QCOMPARE(input2->role(), QAccessible::EditableText);
+ QCOMPARE(input2->text(QAccessible::Name), QStringLiteral("Enter your name here:"));
+ QCOMPARE(input2->text(QAccessible::Description), QStringLiteral("Provide both first and last name."));
+ QCOMPARE(input2->text(QAccessible::Value), QStringLiteral("my name"));
+ QAccessibleInterface *grouping4 = document->child(3);
+ QAccessibleInterface *label2 = grouping4->child(0);
+ QCOMPARE(label2->role(), QAccessible::StaticText);
+ QCOMPARE(label2->text(QAccessible::Name), QString());
+ QCOMPARE(label2->text(QAccessible::Description), QString());
+ QCOMPARE(label2->text(QAccessible::Value), QStringLiteral("Provide both first and last name."));
+
+ // Good day! [edit]
+ QAccessibleInterface *grouping5 = document->child(4);
+ QAccessibleInterface *input3 = grouping5->child(0);
+ QCOMPARE(input3->role(), QAccessible::EditableText);
+ QCOMPARE(input3->text(QAccessible::Name), QStringLiteral("day"));
+ QCOMPARE(input3->text(QAccessible::Description), QString());
+ QCOMPARE(input3->text(QAccessible::Value), QStringLiteral("Good day!"));
}
void tst_QWebEngineView::value()
diff --git a/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp b/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp
index 1e979b3c5..4b18f8e7a 100644
--- a/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp
+++ b/tests/auto/widgets/qwebengineframe/tst_qwebengineframe.cpp
@@ -353,6 +353,7 @@ void tst_QWebEngineFrame::requestedUrlAfterSetAndLoadFailures()
const QUrl first("http://abcdef.abcdef/");
page.setUrl(first);
::waitForSignal(&page, SIGNAL(loadFinished(bool)));
+ QCOMPARE(spy.count(), 1);
QCOMPARE(page.url(), first);
QCOMPARE(page.requestedUrl(), first);
QVERIFY(!spy.at(0).first().toBool());
@@ -362,7 +363,9 @@ void tst_QWebEngineFrame::requestedUrlAfterSetAndLoadFailures()
page.load(second);
::waitForSignal(&page, SIGNAL(loadFinished(bool)));
+ QCOMPARE(spy.count(), 2);
QCOMPARE(page.url(), first);
+ QEXPECT_FAIL("", "Slight change: The requestedUrl() function catches the error page's entry here thus it results the error page's requested url.", Continue);
QCOMPARE(page.requestedUrl(), second);
QVERIFY(!spy.at(1).first().toBool());
}
@@ -442,9 +445,6 @@ void tst_QWebEngineFrame::setHtml()
void tst_QWebEngineFrame::setHtmlWithImageResource()
{
-#if !defined(QWEBENGINEPAGE_EVALUATEJAVASCRIPT)
- QSKIP("QWEBENGINEPAGE_EVALUATEJAVASCRIPT");
-#else
// By default, only security origins of local files can load local resources.
// So we should specify baseUrl to be a local file in order to get a proper origin and load the local image.
@@ -454,20 +454,19 @@ void tst_QWebEngineFrame::setHtmlWithImageResource()
page.setHtml(html, QUrl(QLatin1String("file:///path/to/file")));
waitForSignal(&page, SIGNAL(loadFinished(bool)), 200);
- QCOMPARE(page.evaluateJavaScript("document.images.length").toInt(), 1);
- QCOMPARE(page.evaluateJavaScript("document.images[0].width").toInt(), 128);
- QCOMPARE(page.evaluateJavaScript("document.images[0].height").toInt(), 128);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].width").toInt(), 128);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].height").toInt(), 128);
// Now we test the opposite: without a baseUrl as a local file, we cannot request local resources.
page.setHtml(html);
waitForSignal(&page, SIGNAL(loadFinished(bool)), 200);
- QCOMPARE(page.evaluateJavaScript("document.images.length").toInt(), 1);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1);
QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=118659", Continue);
- QCOMPARE(page.evaluateJavaScript("document.images[0].width").toInt(), 0);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].width").toInt(), 0);
QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=118659", Continue);
- QCOMPARE(page.evaluateJavaScript("document.images[0].height").toInt(), 0);
-#endif
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].height").toInt(), 0);
}
void tst_QWebEngineFrame::setHtmlWithStylesheetResource()
@@ -508,9 +507,6 @@ void tst_QWebEngineFrame::setHtmlWithStylesheetResource()
void tst_QWebEngineFrame::setHtmlWithBaseURL()
{
-#if !defined(QWEBENGINEPAGE_EVALUATEJAVASCRIPT)
- QSKIP("QWEBENGINEPAGE_EVALUATEJAVASCRIPT");
-#else
// This tests if baseUrl is indeed affecting the relative paths from resources.
// As we are using a local file as baseUrl, its security origin should be able to load local resources.
@@ -530,13 +526,12 @@ void tst_QWebEngineFrame::setHtmlWithBaseURL()
waitForSignal(&page, SIGNAL(loadFinished(bool)), 200);
QCOMPARE(spy.count(), 1);
- QCOMPARE(page.evaluateJavaScript("document.images.length").toInt(), 1);
- QCOMPARE(page.evaluateJavaScript("document.images[0].width").toInt(), 128);
- QCOMPARE(page.evaluateJavaScript("document.images[0].height").toInt(), 128);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images.length").toInt(), 1);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].width").toInt(), 128);
+ QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].height").toInt(), 128);
// no history item has to be added.
QCOMPARE(m_view->page()->history()->count(), 0);
-#endif
}
class MyPage : public QWebEnginePage
@@ -1245,6 +1240,7 @@ void tst_QWebEngineFrame::setUrlWithFragment_data()
// Based on bug report https://bugs.webkit.org/show_bug.cgi?id=32723
void tst_QWebEngineFrame::setUrlWithFragment()
{
+ QSKIP("FIXME: https://trello.com/c/3L7F8VZJ/217-take-care-about-the-in-page-navigations-in-the-tests");
QFETCH(QUrl, previousUrl);
QWebEnginePage page;
@@ -1298,7 +1294,6 @@ void tst_QWebEngineFrame::setUrlToEmpty()
QTRY_COMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(page.url(), aboutBlank);
- QEXPECT_FAIL("", "Slight change: This information now comes from Chromium and the behavior of requestedUrl changed in this case.", Continue);
QCOMPARE(page.requestedUrl(), QUrl());
QCOMPARE(baseUrlSync(&page), aboutBlank);
@@ -1317,7 +1312,6 @@ void tst_QWebEngineFrame::setUrlToEmpty()
QTRY_COMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(page.url(), aboutBlank);
- QEXPECT_FAIL("", "Slight change: This information now comes from Chromium and the behavior of requestedUrl changed in this case.", Continue);
QCOMPARE(page.requestedUrl(), QUrl());
QCOMPARE(baseUrlSync(&page), aboutBlank);
}
@@ -1373,7 +1367,6 @@ void tst_QWebEngineFrame::setUrlHistory()
m_page->setUrl(QUrl());
expectedLoadFinishedCount++;
QTRY_COMPARE(spy.count(), expectedLoadFinishedCount);
- QEXPECT_FAIL("", "Slight change: QUrl() isn't replaced by about:blank.", Continue);
QCOMPARE(m_page->url(), aboutBlank);
QCOMPARE(m_page->requestedUrl(), QUrl());
QCOMPARE(collectHistoryUrls(m_page->history()), QStringList());
@@ -1398,7 +1391,6 @@ void tst_QWebEngineFrame::setUrlHistory()
expectedLoadFinishedCount++;
QTRY_COMPARE(spy.count(), expectedLoadFinishedCount);
QCOMPARE(m_page->url(), aboutBlank);
- QEXPECT_FAIL("", "Slight change: This information now comes from Chromium and the behavior of requestedUrl changed in this case.", Continue);
QCOMPARE(m_page->requestedUrl(), QUrl());
QEXPECT_FAIL("", "Slight change: load(QUrl()) currently loads about:blank and nothing prevents it from being added to the history.", Continue);
QCOMPARE(collectHistoryUrls(m_page->history()), QStringList() << QStringLiteral("qrc:/test1.html"));
@@ -1425,9 +1417,6 @@ void tst_QWebEngineFrame::setUrlHistory()
void tst_QWebEngineFrame::setUrlUsingStateObject()
{
-#if !defined(QWEBENGINEPAGE_EVALUATEJAVASCRIPT)
- QSKIP("QWEBENGINEPAGE_EVALUATEJAVASCRIPT");
-#else
const QUrl aboutBlank("about:blank");
QUrl url;
QSignalSpy urlChangedSpy(m_page, SIGNAL(urlChanged(QUrl)));
@@ -1443,14 +1432,14 @@ void tst_QWebEngineFrame::setUrlUsingStateObject()
QCOMPARE(m_page->url(), url);
QCOMPARE(m_page->history()->count(), 1);
- m_page->evaluateJavaScript("window.history.pushState(null,'push', 'navigate/to/here')");
+ evaluateJavaScriptSync(m_page, "window.history.pushState(null, 'push', 'navigate/to/here')");
expectedUrlChangeCount++;
QCOMPARE(urlChangedSpy.count(), expectedUrlChangeCount);
QCOMPARE(m_page->url(), QUrl("qrc:/navigate/to/here"));
QCOMPARE(m_page->history()->count(), 2);
QVERIFY(m_page->history()->canGoBack());
- m_page->evaluateJavaScript("window.history.replaceState(null,'replace', 'another/location')");
+ evaluateJavaScriptSync(m_page, "window.history.replaceState(null, 'replace', 'another/location')");
expectedUrlChangeCount++;
QCOMPARE(urlChangedSpy.count(), expectedUrlChangeCount);
QCOMPARE(m_page->url(), QUrl("qrc:/navigate/to/another/location"));
@@ -1458,14 +1447,13 @@ void tst_QWebEngineFrame::setUrlUsingStateObject()
QVERIFY(!m_page->history()->canGoForward());
QVERIFY(m_page->history()->canGoBack());
- m_page->evaluateJavaScript("window.history.back()");
+ evaluateJavaScriptSync(m_page, "window.history.back()");
QTest::qWait(100);
expectedUrlChangeCount++;
QCOMPARE(urlChangedSpy.count(), expectedUrlChangeCount);
QCOMPARE(m_page->url(), QUrl("qrc:/test1.html"));
QVERIFY(m_page->history()->canGoForward());
QVERIFY(!m_page->history()->canGoBack());
-#endif
}
void tst_QWebEngineFrame::setUrlSameUrl()
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 70fbba128..b6d3f14c5 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -39,6 +39,7 @@
#include <qpa/qplatforminputcontext.h>
#include <qwebenginehistory.h>
#include <qwebenginepage.h>
+#include <qwebenginesettings.h>
#include <qwebengineview.h>
#include <qimagewriter.h>
@@ -171,7 +172,6 @@ private Q_SLOTS:
void networkReplyParentDidntChange();
void destroyQNAMBeforeAbortDoesntCrash();
void testJSPrompt();
- void showModalDialog();
void testStopScheduledPageRefresh();
void findText();
void findTextResult();
@@ -471,9 +471,6 @@ private Q_SLOTS:
void tst_QWebEnginePage::popupFormSubmission()
{
-#if !defined(QWEBENGINEPAGE_SETTINGS)
- QSKIP("QWEBENGINEPAGE_SETTINGS");
-#else
TestPage page;
page.settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true);
page.setHtml("<form name=form1 method=get action='' target=myNewWin>"\
@@ -490,7 +487,6 @@ void tst_QWebEnginePage::popupFormSubmission()
// Check if the form submission was OK.
QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=118597", Continue);
QVERIFY(url.contains("?foo=bar"));
-#endif
}
void tst_QWebEnginePage::acceptNavigationRequestWithNewWindow()
@@ -2710,29 +2706,27 @@ void tst_QWebEnginePage::testEnablePersistentStorage()
void tst_QWebEnginePage::defaultTextEncoding()
{
-#if !defined(QWEBENGINESETTINGS_SETDEFAULTTEXTENCODING)
- QSKIP("QWEBENGINESETTINGS_SETDEFAULTTEXTENCODING");
-#else
-
QString defaultCharset = evaluateJavaScriptSync(m_page, "document.defaultCharset").toString();
QVERIFY(!defaultCharset.isEmpty());
QCOMPARE(QWebEngineSettings::globalSettings()->defaultTextEncoding(), defaultCharset);
m_page->settings()->setDefaultTextEncoding(QString("utf-8"));
+ QCoreApplication::processEvents();
QString charset = evaluateJavaScriptSync(m_page, "document.defaultCharset").toString();
QCOMPARE(charset, QString("utf-8"));
QCOMPARE(m_page->settings()->defaultTextEncoding(), charset);
m_page->settings()->setDefaultTextEncoding(QString());
+ QCoreApplication::processEvents();
charset = evaluateJavaScriptSync(m_page, "document.defaultCharset").toString();
QVERIFY(!charset.isEmpty());
QCOMPARE(charset, defaultCharset);
QWebEngineSettings::globalSettings()->setDefaultTextEncoding(QString("utf-8"));
+ QCoreApplication::processEvents();
charset = evaluateJavaScriptSync(m_page, "document.defaultCharset").toString();
QCOMPARE(charset, QString("utf-8"));
QCOMPARE(QWebEngineSettings::globalSettings()->defaultTextEncoding(), charset);
-#endif
}
#if defined(QWEBENGINEPAGE_ERRORPAGEEXTENSION)
@@ -3148,32 +3142,6 @@ void tst_QWebEnginePage::testJSPrompt()
QVERIFY(res);
}
-class TestModalPage : public QWebEnginePage
-{
- Q_OBJECT
-public:
- TestModalPage(QObject* parent = 0) : QWebEnginePage(parent) {
- }
- virtual QWebEnginePage* createWindow(WebWindowType) {
- QWebEnginePage* page = new TestModalPage();
- connect(page, SIGNAL(windowCloseRequested()), page, SLOT(deleteLater()));
- return page;
- }
-};
-
-void tst_QWebEnginePage::showModalDialog()
-{
-#if !defined(QWEBENGINESETTINGS)
- QSKIP("QWEBENGINESETTINGS");
-#else
- TestModalPage page;
- page.settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true);
- page.setHtml(QString("<html></html>"));
- QString res = evaluateJavaScriptSync(&page, "window.showModalDialog('javascript:window.returnValue=dialogArguments; window.close();', 'This is a test');").toString();
- QCOMPARE(res, QString("This is a test"));
-#endif
-}
-
void tst_QWebEnginePage::testStopScheduledPageRefresh()
{
#if !defined(QWEBENGINEPAGE_SETNETWORKACCESSMANAGER)
@@ -3680,10 +3648,11 @@ void tst_QWebEnginePage::getUserMediaRequest()
void tst_QWebEnginePage::openWindowDefaultSize()
{
-#if !defined(QWEBENGINEPAGE_SETTINGS)
- QSKIP("QWEBENGINEPAGE_SETTINGS");
-#else
TestPage page;
+ QWebEngineView view;
+ page.setView(&view);
+ view.show();
+
page.settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true);
// Open a default window.
page.runJavaScript("window.open()");
@@ -3703,7 +3672,6 @@ void tst_QWebEnginePage::openWindowDefaultSize()
// Check minimum size has been requested.
QVERIFY(requestedGeometry.width() == 100);
QVERIFY(requestedGeometry.height() == 100);
-#endif
}
void tst_QWebEnginePage::cssMediaTypeGlobalSetting()
diff --git a/tests/quicktestbrowser/quickwindow.qml b/tests/quicktestbrowser/quickwindow.qml
index ca1f75c04..f24717b01 100644
--- a/tests/quicktestbrowser/quickwindow.qml
+++ b/tests/quicktestbrowser/quickwindow.qml
@@ -41,11 +41,14 @@
import QtQuick 2.1
import QtWebEngine 1.0
import QtWebEngine.experimental 1.0
+
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0
import QtQuick.Layouts 1.0
import QtQuick.Window 2.1
import QtQuick.Controls.Private 1.0
+import Qt.labs.settings 1.0
+
ApplicationWindow {
id: browserWindow
@@ -64,6 +67,11 @@ ApplicationWindow {
visible: true
title: currentWebView && currentWebView.title
+ Settings {
+ property alias autoLoadImages: loadImages.checked;
+ property alias javaScriptEnabled: javaScriptEnabled.checked;
+ }
+
// Make sure the Qt.WindowFullscreenButtonHint is set on Mac.
Component.onCompleted: flags = flags | Qt.WindowFullscreenButtonHint
@@ -190,6 +198,25 @@ ApplicationWindow {
text: currentWebView && currentWebView.url
onAccepted: currentWebView.url = utils.fromUserInput(text)
}
+ ToolButton {
+ id: settingsMenuButton
+ menu: Menu {
+ MenuItem {
+ id: loadImages
+ text: "Autoload images"
+ checkable: true
+ checked: WebEngine.settings.autoLoadImages
+ onCheckedChanged: WebEngine.settings.autoLoadImages = checked
+ }
+ MenuItem {
+ id: javaScriptEnabled
+ text: "JavaScript On"
+ checkable: true
+ checked: WebEngine.settings.javascriptEnabled
+ onCheckedChanged: WebEngine.settings.javascriptEnabled = checked
+ }
+ }
+ }
}
ProgressBar {
id: progressBar