diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-02-18 16:22:34 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-03-05 18:04:57 +0200 |
commit | bdc470a80e0260011e3dfc4d949df8f9e222f73f (patch) | |
tree | 625c26f2f754a56929d2f8880170c38b8f7d779b /tests/testpicture.cpp | |
parent | e5dcd9fc161891a4e70364e1dcdf232590eb49c6 (diff) | |
download | subsurface-bdc470a80e0260011e3dfc4d949df8f9e222f73f.tar.gz |
Cleanup: Remove hash field from picture-structure
The hash field in the picture-structure was in principle non-operational.
It was set on loading, but never actually changed. The authoritative
hash comes from the filename->hash map.
Therefore, make this explicit by removing the hash field from the
picture structure.
Instead of filling the picture structure on loading, add the
hash directly to the filename->hash map. This is done in the
register_hash() function, which does not overwrite old entries.
I.e. the local hash has priority over the save-file. This
policy might be refined in the future.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'tests/testpicture.cpp')
-rw-r--r-- | tests/testpicture.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tests/testpicture.cpp b/tests/testpicture.cpp index 752166cd4..5dd261316 100644 --- a/tests/testpicture.cpp +++ b/tests/testpicture.cpp @@ -44,8 +44,6 @@ void TestPicture::addPicture() QVERIFY(pic1->longitude.udeg == 11334500); QVERIFY(pic2->offset.seconds == 1321); - QVERIFY(pic1->hash == NULL); - QVERIFY(pic2->hash == NULL); QByteArray hash1 = hashFile(localFilePath(pic1->filename)); QByteArray hash2 = hashFile(localFilePath(pic2->filename)); learnHash(pic1->filename, PIC1_NAME, hash1); @@ -54,8 +52,8 @@ void TestPicture::addPicture() QCOMPARE(hashstring(pic2->filename), PIC2_HASH); QCOMPARE(hashstring(PIC1_NAME), PIC1_HASH); QCOMPARE(hashstring(PIC2_NAME), PIC2_HASH); - QCOMPARE(fileFromHash(PIC1_HASH), QString(PIC1_NAME)); - QCOMPARE(fileFromHash(PIC2_HASH), QString(PIC2_NAME)); + QCOMPARE(localFilePath(pic1->filename), QString(PIC1_NAME)); + QCOMPARE(localFilePath(pic2->filename), QString(PIC2_NAME)); } |