summaryrefslogtreecommitdiffstats
path: root/tests/testmerge.cpp
diff options
context:
space:
mode:
authorGravatar Jeremie Guichard <djebrest@gmail.com>2017-03-03 13:33:25 +0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-03-04 12:03:33 -0800
commit5caa9b23fe3195c758f9b6f1a9ab5f7bf88ee45c (patch)
tree0eb92e14fdda8fc9b8f858df3204970b2ce2fde7 /tests/testmerge.cpp
parent16a321d43b654cd756f5e2b54d72bad80e493b69 (diff)
downloadsubsurface-5caa9b23fe3195c758f9b6f1a9ab5f7bf88ee45c.tar.gz
Use QTest cleanup method for proper test shutdown
In case of QCOMPARE failure, code following the comparison is not executed, this results in application state not being properly resorted and often gives several test failures, when only one test really fails. Using QTest cleanup method allows restoring proper state, before next test is executed. Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
Diffstat (limited to 'tests/testmerge.cpp')
-rw-r--r--tests/testmerge.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/testmerge.cpp b/tests/testmerge.cpp
index 450aba2e9..8c2b3482d 100644
--- a/tests/testmerge.cpp
+++ b/tests/testmerge.cpp
@@ -10,6 +10,11 @@ void TestMerge::initTestCase()
Q_INIT_RESOURCE(subsurface);
}
+void TestMerge::cleanup()
+{
+ clear_dive_file_data();
+}
+
void TestMerge::testMergeEmpty()
{
/*
@@ -31,7 +36,6 @@ void TestMerge::testMergeEmpty()
while(readin.size() && written.size()){
QCOMPARE(written.takeFirst().trimmed(), readin.takeFirst().trimmed());
}
- clear_dive_file_data();
}
void TestMerge::testMergeBackwards()
@@ -55,7 +59,6 @@ void TestMerge::testMergeBackwards()
while(readin.size() && written.size()){
QCOMPARE(written.takeFirst().trimmed(), readin.takeFirst().trimmed());
}
- clear_dive_file_data();
}
QTEST_GUILESS_MAIN(TestMerge)