aboutsummaryrefslogtreecommitdiffstats
path: root/tests/testpicture.cpp
AgeCommit message (Collapse)Author
2018-12-13Dive media: add media to closest diveGravatar Berthold Stoeger
Currently, when selecting "Load media files even if time does not match the dive time", the media are added to *all* selected dives. Instead add it to the closest dive. This seems like the less surprising behavior. Of course now if the user really wants to add a media file to multiple dives, they will have to do it manually. To avoid a messy interface, this is solved by moving the iterate- over-selected-dives loop to the core. Thus, a helper-function can be made local to its translation unit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-21Add 'location_t' data structureGravatar Linus Torvalds
Instead of having people treat latitude and longitude as separate things, just add a 'location_t' data structure that contains both. Almost all cases want to always act on them together. This is really just prep-work for adding a few more locations that we track: I want to add a entry/exit location to each dive (independent of the dive site) because of how the Garmin Descent gives us the information (and hopefully, some day, other dive computers too). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-08-23Parse: pass dive_table argument to parse_file()Gravatar Berthold Stoeger
To enable undo of divelog-importing it is crucial that parse_file() can parse into arbitrary dive tables. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-26Whitespace cleanup testsGravatar Dirk Hohndel
Again, entirely script based. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-04Dive pictures: remove hashesGravatar Berthold Stoeger
In the last commits, the canonical-to-local filename map was made independent from the image hashes and the location of moved images was based on filename not hashes. The hashes are now in principle unused (except for conversion of old-style local filename lookups). Therefore, remove the hashes in this commit. This makes addition of images distinctly faster. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-04Dive pictures: index local file name by canonical filnameGravatar Berthold Stoeger
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>
2018-03-05Cleanup: Remove hash field from picture-structureGravatar Berthold Stoeger
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>
2018-03-05Cleanup: Fold add_hash() call into learnHash() functionGravatar Berthold Stoeger
learnHash() was always called in conjunction with add_hash(). The pattern was that a local filename and a hash were connected in the hash-to-filename and the filename-to-hash maps. Then, the original picture-filename or url were registered in the filename-to-hash map. This commit changes learnHash() to take three parameters (original-filename, local-filename and hash) and do all of the above. The new code is simpler because no dummy picture struct has to be generated in DiveListView::loadImageFromURL(). The tests were extended to check for all hash<->filename associations. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-03-05Cleanup: Don't store hash in picture struct in learnHash()Gravatar Berthold Stoeger
learnHash() is called either on a local picture structure [DiveListView::loadImageFromURL()] or on a cloned picture structure [ImageDownloader::saveImage()]. In neither case the picture structure is passed to the frontend. Therefore, storing the new hash in the picture struct is not necessary. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-05-06Test for adding a picture with data after JFIF EOI to a diveGravatar Stefan Fuchs
Add one more picture to the already existing test. This new picture is a JPEG and has data after JFIF EOI tag. Suggested-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-04-29Add SPDX header to testsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-24Use SUBSURFACE_TEST_DATA definition to point to test data dirGravatar Jeremie Guichard
Update tests with a (compile time) option SUBSURFACE_TEST_DATA, pointing to test data base path. It is needed for cross compilation cases. SUBSURFACE_TEST_DATA is set to SUBSURFACE_SOURCE by default, or configurable via cmake option -DSUBSURFACE_TEST_DATA="...". Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-02-21Test for basic image handlingGravatar Robert C. Helling
This tests adding image files to dives including hashing and evaluating exif data. Signed-off-by: Robert C. Helling <helling@atdotde.de>