summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-04-08 23:38:00 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-09 10:47:06 +0200
commit82934f11e06f1b1c4084c8fd4bac2e1787f0042a (patch)
tree09bfefc58b34397c69f39d4cddc57aedcef462f1 /tests/auto
parent04f6dffbf9f9b476eed74006de15ad837162e04e (diff)
Stabilize tst_QListWidget
Replace weird QEventLoop hacks by sending all posted deferred delete events. Change-Id: I6da743f2b3fb6ef5dfc960dd3d752973cd511037 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp19
1 files changed, 3 insertions, 16 deletions
diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
index 153144db63..e02ab0064c 100644
--- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
+++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
@@ -43,7 +43,6 @@
#include <QtTest/QtTest>
#include <QtGui/QtGui>
#include <QtWidgets/QtWidgets>
-#include <qeventloop.h>
#include <qlist.h>
#include <qlistwidget.h>
@@ -209,14 +208,7 @@ void tst_QListWidget::cleanupTestCase()
void tst_QListWidget::init()
{
testWidget->clear();
-
- if (testWidget->viewport()->children().count() > 0) {
- QEventLoop eventLoop;
- for (int i=0; i < testWidget->viewport()->children().count(); ++i)
- connect(testWidget->viewport()->children().at(i), SIGNAL(destroyed()), &eventLoop, SLOT(quit()));
- QTimer::singleShot(100, &eventLoop, SLOT(quit()));
- eventLoop.exec();
- }
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
}
void tst_QListWidget::checkDefaultValues()
@@ -317,12 +309,7 @@ void tst_QListWidget::closePersistentEditor()
// actual test
childCount = testWidget->viewport()->children().count();
testWidget->closePersistentEditor(item);
- // Spin the event loop and hopefully it will die.
- QEventLoop eventLoop;
- for (int i=0; i < childCount; ++i)
- connect(testWidget->viewport()->children().at(i), SIGNAL(destroyed()), &eventLoop, SLOT(quit()));
- QTimer::singleShot(100, &eventLoop, SLOT(quit()));
- eventLoop.exec();
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QCOMPARE(testWidget->viewport()->children().count(), childCount - 1);
}