diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-05-27 14:53:08 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-28 16:52:04 +0200 |
commit | 3478ec29494c315c4e41f25a1265da928503694b (patch) | |
tree | 3e096c8909ae82c53f21eb85b3cb8aafd2dd75a2 /tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | |
parent | 52ff4120a29e915215ea06499ae08e17ba997074 (diff) |
Move native subwidgets in QWidget::scroll().
Task-number: QTBUG-38999
Change-Id: Ie22dcf61895bbfc575eaae4d1929516a8749de39
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp')
-rw-r--r-- | tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 2a70431223..34936fa5b8 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -288,6 +288,7 @@ private slots: #ifndef Q_OS_MAC void scroll(); + void scrollNativeChildren(); #endif // tests QWidget::setGeometry() @@ -4336,7 +4337,30 @@ void tst_QWidget::scroll() QTRY_COMPARE(updateWidget.paintedRegion, dirty); } } -#endif + +// QTBUG-38999, scrolling a widget with native child widgets should move the children. +void tst_QWidget::scrollNativeChildren() +{ + QWidget parent; + parent.setWindowTitle(QLatin1String(__FUNCTION__)); + parent.resize(400, 400); + centerOnScreen(&parent); + QLabel *nativeLabel = new QLabel(QStringLiteral("nativeLabel"), &parent); + const QPoint oldLabelPos(100, 100); + nativeLabel->move(oldLabelPos); + QVERIFY(nativeLabel->winId()); + parent.show(); + QVERIFY(QTest::qWaitForWindowExposed(&parent)); + const QPoint delta(50, 50); + parent.scroll(delta.x(), delta.y()); + const QPoint newLabelPos = oldLabelPos + delta; + QWindow *labelWindow = nativeLabel->windowHandle(); + QVERIFY(labelWindow); + QTRY_COMPARE(labelWindow->geometry().topLeft(), newLabelPos); + QTRY_COMPARE(nativeLabel->geometry().topLeft(), newLabelPos); +} + +#endif // Mac OS class DestroyedSlotChecker : public QObject { |