summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-03-26 22:17:18 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-03-26 22:17:18 +0100
commit3ec12c0b43f885f85427743c03fe099ffed56fc0 (patch)
tree0cb3f75b99836b479d99a8ccc8fd8dcc369b8dea /tests
parent1d5c00fde1d2263dd74f2bdc8590783057ec853e (diff)
parent8947dc6902bfd2a8acd31b8c894407bf6a12695b (diff)
Merge branch '5.14' into 5.15
Conflicts: src/3rdparty tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp Change-Id: Idbc9d3b06c0052a721c974fbcbfa3164faaead14
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/dialogs/BLACKLIST8
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp38
2 files changed, 38 insertions, 8 deletions
diff --git a/tests/auto/quick/dialogs/BLACKLIST b/tests/auto/quick/dialogs/BLACKLIST
deleted file mode 100644
index 10b7391a0..000000000
--- a/tests/auto/quick/dialogs/BLACKLIST
+++ /dev/null
@@ -1,8 +0,0 @@
-[contextMenuRequested]
-osx-10.13
-[javaScriptDialogRequested]
-osx-10.13
-[colorDialogRequested]
-osx-10.13
-[fileDialogRequested]
-osx-10.13
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 63be1573b..4945f6c91 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -227,6 +227,7 @@ private Q_SLOTS:
void customUserAgentInNewTab();
void renderProcessCrashed();
void renderProcessPid();
+ void backgroundColor();
private:
static QPoint elementCenter(QWebEnginePage *page, const QString &id);
@@ -4388,6 +4389,43 @@ void tst_QWebEnginePage::renderProcessPid()
QCOMPARE(m_page->renderProcessPid(), 0);
}
+void tst_QWebEnginePage::backgroundColor()
+{
+ QWebEngineProfile profile;
+ QWebEngineView view;
+ QWebEnginePage *page = new QWebEnginePage(&profile, &view);
+
+ view.resize(640, 480);
+ view.show();
+ QPoint center(view.size().width() / 2, view.size().height() / 2);
+
+ QCOMPARE(page->backgroundColor(), Qt::white);
+ QTRY_COMPARE(view.grab().toImage().pixelColor(center), Qt::white);
+
+ page->setBackgroundColor(Qt::red);
+ view.setPage(page);
+
+ QCOMPARE(page->backgroundColor(), Qt::red);
+ QTRY_COMPARE(view.grab().toImage().pixelColor(center), Qt::red);
+
+ page->setHtml(QString("<html>"
+ "<head><style>html, body { margin:0; padding:0; }</style></head>"
+ "<body><div style=\"width:100%; height:10px; background-color:black\"/></body>"
+ "</html>"));
+ QSignalSpy spyFinished(page, &QWebEnginePage::loadFinished);
+ QVERIFY(spyFinished.wait());
+ // Make sure the page is rendered and the test is not grabbing the color of the RenderWidgetHostViewQtDelegateWidget.
+ QTRY_COMPARE(view.grab().toImage().pixelColor(QPoint(5, 5)), Qt::black);
+
+ QCOMPARE(page->backgroundColor(), Qt::red);
+ QCOMPARE(view.grab().toImage().pixelColor(center), Qt::red);
+
+ page->setBackgroundColor(Qt::green);
+
+ QCOMPARE(page->backgroundColor(), Qt::green);
+ QTRY_COMPARE(view.grab().toImage().pixelColor(center), Qt::green);
+}
+
static QByteArrayList params = {QByteArrayLiteral("--use-fake-device-for-media-stream")};
W_QTEST_MAIN(tst_QWebEnginePage, params)