From 08962cb38dbd7e07d98397826c5192f0a4156143 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 2 Jun 2018 18:03:03 +0200 Subject: 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 --- tests/testpicture.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'tests') 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)); } -- cgit v1.2.3-70-g09d2