From 82af1b2377cec03a989f86b8009d4ac226c6541e Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 3 Mar 2019 15:12:22 +0100 Subject: Undo: make undo-system dive site-aware As opposed to dive trips, dive sites were always directly added to the global table, even on import. Instead, parse the divesites into a distinct table and merge them on import. Currently, this does not do any merging of dive sites, i.e. dive sites are considered as either equal or different. Nevertheless, merging of data should be rather easy to implement and simply follow the code of the dive merging. Signed-off-by: Berthold Stoeger --- tests/testrenumber.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests/testrenumber.cpp') diff --git a/tests/testrenumber.cpp b/tests/testrenumber.cpp index d674c4922..71f4e2952 100644 --- a/tests/testrenumber.cpp +++ b/tests/testrenumber.cpp @@ -15,8 +15,9 @@ void TestRenumber::testMerge() { struct dive_table table = { 0 }; struct trip_table trips = { 0 }; - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47b.xml", &table, &trip_table, &dive_site_table), 0); - add_imported_dives(&table, &trips, IMPORT_MERGE_ALL_TRIPS); + struct dive_site_table sites = { 0 }; + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47b.xml", &table, &trips, &sites), 0); + add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS); QCOMPARE(dive_table.nr, 1); QCOMPARE(unsaved_changes(), 1); mark_divelist_changed(false); @@ -26,8 +27,9 @@ void TestRenumber::testMergeAndAppend() { struct dive_table table = { 0 }; struct trip_table trips = { 0 }; - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47c.xml", &table, &trip_table, &dive_site_table), 0); - add_imported_dives(&table, &trips, IMPORT_MERGE_ALL_TRIPS); + struct dive_site_table sites = { 0 }; + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47c.xml", &table, &trips, &sites), 0); + add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS); QCOMPARE(dive_table.nr, 2); QCOMPARE(unsaved_changes(), 1); struct dive *d = get_dive(1); -- cgit v1.2.3-70-g09d2