summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/util/qscroller/tst_qscroller.cpp6
-rw-r--r--tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp52
-rw-r--r--tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp2
3 files changed, 56 insertions, 4 deletions
diff --git a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
index 5c299bab42..03b748c0dd 100644
--- a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
+++ b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
@@ -356,7 +356,7 @@ void tst_QScroller::scrollerProperties()
void tst_QScroller::scrollTo()
{
#ifdef Q_OS_MAC
- QSKIP("Flakey test - https://bugreports.qt-project.org/browse/QTBUG-29950");
+ QSKIP("Flakey test - QTBUG-29950");
#endif
{
tst_QScrollerWidget *sw = new tst_QScrollerWidget();
@@ -385,7 +385,7 @@ void tst_QScroller::scrollTo()
void tst_QScroller::scroll()
{
#ifdef Q_OS_MAC
- QSKIP("Flakey test - https://bugreports.qt-project.org/browse/QTBUG-30133");
+ QSKIP("Flakey test - QTBUG-30133");
#endif
#ifndef QT_NO_GESTURES
// -- good case. normal scroll
@@ -430,7 +430,7 @@ void tst_QScroller::scroll()
void tst_QScroller::overshoot()
{
#ifdef Q_OS_MAC
- QSKIP("Flakey test - https://bugreports.qt-project.org/browse/QTBUG-29950");
+ QSKIP("Flakey test - QTBUG-29950");
#endif
#ifndef QT_NO_GESTURES
tst_QScrollerWidget *sw = new tst_QScrollerWidget();
diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
index d309b0840e..2ac31bfe1b 100644
--- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
+++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
@@ -34,6 +34,11 @@
#include <QtWidgets/QOpenGLWidget>
#include <QtGui/QOpenGLFunctions>
#include <QtGui/QPainter>
+#include <QtWidgets/QGraphicsView>
+#include <QtWidgets/QGraphicsScene>
+#include <QtWidgets/QGraphicsRectItem>
+#include <QtWidgets/QVBoxLayout>
+#include <QtWidgets/QPushButton>
#include <QtTest/QtTest>
#include <QSignalSpy>
@@ -49,6 +54,7 @@ private slots:
void painter();
void reparentToAlreadyCreated();
void reparentToNotYetCreated();
+ void asViewport();
};
void tst_QOpenGLWidget::create()
@@ -253,6 +259,52 @@ void tst_QOpenGLWidget::reparentToNotYetCreated()
QVERIFY(image.pixel(20, 10) == qRgb(0, 0, 255));
}
+class CountingGraphicsView : public QGraphicsView
+{
+public:
+ CountingGraphicsView(): m_count(0) { }
+ int paintCount() const { return m_count; }
+ void resetPaintCount() { m_count = 0; }
+
+protected:
+ void drawForeground(QPainter *, const QRectF &) Q_DECL_OVERRIDE;
+ int m_count;
+};
+
+void CountingGraphicsView::drawForeground(QPainter *, const QRectF &)
+{
+ ++m_count;
+}
+
+void tst_QOpenGLWidget::asViewport()
+{
+ // Have a QGraphicsView with a QOpenGLWidget as its viewport.
+ QGraphicsScene scene;
+ scene.addItem(new QGraphicsRectItem(10, 10, 100, 100));
+ CountingGraphicsView *view = new CountingGraphicsView;
+ view->setScene(&scene);
+ view->setViewport(new QOpenGLWidget);
+ QWidget widget;
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(view);
+ QPushButton *btn = new QPushButton("Test");
+ layout->addWidget(btn);
+ widget.setLayout(layout);
+ widget.show();
+ QTest::qWaitForWindowExposed(&widget);
+
+ QVERIFY(view->paintCount() > 0);
+ view->resetPaintCount();
+
+ // And now trigger a repaint on the push button. We must not
+ // receive paint events for the graphics view. If we do, that's a
+ // side effect of QOpenGLWidget's special behavior and handling in
+ // the widget stack.
+ btn->update();
+ qApp->processEvents();
+ QVERIFY(view->paintCount() == 0);
+}
+
QTEST_MAIN(tst_QOpenGLWidget)
#include "tst_qopenglwidget.moc"
diff --git a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp
index 78f30f4e42..cb0383c398 100644
--- a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp
+++ b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp
@@ -151,7 +151,7 @@ void tst_QScrollBar::task_209492()
#define WHEEL_DELTA 120 // copied from tst_QAbstractSlider / tst_QComboBox
void tst_QScrollBar::QTBUG_27308()
{
- // https://bugreports.qt-project.org/browse/QTBUG-27308
+ // QTBUG-27308
// Check that a disabled scrollbar doesn't react on wheel events anymore
QScrollBar testWidget(Qt::Horizontal);