diff options
author | Robert C. Helling <helling@atdotde.de> | 2017-02-21 10:27:31 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-02-21 13:14:56 -0800 |
commit | c4976b505a2c4a1fe62610b3c875eac56957c924 (patch) | |
tree | 1ce720746e8d1314500a5bdd2f1fc57a5089f79e /tests/testpicture.cpp | |
parent | dbd99f706ecb6074d5f80573a881b98a3e30ce25 (diff) | |
download | subsurface-c4976b505a2c4a1fe62610b3c875eac56957c924.tar.gz |
Test for basic image handling
This tests adding image files to dives including hashing and evaluating
exif data.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'tests/testpicture.cpp')
-rw-r--r-- | tests/testpicture.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/testpicture.cpp b/tests/testpicture.cpp new file mode 100644 index 000000000..6b59018c1 --- /dev/null +++ b/tests/testpicture.cpp @@ -0,0 +1,43 @@ +#include "testpicture.h" +#include "core/dive.h" +#include "core/file.h" +#include "core/divelist.h" +#include <QString> +#include <core/qthelper.h> + +void TestPicture::initTestCase() +{ + /* we need to manually tell that the resource exists, because we are using it as library. */ + Q_INIT_RESOURCE(subsurface); +} + +void TestPicture::addPicture() +{ + struct dive *dive; + struct picture *pic; + verbose = 1; + + QCOMPARE(parse_file(SUBSURFACE_SOURCE "/dives/test44.xml"), 0); + dive = get_dive(0); + QVERIFY(dive != NULL); + pic = dive->picture_list; + // So far no picture in dive + QVERIFY(pic == NULL); + + dive_create_picture(dive, SUBSURFACE_SOURCE "/wreck.jpg", 0, false); + pic = dive->picture_list; + // Now there is a picture + QVERIFY(pic != NULL); + // Appearing at time 21:01 + QVERIFY(pic->offset.seconds == 1261); + QVERIFY(pic->latitude.udeg == 47934500); + QVERIFY(pic->longitude.udeg == 11334500); + + QVERIFY(pic->hash == NULL); + learnHash(pic, hashFile(localFilePath(pic->filename))); + QCOMPARE(pic->hash, "929ad9499b7ae7a9e39ef63eb6c239604ac2adfa"); + +} + + +QTEST_GUILESS_MAIN(TestPicture) |