summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/graphicsview
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-13 09:01:02 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-13 12:46:46 +0200
commit511790fd1af1e2886a0e2e8dd4308099705cd815 (patch)
treeb42aee537a6103cd064f9f41ae2889b09b79fd23 /tests/auto/widgets/graphicsview
parent1542d8881fc5ccbc5918cd4acbe4091ebbd24508 (diff)
parentcbe332405aa22257d432f1797b325f5e57007c20 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: config_help.txt configure mkspecs/features/uikit/sdk.prf src/corelib/global/qhooks.cpp src/corelib/io/qfilesystemwatcher.cpp src/corelib/io/qlockfile_unix.cpp src/corelib/tools/qalgorithms.h src/gui/kernel/qwindowsysteminterface.h src/gui/text/qtextdocument_p.cpp src/network/access/access.pri src/network/access/qnetworkaccessmanager.cpp src/network/access/qnetworkreplynsurlconnectionimpl.mm src/src.pro src/testlib/qtestcase.cpp src/widgets/kernel/qwidgetbackingstore_p.h src/widgets/styles/qwindowscestyle.cpp src/widgets/styles/qwindowsmobilestyle.cpp tests/auto/corelib/io/qdiriterator/qdiriterator.pro tests/auto/corelib/io/qfileinfo/qfileinfo.pro tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp tools/configure/configureapp.cpp Change-Id: Ibf7fb9c8cf263a810ade82f821345d0725c57c67
Diffstat (limited to 'tests/auto/widgets/graphicsview')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 2329db55e9..2ecc1120b9 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -49,6 +49,9 @@
#include <QtWidgets/QStyle>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QDesktopWidget>
+#ifndef QT_NO_OPENGL
+#include <QtWidgets/QOpenGLWidget>
+#endif
#include <private/qgraphicsscene_p.h>
#include <private/qgraphicsview_p.h>
#include "../../../shared/platforminputcontext.h"
@@ -154,6 +157,9 @@ private slots:
void sceneRect_growing();
void setSceneRect();
void viewport();
+#ifndef QT_NO_OPENGL
+ void openGLViewport();
+#endif
void dragMode_scrollHand();
void dragMode_rubberBand();
void rubberBandSelectionMode();
@@ -655,6 +661,45 @@ void tst_QGraphicsView::viewport()
QTest::qWait(25);
}
+#ifndef QT_NO_OPENGL
+void tst_QGraphicsView::openGLViewport()
+{
+ QGraphicsScene scene;
+ scene.setBackgroundBrush(Qt::white);
+ scene.addText("GraphicsView");
+ scene.addEllipse(QRectF(400, 50, 50, 50));
+ scene.addEllipse(QRectF(-100, -400, 50, 50));
+ scene.addEllipse(QRectF(50, -100, 50, 50));
+ scene.addEllipse(QRectF(-100, 50, 50, 50));
+
+ QGraphicsView view(&scene);
+ view.setSceneRect(-400, -400, 800, 800);
+ view.resize(400, 400);
+
+ QOpenGLWidget *glw = new QOpenGLWidget;
+ QSignalSpy spy1(glw, SIGNAL(resized()));
+ QSignalSpy spy2(glw, SIGNAL(frameSwapped()));
+
+ view.setViewport(glw);
+
+ view.show();
+ QTest::qWaitForWindowExposed(&view);
+ QTRY_VERIFY(spy1.count() > 0);
+ QTRY_VERIFY(spy2.count() >= spy1.count());
+ spy1.clear();
+ spy2.clear();
+
+ // Now test for resize (QTBUG-52419). This is special when the viewport is
+ // a QOpenGLWidget since the underlying FBO must also be maintained.
+ view.resize(300, 300);
+ QTRY_VERIFY(spy1.count() > 0);
+ QTRY_VERIFY(spy2.count() >= spy1.count());
+ // There is no sane way to check if the framebuffer contents got updated
+ // (grabFramebuffer is no good for the viewport case as that does not go
+ // through paintGL). So skip the actual verification.
+}
+#endif
+
void tst_QGraphicsView::dragMode_scrollHand()
{
for (int j = 0; j < 2; ++j) {