summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Richardson <arichardson.kde@gmail.com>2015-08-15 00:06:58 (GMT)
committerAlex Richardson <arichardson.kde@gmail.com>2015-08-19 14:14:12 (GMT)
commit461c963cb8a63c68beb463a87f3944d0a59e98e7 (patch)
tree1885258508bc6bd60e956daf7248b9041c57dafd
parentad333314bce6b54acdcb1e813d52243fbccc36b1 (diff)
use QTRY_VERIFY/QTRY_COMPARE instead of qWait() loop
-rw-r--r--autotests/mainshelltest.cpp22
1 files changed, 4 insertions, 18 deletions
diff --git a/autotests/mainshelltest.cpp b/autotests/mainshelltest.cpp
index 232705f..cb2f464 100644
--- a/autotests/mainshelltest.cpp
+++ b/autotests/mainshelltest.cpp
@@ -303,10 +303,7 @@ void MainShellTest::testShell()
if (useTabs || unique)
{
// It is attaching to us, so will eventually stop
- for (int i = 0; p.state() != QProcess::NotRunning && i < 20; ++i) {
- QTest::qWait(100);
- }
- QCOMPARE(p.state(), QProcess::NotRunning);
+ QTRY_COMPARE_WITH_TIMEOUT(p.state(), QProcess::NotRunning, 2000);
QCOMPARE(p.exitStatus(), QProcess::NormalExit);
QCOMPARE(p.exitCode(), 0);
@@ -347,12 +344,7 @@ void MainShellTest::testShell()
{
QCOMPARE(paths.count(), 1);
Okular::Part *part = s->findChild<Okular::Part*>();
-
- // Oh Qt5 i want your QTRY_VERIFY
- for (int i = 0; presentationWidget(part) == 0 && i < 20; ++i) {
- QTest::qWait(100);
- }
- QVERIFY(presentationWidget(part) != 0);
+ QTRY_VERIFY(presentationWidget(part) != 0);
}
if (externalProcessExpectPresentation)
@@ -369,10 +361,7 @@ void MainShellTest::testShell()
part = dynamic_cast<Okular::Part*>(s->m_tabs[1].part);
}
- for (int i = 0; presentationWidget(part) == 0 && i < 20; ++i) {
- QTest::qWait(100);
- }
- QVERIFY(presentationWidget(part) != 0);
+ QTRY_VERIFY(presentationWidget(part) != 0);
}
if (helper)
@@ -448,10 +437,7 @@ void MainShellTest::testFileRemembersPagePosition()
QCOMPARE(p.state(), QProcess::Running);
// It is attaching to us, so will eventually stop
- for (int i = 0; p.state() != QProcess::NotRunning && i < 20; ++i) {
- QTest::qWait(100);
- }
- QCOMPARE((int)p.state(), (int)QProcess::NotRunning);
+ QTRY_COMPARE_WITH_TIMEOUT((int)p.state(), (int)QProcess::NotRunning, 2000);
QCOMPARE((int)p.exitStatus(), (int)QProcess::NormalExit);
QCOMPARE(p.exitCode(), 0);
}