diff options
author | Jüri Valdmann <juri.valdmann@qt.io> | 2020-04-03 12:33:33 +0200 |
---|---|---|
committer | Jüri Valdmann <juri.valdmann@qt.io> | 2020-04-09 08:37:03 +0200 |
commit | 9edaf3675cb8e94372bff579cbaec022ca26ee21 (patch) | |
tree | f166bd10231060adbdca27489fb65d4d980ca352 /tests | |
parent | cee8776777e72f2820f04f1df00e2aeebbf9af49 (diff) |
Use SetBaseBackgroundColorOverride for setting background color
The normal WebViewImpl::SetBaseBackgroundColor expects to be called only during
certain lifecycle states, otherwise a DCHECK will be triggered. Whereas
the *Override version forces a lifecycle update.
Needs 3rdparty change to stop RenderWidgetHostViewBase::SetBaseBackgroundColor
from clearing the override color when switching between opaque and transparent
colors though.
Change-Id: If4c1e22886d7ebc7d87ca880dd9c6a659855a931
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index e1d97af25..a6b3e0905 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -4397,6 +4397,7 @@ void tst_QWebEnginePage::backgroundColor() QWebEnginePage *page = new QWebEnginePage(&profile, &view); view.resize(640, 480); + view.setStyleSheet("background: yellow"); view.show(); QPoint center(view.size().width() / 2, view.size().height() / 2); @@ -4421,6 +4422,11 @@ void tst_QWebEnginePage::backgroundColor() QCOMPARE(page->backgroundColor(), Qt::red); QCOMPARE(view.grab().toImage().pixelColor(center), Qt::red); + page->setBackgroundColor(Qt::transparent); + + QCOMPARE(page->backgroundColor(), Qt::transparent); + QTRY_COMPARE(view.grab().toImage().pixelColor(center), Qt::yellow); + page->setBackgroundColor(Qt::green); QCOMPARE(page->backgroundColor(), Qt::green); |