mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 17:53:24 +00:00
ccdd92aeb7
This is a messy commit, because the "qPref" system relies heavily on QString, which means lots of conversions between the two worlds. Ultimately, I plan to base the preferences system on std::string and only convert to QString when pushing through Qt's property system or when writing into Qt's settings. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
39 lines
1,009 B
C++
39 lines
1,009 B
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#include "testrenumber.h"
|
|
#include "core/device.h"
|
|
#include "core/dive.h"
|
|
#include "core/divelog.h"
|
|
#include "core/divesite.h"
|
|
#include "core/trip.h"
|
|
#include "core/file.h"
|
|
#include "core/pref.h"
|
|
#include <QTextStream>
|
|
|
|
void TestRenumber::setup()
|
|
{
|
|
prefs.cloud_base_url = default_prefs.cloud_base_url;
|
|
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &divelog), 0);
|
|
process_loaded_dives();
|
|
}
|
|
|
|
void TestRenumber::testMerge()
|
|
{
|
|
struct divelog log;
|
|
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47b.xml", &log), 0);
|
|
add_imported_dives(log, IMPORT_MERGE_ALL_TRIPS);
|
|
QCOMPARE(divelog.dives.size(), 1);
|
|
}
|
|
|
|
void TestRenumber::testMergeAndAppend()
|
|
{
|
|
struct divelog log;
|
|
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47c.xml", &log), 0);
|
|
add_imported_dives(log, IMPORT_MERGE_ALL_TRIPS);
|
|
QCOMPARE(divelog.dives.size(), 2);
|
|
struct dive *d = get_dive(1);
|
|
QVERIFY(d != NULL);
|
|
if (d)
|
|
QCOMPARE(d->number, 2);
|
|
}
|
|
|
|
QTEST_GUILESS_MAIN(TestRenumber)
|