aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quickwidgets
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-04-30 17:37:27 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-05-27 10:45:45 +0200
commit0d80dbd8c2cfc2a7d2a4d970b7acfc7fb5fb97a0 (patch)
treea6f487a8604e6212d27184b69debac87e0f3aca8 /tests/auto/quickwidgets
parent6d3aae3cf47fbf21bd27eda7a249c2a23308156e (diff)
Enable QQuickWidget with OpenGL over RHI
Also adapts to new NativeTexture format, where the actual handle is passed around instead of a pointer to it. [ChangeLog][QQuickWidget][Important Behavioral Changes] In earlier versions, the returned value from QQuickWidget::quickWindow() would persist for the life time of the widget. This is no longer the case, so if you are connecting to its signals, make sure you also connect to its destroyed() signal and update the connections when it is destroyed. Fixes: QTBUG-78638 Change-Id: I33cee8543ef1ff5d31555ed3ac18ba78c9c45102 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'tests/auto/quickwidgets')
-rw-r--r--tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
index 8211400262..b47837179a 100644
--- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
+++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
@@ -152,6 +152,7 @@ private:
tst_qquickwidget::tst_qquickwidget()
{
+ QQuickWindow::setSceneGraphBackend(QSGRendererInterface::OpenGLRhi);
}
void tst_qquickwidget::showHide()
@@ -379,8 +380,8 @@ void tst_qquickwidget::readback()
QImage img = view->grabFramebuffer();
QVERIFY(!img.isNull());
- QCOMPARE(img.width(), view->width());
- QCOMPARE(img.height(), view->height());
+ QCOMPARE(img.width(), qCeil(view->width() * view->devicePixelRatioF()));
+ QCOMPARE(img.height(), qCeil(view->height() * view->devicePixelRatioF()));
QRgb pix = img.pixel(5, 5);
QCOMPARE(pix, qRgb(255, 0, 0));
@@ -447,13 +448,15 @@ void tst_qquickwidget::reparentToNewWindow()
window2.show();
QVERIFY(QTest::qWaitForWindowExposed(&window2));
- QSignalSpy afterRenderingSpy(qqw->quickWindow(), &QQuickWindow::afterRendering);
qqw->setParent(&window2);
+
+ QSignalSpy afterRenderingSpy(qqw->quickWindow(), &QQuickWindow::afterRendering);
qqw->show();
QTRY_VERIFY(afterRenderingSpy.size() > 0);
QImage img = qqw->grabFramebuffer();
+
QCOMPARE(img.pixel(5, 5), qRgb(255, 0, 0));
}