diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-06-02 18:03:03 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-07-04 02:27:36 +0800 |
commit | 08962cb38dbd7e07d98397826c5192f0a4156143 (patch) | |
tree | b974f574d8b68bd97f6b50bd0150fbd83ac6dd87 /tests/testpicture.cpp | |
parent | 5375eee4e6a6af1402c2bf8f7cce40fc4f5340f5 (diff) | |
download | subsurface-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.cpp | 10 |
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)); } |