┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/tests/dolphinviewtest_allviewmodes.cpp
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2011-04-14 12:57:46 +0200
committerFrank Reininghaus <[email protected]>2011-04-14 13:10:33 +0200
commit6d7e993c26d17582402adf3d662a0f5b16e684a7 (patch)
tree3469f644727d9885b3fada157b2f3c1780807c5b /src/tests/dolphinviewtest_allviewmodes.cpp
parente152885d9435a6049cf033addbae6fa303900794 (diff)
Improve stability of unit tests when running them with Valgrind
I noticed unexpected unit test failures when running the tests with Valgrind. The reason was that test execution was slowed down a lot, such that that TestBase::waitForFinishedPathLoading() did not receive the view's signal within the default timeout of 2 seconds, and that this failure was not detected in every test -> the tests failed later on because not all expected items had been loaded yet. To fix this, I changed two things: 1. Added an assert in TestBase::waitForFinishedPathLoading() that checks if the signal has been received. Continuing does not make much sense if that is not the case. 2. Increased the default timeout to 20 seconds. The reason why there is a finite timeout at all is that I didn't want to waste too much time on machines where the file kioslave seems to have problems loading a directory (I've seen corresponding test logs at cdash.org). However, with the first change I mentioned above, the waiting time is lost only once (due to the assert) rather than every time a directory is loaded -> I think that the timeout increase does not lead to an increased waste of time on such machines.
Diffstat (limited to 'src/tests/dolphinviewtest_allviewmodes.cpp')
-rw-r--r--src/tests/dolphinviewtest_allviewmodes.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tests/dolphinviewtest_allviewmodes.cpp b/src/tests/dolphinviewtest_allviewmodes.cpp
index 409b1b0ac..79c3ed478 100644
--- a/src/tests/dolphinviewtest_allviewmodes.cpp
+++ b/src/tests/dolphinviewtest_allviewmodes.cpp
@@ -198,7 +198,7 @@ void DolphinViewTest_AllViewModes::testViewPropertySettings()
// Show hidden files. This triggers the dir lister
// -> we have to wait until loading the hidden files is finished
view.setShowHiddenFiles(true);
- QVERIFY(waitForFinishedPathLoading(&view));
+ waitForFinishedPathLoading(&view);
QVERIFY(view.showHiddenFiles());
QCOMPARE(viewItems(&view), QStringList() << ".f" << "a" << "b" << "c" << "d" << "e");
@@ -332,12 +332,12 @@ void DolphinViewTest_AllViewModes::testSaveAndRestoreState()
// Change the URL
view.setUrl(dir.name() + "51");
- QVERIFY(waitForFinishedPathLoading(&view));
+ waitForFinishedPathLoading(&view);
qApp->sendPostedEvents();
// Go back, but do not call DolphinView::restoreState()
view.setUrl(dir.url());
- QVERIFY(waitForFinishedPathLoading(&view));
+ waitForFinishedPathLoading(&view);
qApp->sendPostedEvents();
// Verify that the view is scrolled to top-left corner and that item 45 is not the current item.
@@ -351,7 +351,7 @@ void DolphinViewTest_AllViewModes::testSaveAndRestoreState()
// Change the URL again
view.setUrl(dir.name() + "51");
- QVERIFY(waitForFinishedPathLoading(&view));
+ waitForFinishedPathLoading(&view);
qApp->sendPostedEvents();
// Check that the current item and scroll position are correct if DolphinView::restoreState()
@@ -359,7 +359,7 @@ void DolphinViewTest_AllViewModes::testSaveAndRestoreState()
view.setUrl(dir.url());
QDataStream restoreStream(viewState);
view.restoreState(restoreStream);
- QVERIFY(waitForFinishedPathLoading(&view));
+ waitForFinishedPathLoading(&view);
qApp->sendPostedEvents();
QCOMPARE(itemView(&view)->currentIndex(), index45);
@@ -391,7 +391,7 @@ void DolphinViewTest_AllViewModes::testSaveAndRestoreState()
qApp->sendPostedEvents();
if (!spy.isEmpty()) {
// The dir lister reloads the directory. We wait until the loading is finished.
- QVERIFY(waitForFinishedPathLoading(&view));
+ waitForFinishedPathLoading(&view);
}
// Current item and scroll position should not change.
@@ -555,7 +555,7 @@ QAbstractItemView* DolphinViewTest_AllViewModes::initView(DolphinView* view) con
// while we were waiting in QTest::qWaitForWindowShown(view)
// -> waitForFinishedPathLoading(view) would fail in that case.
if (spyFinishedPathLoading.isEmpty()) {
- Q_ASSERT(waitForFinishedPathLoading(view));
+ waitForFinishedPathLoading(view);
}
return itemView(view);