diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-06-17 22:45:33 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-09-29 16:13:03 -0700 |
commit | 41cf83583d129edde607654592a52fe7bff57dc7 (patch) | |
tree | 7127476f88358f2248b22684c01f127997380d43 /tests | |
parent | cef15c978d466af37a0f453c50f2e8942ed7cdc2 (diff) | |
download | subsurface-41cf83583d129edde607654592a52fe7bff57dc7.tar.gz |
filter: load filter presets from XML files
This is a bit painful: since we don't want to modify the filter
presets when the user imports (as opposed to opens) a log,
we have to provide a table where the parser stores the presets.
Calling the parser is getting quite unwieldy, since many tables
are passed. We probably should introduce a structure representing
a full log-book at one point, which collects all the things that
are saved to the log.
Apart from that, this is simply the counterpart to saving to XML.
The interpretation of the string data is performed by core
functions, not the parser itself to avoid code duplication with
the git parser.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testAirPressure.cpp | 4 | ||||
-rw-r--r-- | tests/testdivesiteduplication.cpp | 2 | ||||
-rw-r--r-- | tests/testgitstorage.cpp | 52 | ||||
-rw-r--r-- | tests/testmerge.cpp | 10 | ||||
-rw-r--r-- | tests/testparse.cpp | 34 | ||||
-rw-r--r-- | tests/testparseperformance.cpp | 6 | ||||
-rw-r--r-- | tests/testpicture.cpp | 2 | ||||
-rw-r--r-- | tests/testprofile.cpp | 2 | ||||
-rw-r--r-- | tests/testrenumber.cpp | 8 |
9 files changed, 62 insertions, 58 deletions
diff --git a/tests/testAirPressure.cpp b/tests/testAirPressure.cpp index f8144dd7c..73088df68 100644 --- a/tests/testAirPressure.cpp +++ b/tests/testAirPressure.cpp @@ -19,7 +19,7 @@ void TestAirPressure::get_dives() struct dive *dive; verbose = 1; - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/TestAtmPress.xml", &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/TestAtmPress.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); dive = get_dive(0); dive->selected = true; QVERIFY(dive != NULL); @@ -54,7 +54,7 @@ void TestAirPressure::testWriteReadBackAirPressure() dive->surface_pressure.mbar = ap; QCOMPARE(save_dives("./testout.ssrf"), 0); clear_dive_file_data(); - QCOMPARE(parse_file("./testout.ssrf", &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file("./testout.ssrf", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); dive = get_dive(0); QVERIFY(dive != NULL); dive->selected = true; diff --git a/tests/testdivesiteduplication.cpp b/tests/testdivesiteduplication.cpp index cdaa5eed7..ca706b618 100644 --- a/tests/testdivesiteduplication.cpp +++ b/tests/testdivesiteduplication.cpp @@ -7,7 +7,7 @@ void TestDiveSiteDuplication::testReadV2() { - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/TwoTimesTwo.ssrf", &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/TwoTimesTwo.ssrf", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); QCOMPARE(dive_site_table.nr, 2); } diff --git a/tests/testgitstorage.cpp b/tests/testgitstorage.cpp index 135b0dc3f..fb864f2a8 100644 --- a/tests/testgitstorage.cpp +++ b/tests/testgitstorage.cpp @@ -153,7 +153,7 @@ void TestGitStorage::initTestCase() // cleanup local and remote branches localRemoteCleanup(); - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); } void TestGitStorage::cleanupTestCase() @@ -185,7 +185,7 @@ void TestGitStorage::testGitStorageLocal() { // test writing and reading back from local git storage git_repository *repo; - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/SampleDivesV2.ssrf", &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/SampleDivesV2.ssrf", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); QFETCH(QString, testDirName); QFETCH(QString, prefixRead); QFETCH(QString, prefixWrite); @@ -198,7 +198,7 @@ void TestGitStorage::testGitStorageLocal() QCOMPARE(save_dives(qPrintable(repoNameWrite + "[test]")), 0); QCOMPARE(save_dives("./SampleDivesV3.ssrf"), 0); clear_dive_file_data(); - QCOMPARE(parse_file(qPrintable(repoNameRead + "[test]"), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(repoNameRead + "[test]"), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); QCOMPARE(save_dives("./SampleDivesV3viagit.ssrf"), 0); QFile org("./SampleDivesV3.ssrf"); org.open(QFile::ReadOnly); @@ -216,10 +216,10 @@ void TestGitStorage::testGitStorageCloud() // test writing and reading back from cloud storage // connect to the ssrftest repository on the cloud server // and repeat the same test as before with the local git storage - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/SampleDivesV2.ssrf", &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/SampleDivesV2.ssrf", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); QCOMPARE(save_dives(qPrintable(cloudTestRepo)), 0); clear_dive_file_data(); - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); QCOMPARE(save_dives("./SampleDivesV3viacloud.ssrf"), 0); QFile org("./SampleDivesV3.ssrf"); org.open(QFile::ReadOnly); @@ -237,8 +237,8 @@ void TestGitStorage::testGitStorageCloudOfflineSync() // make a change to local cache repo (pretending that we did some offline changes) // and then open the remote one again and check that things were propagated correctly // read the local repo from the previous test and add dive 10 - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test10.xml", &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test10.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); // calling process_loaded_dives() sorts the table, but calling add_imported_dives() // causes it to try to update the window title... let's not do that process_loaded_dives(); @@ -249,7 +249,7 @@ void TestGitStorage::testGitStorageCloudOfflineSync() clear_dive_file_data(); // now pretend that we are online again and open the cloud storage and compare git_local_only = false; - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); QCOMPARE(save_dives("./SampleDivesV3plus10viacloud.ssrf"), 0); QFile org("./SampleDivesV3plus10local.ssrf"); org.open(QFile::ReadOnly); @@ -264,7 +264,7 @@ void TestGitStorage::testGitStorageCloudOfflineSync() QCOMPARE(save_dives(qPrintable(cloudTestRepo)), 0); clear_dive_file_data(); moveDir(localCacheDir, localCacheDir + "save"); - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); QCOMPARE(save_dives("./SampleDivesV3plus10fromcloud.ssrf"), 0); org.close(); org.open(QFile::ReadOnly); @@ -293,8 +293,8 @@ void TestGitStorage::testGitStorageCloudMerge() // (1) open the repo, add dive test11 and save to the cloud git_local_only = false; - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test11.xml", &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test11.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); process_loaded_dives(); QCOMPARE(save_dives(qPrintable(cloudTestRepo)), 0); clear_dive_file_data(); @@ -305,27 +305,27 @@ void TestGitStorage::testGitStorageCloudMerge() // (3) open the repo from the old cache and add dive test12 while offline git_local_only = true; - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test12.xml", &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test12.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); process_loaded_dives(); QCOMPARE(save_dives(qPrintable(cloudTestRepo)), 0); clear_dive_file_data(); // (4) now take things back online git_local_only = false; - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); clear_dive_file_data(); // (5) now we should have all the dives in our repo on the second client // first create the reference data from the xml files: - QCOMPARE(parse_file("./SampleDivesV3plus10local.ssrf", &dive_table, &trip_table, &dive_site_table), 0); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test11.xml", &dive_table, &trip_table, &dive_site_table), 0); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test12.xml", &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file("./SampleDivesV3plus10local.ssrf", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test11.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test12.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); process_loaded_dives(); QCOMPARE(save_dives("./SampleDivesV3plus10-11-12.ssrf"), 0); // then load from the cloud clear_dive_file_data(); - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); process_loaded_dives(); QCOMPARE(save_dives("./SampleDivesV3plus10-11-12-merged.ssrf"), 0); // finally compare what we have @@ -342,7 +342,7 @@ void TestGitStorage::testGitStorageCloudMerge() // (6) move ourselves back to the first client and compare data there moveDir(localCacheDir + "client1", localCacheDir); - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); process_loaded_dives(); QCOMPARE(save_dives("./SampleDivesV3plus10-11-12-merged-client1.ssrf"), 0); QFile client1("./SampleDivesV3plus10-11-12-merged-client1.ssrf"); @@ -358,7 +358,7 @@ void TestGitStorage::testGitStorageCloudMerge2() // edit the same dive in the cloud repo // merge // (1) open repo, delete second dive, save offline - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); process_loaded_dives(); struct dive *dive = get_dive(1); delete_single_dive(1); @@ -372,7 +372,7 @@ void TestGitStorage::testGitStorageCloudMerge2() moveDir(localCacheDir, localCacheDir + "save"); // (3) now we open the cloud storage repo and modify that second dive - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); process_loaded_dives(); dive = get_dive(1); QVERIFY(dive != NULL); @@ -384,7 +384,7 @@ void TestGitStorage::testGitStorageCloudMerge2() // (4) move the saved local cache backinto place and try to open the cloud repo // -> this forces a merge moveDir(localCacheDir + "save", localCacheDir); - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); QCOMPARE(save_dives("./SampleDivesMinus1-merged.ssrf"), 0); QCOMPARE(save_dives(qPrintable(cloudTestRepo)), 0); QFile org("./SampleDivesMinus1-merged.ssrf"); @@ -407,7 +407,7 @@ void TestGitStorage::testGitStorageCloudMerge3() // (1) open repo, edit notes of first three dives - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); process_loaded_dives(); struct dive *dive; QVERIFY((dive = get_dive(0)) != 0); @@ -423,7 +423,7 @@ void TestGitStorage::testGitStorageCloudMerge3() clear_dive_file_data(); // (2) make different edits offline - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); process_loaded_dives(); QVERIFY((dive = get_dive(0)) != 0); free(dive->notes); @@ -442,7 +442,7 @@ void TestGitStorage::testGitStorageCloudMerge3() // (3) simulate a second system by moving the cache away and open the cloud storage repo and modify // those first dive notes differently while online moveDir(localCacheDir, localCacheDir + "save"); - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); process_loaded_dives(); QVERIFY((dive = get_dive(0)) != 0); free(dive->notes); @@ -458,7 +458,7 @@ void TestGitStorage::testGitStorageCloudMerge3() // (4) move the saved local cache back into place and open the cloud repo -> this forces a merge moveDir(localCacheDir + "save", localCacheDir); - QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); QCOMPARE(save_dives("./SampleDivesMerge3.ssrf"), 0); // we are not trying to compare this to a pre-determined result... what this test // checks is that there are no parsing errors with the merge diff --git a/tests/testmerge.cpp b/tests/testmerge.cpp index 7fa18756c..0652d479f 100644 --- a/tests/testmerge.cpp +++ b/tests/testmerge.cpp @@ -25,9 +25,10 @@ void TestMerge::testMergeEmpty() struct dive_table table = empty_dive_table; struct trip_table trips = empty_trip_table; struct dive_site_table sites = empty_dive_site_table; - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &table, &trips, &sites), 0); + filter_preset_table_t filter_presets; + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &table, &trips, &sites, &filter_presets), 0); add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml", &table, &trips, &sites), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml", &table, &trips, &sites, &filter_presets), 0); add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS); QCOMPARE(save_dives("./testmerge47+48.ssrf"), 0); QFile org(SUBSURFACE_TEST_DATA "/dives/test47+48.xml"); @@ -51,9 +52,10 @@ void TestMerge::testMergeBackwards() struct dive_table table = empty_dive_table; struct trip_table trips = empty_trip_table; struct dive_site_table sites = empty_dive_site_table; - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml", &table, &trips, &sites), 0); + filter_preset_table_t filter_presets; + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test48.xml", &table, &trips, &sites, &filter_presets), 0); add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &table, &trips, &sites), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &table, &trips, &sites, &filter_presets), 0); add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS); QCOMPARE(save_dives("./testmerge47+48.ssrf"), 0); QFile org(SUBSURFACE_TEST_DATA "/dives/test48+47.xml"); diff --git a/tests/testparse.cpp b/tests/testparse.cpp index 8e366a6fc..f5b93b996 100644 --- a/tests/testparse.cpp +++ b/tests/testparse.cpp @@ -108,7 +108,7 @@ int TestParse::parseCSV(int units, std::string file) params[pnr++] = intdup(-1); params[pnr++] = NULL; - return parse_manual_file(file.c_str(), params, pnr - 1, &dive_table, &trip_table, &dive_site_table); + return parse_manual_file(file.c_str(), params, pnr - 1, &dive_table, &trip_table, &dive_site_table, &filter_preset_table); } int TestParse::parseDivingLog() @@ -129,13 +129,13 @@ int TestParse::parseDivingLog() int TestParse::parseV2NoQuestion() { // parsing of a V2 file should work - return parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table, &dive_site_table); + return parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table); } int TestParse::parseV3() { // parsing of a V3 files should succeed - return parse_file(SUBSURFACE_TEST_DATA "/dives/test42.xml", &dive_table, &trip_table, &dive_site_table); + return parse_file(SUBSURFACE_TEST_DATA "/dives/test42.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table); } void TestParse::testParse() @@ -217,7 +217,7 @@ void TestParse::testParseHUDC() params[pnr++] = NULL; QCOMPARE(parse_csv_file(SUBSURFACE_TEST_DATA "/dives/TestDiveSeabearHUDC.csv", - params, pnr - 1, "csv", &dive_table, &trip_table, &dive_site_table), + params, pnr - 1, "csv", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); QCOMPARE(dive_table.nr, 1); @@ -262,7 +262,7 @@ void TestParse::testParseNewFormat() "/dives/") .append(files.at(i)) .toLatin1() - .data(), &dive_table, &trip_table, &dive_site_table), + .data(), &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); QCOMPARE(dive_table.nr, i + 1); } @@ -281,7 +281,7 @@ void TestParse::testParseDLD() QString filename = SUBSURFACE_TEST_DATA "/dives/TestDiveDivelogsDE.DLD"; QVERIFY(readfile(filename.toLatin1().data(), &mem) > 0); - QVERIFY(try_to_open_zip(filename.toLatin1().data(), &dive_table, &trip_table, &dive_site_table) > 0); + QVERIFY(try_to_open_zip(filename.toLatin1().data(), &dive_table, &trip_table, &dive_site_table, &filter_preset_table) > 0); fprintf(stderr, "number of dives from DLD: %d \n", dive_table.nr); @@ -296,8 +296,8 @@ void TestParse::testParseMerge() /* * check that we correctly merge mixed cylinder dives */ - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/ostc.xml", &dive_table, &trip_table, &dive_site_table), 0); - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/vyper.xml", &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/ostc.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/vyper.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); QCOMPARE(save_dives("./testmerge.ssrf"), 0); FILE_COMPARE("./testmerge.ssrf", SUBSURFACE_TEST_DATA "/dives/mergedVyperOstc.xml"); @@ -366,14 +366,14 @@ int TestParse::parseCSVmanual(int units, std::string file) params[pnr++] = intdup(units); params[pnr++] = NULL; - return parse_manual_file(file.c_str(), params, pnr - 1, &dive_table, &trip_table, &dive_site_table); + return parse_manual_file(file.c_str(), params, pnr - 1, &dive_table, &trip_table, &dive_site_table, &filter_preset_table); } void TestParse::exportCSVDiveDetails() { int saved_sac = 0; - parse_file(SUBSURFACE_TEST_DATA "/dives/test25.xml", &dive_table, &trip_table, &dive_site_table); + parse_file(SUBSURFACE_TEST_DATA "/dives/test25.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table); export_dives_xslt("testcsvexportmanual.csv", 0, 0, "xml2manualcsv.xslt", false); export_dives_xslt("testcsvexportmanualimperial.csv", 0, 1, "xml2manualcsv.xslt", false); @@ -409,7 +409,7 @@ void TestParse::exportSubsurfaceCSV() int pnr = 0; /* Test SubsurfaceCSV with multiple cylinders */ - parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table, &dive_site_table); + parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table); export_dives_xslt("testcsvexportmanual-cyl.csv", 0, 0, "xml2manualcsv.xslt", false); export_dives_xslt("testcsvexportmanualimperial-cyl.csv", 0, 1, "xml2manualcsv.xslt", false); @@ -426,7 +426,7 @@ void TestParse::exportSubsurfaceCSV() params[pnr++] = strdup("units"); params[pnr++] = intdup(1); params[pnr++] = 0; - parse_csv_file("testcsvexportmanualimperial-cyl.csv", params, pnr - 1, "SubsurfaceCSV", &dive_table, &trip_table, &dive_site_table); + parse_csv_file("testcsvexportmanualimperial-cyl.csv", params, pnr - 1, "SubsurfaceCSV", &dive_table, &trip_table, &dive_site_table, &filter_preset_table); // We do not currently support reading SAC, thus faking it if (dive_table.nr > 0) { @@ -470,12 +470,12 @@ int TestParse::parseCSVprofile(int units, std::string file) params[pnr++] = intdup(units); params[pnr++] = NULL; - return parse_csv_file(file.c_str(), params, pnr - 1, "csv", &dive_table, &trip_table, &dive_site_table); + return parse_csv_file(file.c_str(), params, pnr - 1, "csv", &dive_table, &trip_table, &dive_site_table, &filter_preset_table); } void TestParse::exportCSVDiveProfile() { - parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table, &dive_site_table); + parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table); export_dives_xslt("testcsvexportprofile.csv", 0, 0, "xml2csv.xslt", false); export_dives_xslt("testcsvexportprofileimperial.csv", 0, 1, "xml2csv.xslt", false); @@ -493,13 +493,13 @@ void TestParse::exportCSVDiveProfile() void TestParse::exportUDDF() { - parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table, &dive_site_table); + parse_file(SUBSURFACE_TEST_DATA "/dives/test40.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table); export_dives_xslt("testuddfexport.uddf", 0, 1, "uddf-export.xslt", false); clear_dive_file_data(); - parse_file("testuddfexport.uddf", &dive_table, &trip_table, &dive_site_table); + parse_file("testuddfexport.uddf", &dive_table, &trip_table, &dive_site_table, &filter_preset_table); export_dives_xslt("testuddfexport2.uddf", 0, 1, "uddf-export.xslt", false); FILE_COMPARE("testuddfexport.uddf", @@ -565,7 +565,7 @@ void TestParse::parseDL7() clear_dive_file_data(); QCOMPARE(parse_csv_file(SUBSURFACE_TEST_DATA "/dives/DL7.zxu", - params, pnr - 1, "DL7", &dive_table, &trip_table, &dive_site_table), + params, pnr - 1, "DL7", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); QCOMPARE(dive_table.nr, 3); diff --git a/tests/testparseperformance.cpp b/tests/testparseperformance.cpp index c80799cff..8ca850918 100644 --- a/tests/testparseperformance.cpp +++ b/tests/testparseperformance.cpp @@ -63,7 +63,7 @@ void TestParsePerformance::parseSsrf() return; } QBENCHMARK { - parse_file(SUBSURFACE_TEST_DATA "/dives/large-anon.ssrf", &dive_table, &trip_table, &dive_site_table); + parse_file(SUBSURFACE_TEST_DATA "/dives/large-anon.ssrf", &dive_table, &trip_table, &dive_site_table, &filter_preset_table); } } @@ -74,12 +74,12 @@ void TestParsePerformance::parseGit() // first parse this once to populate the local cache - this way network // effects don't dominate the parse time - parse_file(LARGE_TEST_REPO "[git]", &dive_table, &trip_table, &dive_site_table); + parse_file(LARGE_TEST_REPO "[git]", &dive_table, &trip_table, &dive_site_table, &filter_preset_table); cleanup(); QBENCHMARK { - parse_file(LARGE_TEST_REPO "[git]", &dive_table, &trip_table, &dive_site_table); + parse_file(LARGE_TEST_REPO "[git]", &dive_table, &trip_table, &dive_site_table, &filter_preset_table); } } diff --git a/tests/testpicture.cpp b/tests/testpicture.cpp index b5c6ae22a..c8215a09e 100644 --- a/tests/testpicture.cpp +++ b/tests/testpicture.cpp @@ -26,7 +26,7 @@ void TestPicture::addPicture() struct picture *pic1, *pic2; verbose = 1; - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test44.xml", &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test44.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); dive = get_dive(0); // Pictures will be added to selected dives dive->selected = true; diff --git a/tests/testprofile.cpp b/tests/testprofile.cpp index 9b4386ddf..22edb24de 100644 --- a/tests/testprofile.cpp +++ b/tests/testprofile.cpp @@ -15,7 +15,7 @@ void TestProfile::testProfileExport() { - parse_file("../dives/abitofeverything.ssrf", &dive_table, &trip_table, &dive_site_table); + parse_file("../dives/abitofeverything.ssrf", &dive_table, &trip_table, &dive_site_table, &filter_preset_table); save_profiledata("exportprofile.csv", false); QFile org("../dives/exportprofilereference.csv"); org.open(QFile::ReadOnly); diff --git a/tests/testrenumber.cpp b/tests/testrenumber.cpp index abb0058c1..e6b0f43fb 100644 --- a/tests/testrenumber.cpp +++ b/tests/testrenumber.cpp @@ -8,7 +8,7 @@ void TestRenumber::setup() { - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &dive_table, &trip_table, &dive_site_table), 0); + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47.xml", &dive_table, &trip_table, &dive_site_table, &filter_preset_table), 0); process_loaded_dives(); } @@ -17,7 +17,8 @@ void TestRenumber::testMerge() struct dive_table table = empty_dive_table; struct trip_table trips = empty_trip_table; struct dive_site_table sites = empty_dive_site_table; - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47b.xml", &table, &trips, &sites), 0); + filter_preset_table_t filter_presets; + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47b.xml", &table, &trips, &sites, &filter_presets), 0); add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS); QCOMPARE(dive_table.nr, 1); QCOMPARE(unsaved_changes(), 1); @@ -29,7 +30,8 @@ void TestRenumber::testMergeAndAppend() struct dive_table table = empty_dive_table; struct trip_table trips = empty_trip_table; struct dive_site_table sites = empty_dive_site_table; - QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47c.xml", &table, &trips, &sites), 0); + filter_preset_table_t filter_presets; + QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test47c.xml", &table, &trips, &sites, &filter_presets), 0); add_imported_dives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS); QCOMPARE(dive_table.nr, 2); QCOMPARE(unsaved_changes(), 1); |