summaryrefslogtreecommitdiffstats
path: root/tests/auto/opengl/qgl/tst_qgl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/opengl/qgl/tst_qgl.cpp')
-rw-r--r--tests/auto/opengl/qgl/tst_qgl.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp
index d860caaa37..c5441770f3 100644
--- a/tests/auto/opengl/qgl/tst_qgl.cpp
+++ b/tests/auto/opengl/qgl/tst_qgl.cpp
@@ -44,6 +44,7 @@
#include <QGraphicsView>
#include <QGraphicsProxyWidget>
#include <QVBoxLayout>
+#include <QOperatingSystemVersion>
#ifdef QT_BUILD_INTERNAL
#include <qpa/qplatformpixmap.h>
@@ -94,6 +95,7 @@ private slots:
void nullRectCrash();
void graphicsViewClipping();
void extensions();
+ void closeAndThenShow();
};
tst_QGL::tst_QGL()
@@ -2521,5 +2523,47 @@ void tst_QGL::extensions()
QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Framebuffers));
}
+class TestPaintWidget : public QGLWidget
+{
+public:
+ TestPaintWidget(QWidget *parent = nullptr) : QGLWidget(parent) { }
+ void paintEvent(QPaintEvent *) override
+ {
+ QPainter painter(this);
+ painter.setPen(Qt::red);
+ painter.setBrush(Qt::blue);
+ painter.drawRect(0, 0, width(), height());
+ }
+};
+
+void tst_QGL::closeAndThenShow()
+{
+#ifdef Q_OS_MACOS
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSBigSur)
+ QSKIP("Test is crashing flaky on macos-11.0 - QTBUG-96271");
+#endif
+ QWidget *w = new QWidget;
+ w->resize(640, 480);
+ QVBoxLayout *layout = new QVBoxLayout(w);
+ QGLWidget *glw = new TestPaintWidget;
+ layout->addWidget(glw);
+
+ w->show();
+ QVERIFY(QTest::qWaitForWindowExposed(w));
+ QCoreApplication::processEvents();
+
+ // QWidget::close() does not exhibit the problems from
+ // QTBUG-86582, since that's not the same as closing a QWindow.
+ // Rather, close the QWindow (i.e. simulate what pressing the
+ // close button interactively would do).
+ w->windowHandle()->close();
+
+ w->show();
+ QVERIFY(QTest::qWaitForWindowExposed(w));
+ QCoreApplication::processEvents();
+
+ delete w;
+}
+
QTEST_MAIN(tst_QGL)
#include "tst_qgl.moc"