From 28b4eb0a10b922581f4f7c6a7cdc60383a35a578 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Tue, 27 Jul 2010 10:52:56 +0200 Subject: Fixed QListWidget autotest to use a dummy toplevel widget --- tests/auto/qlistwidget/tst_qlistwidget.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp index eb3fb6b..990945d 100644 --- a/tests/auto/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp @@ -1499,6 +1499,11 @@ void tst_QListWidget::itemWidget() class MyListWidget : public QListWidget { public: + MyListWidget(QWidget *parent=0) + : QListWidget(parent) + { + } + void paintEvent(QPaintEvent *e) { painted += e->region(); QListWidget::paintEvent(e); @@ -1513,14 +1518,16 @@ void tst_QListWidget::fastScroll() QSKIP("S60 style doesn't support fast scrolling", SkipAll); } - MyListWidget widget; + QWidget topLevel; + MyListWidget widget(&topLevel); for (int i = 0; i < 50; ++i) widget.addItem(QString("Item %1").arg(i)); - widget.show(); + topLevel.show(); // Make sure the widget gets the first full repaint. On // some WMs, we'll get two (first inactive exposure, then // active exposure. + QTest::qWaitForWindowShown(&widget); #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&widget); #endif @@ -1531,6 +1538,7 @@ void tst_QListWidget::fastScroll() QVERIFY(!itemSize.isEmpty()); QScrollBar *sbar = widget.verticalScrollBar(); + widget.setVerticalScrollMode(QAbstractItemView::ScrollPerItem); widget.painted = QRegion(); sbar->setValue(sbar->value() + sbar->singleStep()); QApplication::processEvents(); -- cgit v0.12