summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2015-03-19 06:08:59 -0700
committerAndras Becsi <andras.becsi@theqtcompany.com>2015-04-07 11:18:04 +0000
commit4b54390776be207d64852e560f323deef7b0b7fc (patch)
tree6c3e0ad4b0defbd68fc50be8d0bab6857adc5c1c
parenta0d66fc16f63e4230604fbad20254afb093af6fb (diff)
Enable build of QWebEngineScript API test
The MSVC doesn't support this type of string literal concatenation. Change-Id: I051593a34c801df6c5264370ad751c45bbb41b5a Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com>
-rw-r--r--tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp48
-rw-r--r--tests/auto/widgets/widgets.pro1
2 files changed, 25 insertions, 24 deletions
diff --git a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
index 53d7494d2..b29d8fae6 100644
--- a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
+++ b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
@@ -58,17 +58,17 @@ void tst_QWebEngineScript::domEditing()
QWebEngineScript s;
s.setInjectionPoint(QWebEngineScript::DocumentReady);
s.setWorldId(QWebEngineScript::ApplicationWorld + 1);
- s.setSourceCode("el = document.createElement(\"div\");"\
- "el.id = \"banner\";"\
- "el.style.position = \"absolute\";"\
- "el.style.width = \"100%\";"\
- "el.style.padding = \"1em\";"\
- "el.style.textAlign = \"center\";"\
- "el.style.top = \"0\";"\
- "el.style.left = \"0\";"\
- "el.style.backgroundColor = \"#80C342\";"\
- "el.innerText = \"Injected banner\";"
- "document.body.appendChild(el);");
+ s.setSourceCode("el = document.createElement(\"div\");\
+ el.id = \"banner\";\
+ el.style.position = \"absolute\";\
+ el.style.width = \"100%\";\
+ el.style.padding = \"1em\";\
+ el.style.textAlign = \"center\";\
+ el.style.top = \"0\";\
+ el.style.left = \"0\";\
+ el.style.backgroundColor = \"#80C342\";\
+ el.innerText = \"Injected banner\";\
+ document.body.appendChild(el);");
page.scripts().insert(s);
page.load(QUrl("about:blank"));
view.show();
@@ -91,10 +91,10 @@ void tst_QWebEngineScript::injectionPoint()
WebEnginePage page;
page.scripts().insert(s);
page.setHtml(QStringLiteral("<html><head><script> var contents;") + testScript
- + QStringLiteral("document.addEventListener(\"load\", setTimeout(function(event) {"\
- "document.body.innerText = contents;"\
- "}, 550));"\
- "</script></head><body></body></html>"));
+ + QStringLiteral("document.addEventListener(\"load\", setTimeout(function(event) {\
+ document.body.innerText = contents;\
+ }, 550));\
+ </script></head><body></body></html>"));
waitForSignal(&page, SIGNAL(loadFinished(bool)));
QTest::qWait(550);
QCOMPARE(evaluateJavaScriptSync(&page, "document.body.innerText"), QVariant::fromValue(QStringLiteral("SUCCESS")));
@@ -108,13 +108,13 @@ void tst_QWebEngineScript::injectionPoint_data()
<< QStringLiteral("var contents = (typeof(foo) == \"undefined\")? \"FAILURE\" : \"SUCCESS\";");
QTest::newRow("DocumentReady") << static_cast<int>(QWebEngineScript::DocumentReady)
// use a zero timeout to make sure the user script got a chance to run as the order is undefined.
- << QStringLiteral("document.addEventListener(\"DOMContentLoaded\", setTimeout(function(event) {"\
- "contents = (typeof(foo) == \"undefined\")? \"FAILURE\" : \"SUCCESS\";"\
- "}, 0));");
+ << QStringLiteral("document.addEventListener(\"DOMContentLoaded\", setTimeout(function(event) {\
+ contents = (typeof(foo) == \"undefined\")? \"FAILURE\" : \"SUCCESS\";\
+ }, 0));");
QTest::newRow("Deferred") << static_cast<int>(QWebEngineScript::Deferred)
- << QStringLiteral("document.addEventListener(\"load\", setTimeout(function(event) {"\
- "contents = (typeof(foo) == \"undefined\")? \"FAILURE\" : \"SUCCESS\";"\
- "}, 500));");
+ << QStringLiteral("document.addEventListener(\"load\", setTimeout(function(event) {\
+ contents = (typeof(foo) == \"undefined\")? \"FAILURE\" : \"SUCCESS\";\
+ }, 500));");
}
void tst_QWebEngineScript::scriptWorld()
@@ -145,9 +145,9 @@ void tst_QWebEngineScript::scriptModifications()
script.setWorldId(QWebEngineScript::MainWorld);
script.setSourceCode("var foo = \"SUCCESS\";");
page.scripts().insert(script);
- page.setHtml(QStringLiteral("<html><head><script>document.addEventListener(\"DOMContentLoaded\", function() {"\
- "document.body.innerText = foo;});"\
- "</script></head><body></body></html>"));
+ page.setHtml(QStringLiteral("<html><head><script>document.addEventListener(\"DOMContentLoaded\", function() {\
+ document.body.innerText = foo;});\
+ </script></head><body></body></html>"));
QVERIFY(page.scripts().count() == 1);
waitForSignal(&page, SIGNAL(loadFinished(bool)));
QCOMPARE(evaluateJavaScriptSync(&page, "document.body.innerText"), QVariant::fromValue(QStringLiteral("SUCCESS")));
diff --git a/tests/auto/widgets/widgets.pro b/tests/auto/widgets/widgets.pro
index 40d3b40bb..2dbb498d1 100644
--- a/tests/auto/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets.pro
@@ -10,3 +10,4 @@ SUBDIRS += \
qwebengineview \
qwebenginehistory \
qwebengineinspector \
+ qwebenginescript \