diff options
author | axis <qt-info@nokia.com> | 2009-11-26 14:56:42 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-11-26 14:56:42 (GMT) |
commit | 236d8ad3aedd09e905df97412380545d0986be2c (patch) | |
tree | 79b9e59bb232f2d5bd2b3ea6c1d93d095b8aa32b /tests | |
parent | d014d49c88d4fa31c46afb2c252e481177b30a55 (diff) | |
parent | 4160adc44a512a97d333227cfdde0648fb4132a9 (diff) | |
download | Qt-236d8ad3aedd09e905df97412380545d0986be2c.zip Qt-236d8ad3aedd09e905df97412380545d0986be2c.tar.gz Qt-236d8ad3aedd09e905df97412380545d0986be2c.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6-staging2
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qwidget/tst_qwidget.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 1e3f5f8..9960f47 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -391,6 +391,7 @@ private slots: #endif void focusProxyAndInputMethods(); + void scrollWithoutBackingStore(); private: bool ensureScreenSize(int width, int height); @@ -9703,5 +9704,42 @@ void tst_QWidget::focusProxyAndInputMethods() delete toplevel; } +class scrollWidgetWBS : public QWidget +{ +public: + void deleteBackingStore() + { + if (static_cast<QWidgetPrivate*>(d_ptr.data())->maybeBackingStore()) { + delete static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore; + static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore = 0; + } + } + void enableBackingStore() + { + if (!static_cast<QWidgetPrivate*>(d_ptr.data())->maybeBackingStore()) { + static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore = new QWidgetBackingStore(this); + static_cast<QWidgetPrivate*>(d_ptr.data())->invalidateBuffer(this->rect()); + repaint(); + } + } +}; + +void tst_QWidget::scrollWithoutBackingStore() +{ + scrollWidgetWBS scrollable; + scrollable.resize(100,100); + QLabel child(QString("@"),&scrollable); + child.resize(50,50); + scrollable.show(); + QTest::qWaitForWindowShown(&scrollable); + scrollable.scroll(50,50); + QCOMPARE(child.pos(),QPoint(50,50)); + scrollable.deleteBackingStore(); + scrollable.scroll(-25,-25); + QCOMPARE(child.pos(),QPoint(25,25)); + scrollable.enableBackingStore(); + QCOMPARE(child.pos(),QPoint(25,25)); +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" |