summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlistwidget/tst_qlistwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qlistwidget/tst_qlistwidget.cpp')
-rw-r--r--tests/auto/qlistwidget/tst_qlistwidget.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp
index eb3fb6b..6cfd6c5 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,17 @@ 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.resize(300, 300); // toplevel needs to be wide enough for the item
+ 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 +1539,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();