summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2017-06-20 21:15:48 +0100
committerSérgio Martins <sergio.martins@kdab.com>2017-07-14 15:05:44 +0000
commit86cf1f0d919549420b39016ac27ffdb0cd690dd0 (patch)
treefceb649d689f3fb77c0f6cb90057ae85702f4b3d
parentab5d4c78224c9ec79165e8890e5f8b8e838e0709 (diff)
Add a unit-test for QQuickWidget::grab()
Test that it actually didn't grab a blank pixmap, as happened with QOpenGLWidget in the past. Change-Id: Iee8e7ff2f3fa2f2223a2a284fec96d96f62e36a6 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
-rw-r--r--tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
index 60495596d1..ee49c9c7ad 100644
--- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
+++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
@@ -55,6 +55,7 @@ private slots:
void engine();
void readback();
void renderingSignals();
+ void grab();
void grabBeforeShow();
void reparentToNewWindow();
void nullEngine();
@@ -298,6 +299,15 @@ void tst_qquickwidget::renderingSignals()
QTRY_VERIFY(afterRenderingSpy.size() > 0);
}
+void tst_qquickwidget::grab()
+{
+ QQuickWidget view;
+ view.setSource(testFileUrl("rectangle.qml"));
+ QPixmap pixmap = view.grab();
+ QRgb pixel = pixmap.toImage().pixel(5, 5);
+ QCOMPARE(pixel, qRgb(255, 0, 0));
+}
+
// QTBUG-49929, verify that Qt Designer grabbing the contents before drag
// does not crash due to missing GL contexts or similar.
void tst_qquickwidget::grabBeforeShow()