summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 4ddc6c4..e148fdb 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -67,6 +67,7 @@
#include <qcalendarwidget.h>
#include <qmainwindow.h>
#include <QtGui/qpaintengine.h>
+#include <private/qbackingstore_p.h>
#ifdef Q_WS_S60
#include <avkon.hrh> // EEikStatusPaneUidTitle
@@ -361,6 +362,8 @@ private slots:
void focusWidget_task254563();
+ void destroyBackingStore();
+
private:
bool ensureScreenSize(int width, int height);
QWidget *testWidget;
@@ -9199,5 +9202,31 @@ void tst_QWidget::focusWidget_task254563()
QVERIFY(top.focusWidget() != widget); //dangling pointer
}
+void tst_QWidget::destroyBackingStore()
+{
+ UpdateWidget w;
+ w.show();
+
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&w);
+#endif
+ QApplication::processEvents();
+
+ w.reset();
+ w.update();
+ delete qt_widget_private(&w)->topData()->backingStore;
+ qt_widget_private(&w)->topData()->backingStore = 0;
+ qt_widget_private(&w)->topData()->backingStore = new QWidgetBackingStore(&w);
+
+ w.update();
+ QApplication::processEvents();
+ QCOMPARE(w.numPaintEvents, 1);
+
+ // Check one more time, because the second time around does more caching.
+ w.update();
+ QApplication::processEvents();
+ QCOMPARE(w.numPaintEvents, 2);
+}
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"