Add test case for GPS tags
This also adds a sample image licensed under CC-BY-NC from jerquiaga located at Flickr: http://www.flickr.com/photos/jerquiaga/2394751088/
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 148 KiB |
@@ -18,7 +18,8 @@ REF = {
|
||||
'dir1/test1': {
|
||||
'title': 'An example sub-category',
|
||||
'thumbnail': '11.jpg',
|
||||
'medias': ['11.jpg', 'archlinux-kiss-1024x640.png'],
|
||||
'medias': ['11.jpg', 'archlinux-kiss-1024x640.png',
|
||||
'flickr_jerquiaga_2394751088_cc-by-nc.jpg'],
|
||||
},
|
||||
'dir1/test2': {
|
||||
'title': 'Test2',
|
||||
|
||||
@@ -68,3 +68,22 @@ def test_exif_copy(tmpdir):
|
||||
raw, simple = get_exif_tags(dst_file)
|
||||
assert not raw
|
||||
assert not simple
|
||||
|
||||
|
||||
def test_exif_gps(tmpdir):
|
||||
"""Test reading out correct geo tags"""
|
||||
test_image = 'flickr_jerquiaga_2394751088_cc-by-nc.jpg'
|
||||
src_file = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'dir1', 'test1',
|
||||
test_image)
|
||||
dst_file = str(tmpdir.join(test_image))
|
||||
|
||||
settings = create_settings(img_size=(400, 300), copy_exif_data=True)
|
||||
generate_image(src_file, dst_file, settings)
|
||||
raw, simple = get_exif_tags(dst_file)
|
||||
assert 'gps' in simple
|
||||
|
||||
lat = 35.266666
|
||||
lon = -117.216666
|
||||
|
||||
assert abs(simple['gps']['lat'] - lat) < 0.0001
|
||||
assert abs(simple['gps']['lon'] - lon) < 0.0001
|
||||
|
||||
@@ -31,7 +31,8 @@ def test_zipped_correctly(tmpdir):
|
||||
assert os.path.basename(zipped1[0]) == 'archive.zip'
|
||||
|
||||
zip_file = zipfile.ZipFile(zipped1[0], 'r')
|
||||
expected = ('11.jpg', 'archlinux-kiss-1024x640.png')
|
||||
expected = ('11.jpg', 'archlinux-kiss-1024x640.png',
|
||||
'flickr_jerquiaga_2394751088_cc-by-nc.jpg')
|
||||
|
||||
for filename in zip_file.namelist():
|
||||
assert filename in expected
|
||||
|
||||
Reference in New Issue
Block a user