mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Add test for import, merge and renumbering
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f0a176149a
commit
cb112f9ac5
3 changed files with 54 additions and 0 deletions
|
@ -583,6 +583,7 @@ if(NOT NO_TESTS)
|
|||
TEST(TestParse testparse.cpp)
|
||||
TEST(TestPlan testplan.cpp)
|
||||
TEST(TestDiveSiteDuplication testdivesiteduplication.cpp)
|
||||
TEST(TestRenumber testrenumber.cpp)
|
||||
TEST(TestGitStorage testgitstorage.cpp)
|
||||
endif()
|
||||
|
||||
|
|
38
tests/testrenumber.cpp
Normal file
38
tests/testrenumber.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
#include "windowtitleupdate.h"
|
||||
#include "testrenumber.h"
|
||||
#include "dive.h"
|
||||
#include "file.h"
|
||||
#include "divelist.h"
|
||||
#include <QTextStream>
|
||||
|
||||
void TestRenumber::setup()
|
||||
{
|
||||
WindowTitleUpdate *wtu = new WindowTitleUpdate();
|
||||
QCOMPARE(parse_file(SUBSURFACE_SOURCE "/dives/test47.xml"), 0);
|
||||
process_dives(false, false);
|
||||
dive_table.preexisting = dive_table.nr;
|
||||
}
|
||||
|
||||
void TestRenumber::testMerge()
|
||||
{
|
||||
QCOMPARE(parse_file(SUBSURFACE_SOURCE "/dives/test47b.xml"), 0);
|
||||
process_dives(true, false);
|
||||
QCOMPARE(dive_table.nr, 1);
|
||||
QCOMPARE(unsaved_changes(), 1);
|
||||
mark_divelist_changed(false);
|
||||
dive_table.preexisting = dive_table.nr;
|
||||
}
|
||||
|
||||
void TestRenumber::testMergeAndAppend()
|
||||
{
|
||||
QCOMPARE(parse_file(SUBSURFACE_SOURCE "/dives/test47c.xml"), 0);
|
||||
process_dives(true, false);
|
||||
QCOMPARE(dive_table.nr, 2);
|
||||
QCOMPARE(unsaved_changes(), 1);
|
||||
struct dive *d = get_dive(1);
|
||||
QVERIFY(d != NULL);
|
||||
if (d)
|
||||
QCOMPARE(d->number, 2);
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestRenumber)
|
15
tests/testrenumber.h
Normal file
15
tests/testrenumber.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
#ifndef TESTRENUMBER_H
|
||||
#define TESTRENUMBER_H
|
||||
|
||||
#include <QtTest>
|
||||
|
||||
class TestRenumber : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void setup();
|
||||
void testMerge();
|
||||
void testMergeAndAppend();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue