aboutsummaryrefslogtreecommitdiffstats
path: root/tests/testpicture.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-06-02 18:03:03 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-07-04 02:27:36 +0800
commit08962cb38dbd7e07d98397826c5192f0a4156143 (patch)
treeb974f574d8b68bd97f6b50bd0150fbd83ac6dd87 /tests/testpicture.cpp
parent5375eee4e6a6af1402c2bf8f7cce40fc4f5340f5 (diff)
downloadsubsurface-08962cb38dbd7e07d98397826c5192f0a4156143.tar.gz
Dive pictures: index local file name by canonical filname
The connection canonical filename to local filename was done via two maps: 1) canonical filename -> hash 2) hash -> local filename But the local filename was always queried from the canonical filename. Therefore, directly index the former with the latter. On startup, convert the old map to the new one. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'tests/testpicture.cpp')
-rw-r--r--tests/testpicture.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/testpicture.cpp b/tests/testpicture.cpp
index 5dd261316..1833a2bcf 100644
--- a/tests/testpicture.cpp
+++ b/tests/testpicture.cpp
@@ -44,14 +44,12 @@ void TestPicture::addPicture()
QVERIFY(pic1->longitude.udeg == 11334500);
QVERIFY(pic2->offset.seconds == 1321);
- QByteArray hash1 = hashFile(localFilePath(pic1->filename));
- QByteArray hash2 = hashFile(localFilePath(pic2->filename));
- learnHash(pic1->filename, PIC1_NAME, hash1);
- learnHash(pic2->filename, PIC2_NAME, hash2);
+ hashPicture(pic1->filename);
+ hashPicture(pic2->filename);
+ learnPictureFilename(pic1->filename, PIC1_NAME);
+ learnPictureFilename(pic2->filename, PIC2_NAME);
QCOMPARE(hashstring(pic1->filename), PIC1_HASH);
QCOMPARE(hashstring(pic2->filename), PIC2_HASH);
- QCOMPARE(hashstring(PIC1_NAME), PIC1_HASH);
- QCOMPARE(hashstring(PIC2_NAME), PIC2_HASH);
QCOMPARE(localFilePath(pic1->filename), QString(PIC1_NAME));
QCOMPARE(localFilePath(pic2->filename), QString(PIC2_NAME));
}