summaryrefslogtreecommitdiffstats
path: root/tests/testgitstorage.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-09-23 12:53:35 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-09-23 11:50:53 -0700
commit35b8a4f404de3297cb8d126654e0ec37245a7537 (patch)
tree4d44463ad16f3661d45902eaa0fc80827f106e19 /tests/testgitstorage.cpp
parent0ae57cfe921d6107848a7a66deb16861affffc89 (diff)
downloadsubsurface-35b8a4f404de3297cb8d126654e0ec37245a7537.tar.gz
Core: split process_dives() in post-import and post-load versions
process_dives() is used to post-process the dive table after loading or importing. The first parameter states whether this was after load or import. Especially in the light of undo, load and import are fundamentally different things. Notably, that latter should be undo-able, whereas the former is not. Therefore, as a first step to make import undo-able, split the function in two versions and remove the first parameter. It turns out the the load-version is very light. It only sets the DC nicknames and sorts the dive-table. There seems to be no reason to merge dives. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'tests/testgitstorage.cpp')
-rw-r--r--tests/testgitstorage.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/testgitstorage.cpp b/tests/testgitstorage.cpp
index 5184aeb2a..f9e3e2d6c 100644
--- a/tests/testgitstorage.cpp
+++ b/tests/testgitstorage.cpp
@@ -137,9 +137,9 @@ void TestGitStorage::testGitStorageCloudOfflineSync()
// read the local repo from the previous test and add dive 10
QCOMPARE(parse_file(qPrintable(localCacheRepo), &dive_table), 0);
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test10.xml", &dive_table), 0);
- // calling process_dive() sorts the table, but calling it with
- // is_imported == true causes it to try to update the window title... let's not do that
- process_dives(false, false);
+ // calling process_loaded_dives() sorts the table, but calling process_imported_dives()
+ // causes it to try to update the window title... let's not do that
+ process_loaded_dives();
// now save only to the local cache but not to the remote server
QCOMPARE(save_dives(qPrintable(localCacheRepo)), 0);
QCOMPARE(save_dives("./SampleDivesV3plus10local.ssrf"), 0);
@@ -186,14 +186,14 @@ void TestGitStorage::testGitStorageCloudMerge()
QString localCacheRepoSave = localCacheDir + "save[ssrftest@hohndel.org]";
QCOMPARE(parse_file(qPrintable(localCacheRepoSave), &dive_table), 0);
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test11.xml", &dive_table), 0);
- process_dives(false, false);
+ process_loaded_dives();
QCOMPARE(save_dives(qPrintable(localCacheRepoSave)), 0);
clear_dive_file_data();
// now we open the cloud storage repo and add a different dive to it
QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table), 0);
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test12.xml", &dive_table), 0);
- process_dives(false, false);
+ process_loaded_dives();
QCOMPARE(save_dives(qPrintable(cloudTestRepo)), 0);
clear_dive_file_data();
@@ -208,9 +208,9 @@ void TestGitStorage::testGitStorageCloudMerge()
clear_dive_file_data();
QCOMPARE(parse_file("./SampleDivesV3plus10local.ssrf", &dive_table), 0);
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test11.xml", &dive_table), 0);
- process_dives(false, false);
+ process_loaded_dives();
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/test12.xml", &dive_table), 0);
- process_dives(false, false);
+ process_loaded_dives();
QCOMPARE(save_dives("./SampleDivesV3plus10-11-12.ssrf"), 0);
QFile org("./SampleDivesV3plus10-11-12-merged.ssrf");
org.open(QFile::ReadOnly);
@@ -232,7 +232,7 @@ void TestGitStorage::testGitStorageCloudMerge2()
QString localCacheDir(get_local_dir("https://cloud.subsurface-divelog.org/git/ssrftest@hohndel.org", "ssrftest@hohndel.org"));
QString localCacheRepo = localCacheDir + "[ssrftest@hohndel.org]";
QCOMPARE(parse_file(qPrintable(localCacheRepo), &dive_table), 0);
- process_dives(false, false);
+ process_loaded_dives();
struct dive *dive = get_dive(1);
delete_single_dive(1);
QCOMPARE(save_dives("./SampleDivesMinus1.ssrf"), 0);
@@ -248,7 +248,7 @@ void TestGitStorage::testGitStorageCloudMerge2()
}
// now we open the cloud storage repo and modify that first dive
QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table), 0);
- process_dives(false, false);
+ process_loaded_dives();
dive = get_dive(1);
QVERIFY(dive != NULL);
free(dive->notes);
@@ -288,7 +288,7 @@ void TestGitStorage::testGitStorageCloudMerge3()
QString localCacheDir(get_local_dir("https://cloud.subsurface-divelog.org/git/ssrftest@hohndel.org", "ssrftest@hohndel.org"));
QString localCacheRepo = localCacheDir + "[ssrftest@hohndel.org]";
QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table), 0);
- process_dives(false, false);
+ process_loaded_dives();
struct dive *dive = get_dive(0);
QVERIFY(dive != 0);
dive->notes = strdup("Create multi line dive notes\nLine 2\nLine 3\nLine 4\nLine 5\nThat should be enough");
@@ -300,7 +300,7 @@ void TestGitStorage::testGitStorageCloudMerge3()
clear_dive_file_data();
QCOMPARE(parse_file(qPrintable(localCacheRepo), &dive_table), 0);
- process_dives(false, false);
+ process_loaded_dives();
dive = get_dive(0);
dive->notes = strdup("Create multi line dive notes\nDifferent line 2 and removed 3-5\n\nThat should be enough");
dive = get_dive(1);
@@ -319,7 +319,7 @@ void TestGitStorage::testGitStorageCloudMerge3()
}
// now we open the cloud storage repo and modify those first dive notes differently
QCOMPARE(parse_file(qPrintable(cloudTestRepo), &dive_table), 0);
- process_dives(false, false);
+ process_loaded_dives();
dive = get_dive(0);
dive->notes = strdup("Completely different dive notes\nBut also multi line");
dive = get_dive(1);