diff options
Diffstat (limited to 'tests/testgitstorage.cpp')
-rw-r--r-- | tests/testgitstorage.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
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 |