[gexiv2] Add test for GPS coordinates



commit 896d88ebdb428c6e60205016fddedf5af2b9c717
Author: Jens Georg <mail jensge org>
Date:   Fri Mar 3 21:51:31 2017 +0100

    Add test for GPS coordinates
    
    Signed-off-by: Jens Georg <mail jensge org>

 test/CaorVN.jpeg      |  Bin 0 -> 293768 bytes
 test/python/gexiv2.py |   14 +++++++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/test/CaorVN.jpeg b/test/CaorVN.jpeg
new file mode 100644
index 0000000..fb39c01
Binary files /dev/null and b/test/CaorVN.jpeg differ
diff --git a/test/python/gexiv2.py b/test/python/gexiv2.py
index 9048f08..e9ea46d 100644
--- a/test/python/gexiv2.py
+++ b/test/python/gexiv2.py
@@ -29,6 +29,7 @@ import os
 import gi.overrides
 gi.overrides.__path__.append(os.path.join(os.path.dirname(__file__),
                                           'gi', 'overrides'))
+gi.overrides.__path__.append(os.path.join(os.path.dirname(__file__), '..', '..'))
 
 
 from gi.repository import GExiv2
@@ -44,10 +45,21 @@ class TestGexiv2(unittest.TestCase):
 
     def test_author_badencoding(self):
         sample = 'sample-author-badencoding.jpg'
-        md = GExiv2.Metadata(self.get_sample_path(sample))
+        md = GExiv2.Metadata()
+        md.open_path(self.get_sample_path(sample))
 
         self.assertEqual(md.get_raw('Exif.Image.Artist'), b'\xc0\xeb\xe5\xea\xf1\xe0\xed\xe4\xf0 
\xca\xee\xf8\xe5\xeb\xe5\xe2\x00')
 
+    def test_gps_coordinates(self):
+        sample = 'CaorVN.jpeg'
+        md = GExiv2.Metadata()
+        md.open_path(self.get_sample_path(sample))
+
+        (lo, la, alt) = md.get_gps_info()
+        self.assertEqual(lo, -1.508425)
+        self.assertEqual(la, 48.631806166666664)
+        self.assertEqual(alt, -0.926000)
+
 
 if __name__ == '__main__':
     unittest.main()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]