Esempio n. 1
0
 def test_image_write_tags(self):
     """ write tags to an image """
     shutil.copy(TEST_PLAIN, self.tmpdir)
     img = PictagImage(os.path.join(self.tmpdir, os.path.basename(TEST_PLAIN)))
     #no lat/lon/dt set on the image
     lat, lon = img.position_get()
     self.assertEqual(lat, None)
     self.assertEqual(lon, None)
     #change data (but still not written to file)
     img.position_set(10.0, 20.0)
     lat, lon = img.position_get()
     self.assertEqual(lat, 10)
     self.assertEqual(lon, 20)
     #open a new pictag with the same file. data is not written to file so tags should be unavailable
     img2 = PictagImage(os.path.join(self.tmpdir, os.path.basename(TEST_PLAIN)))
     lat, lon = img2.position_get()
     self.assertEqual(lat, None)
     self.assertEqual(lon, None)
     #write data of img
     img.save()
     #load file again. data should be written now
     img3 = PictagImage(os.path.join(self.tmpdir, os.path.basename(TEST_PLAIN)))
     lat, lon = img3.position_get()
     self.assertEqual(lat, 10)
     self.assertEqual(lon, 20)
Esempio n. 2
0
 def test_image_with_tags(self):
     """ read image with tags """
     img = PictagImage(TEST_WITH_TAGS)
     self.assertEqual(img.path_full, TEST_WITH_TAGS)
     lat, lon = img.position_get()
     self.assertEqual(lat, 52.918533333333336)
     self.assertEqual(lon, 10.900019444444444)
     self.assertEqual(img.dt, "28 April 2012, 15:25:39")
Esempio n. 3
0
 def test_image_plain(self):
     """ read image without tags """
     img = PictagImage(TEST_PLAIN)
     self.assertEqual(img.path_full, TEST_PLAIN)
     #no lat/lon/dt set on the image
     lat, lon = img.position_get()
     self.assertEqual(lat, None)
     self.assertEqual(lon, None)
     self.assertEqual(img.dt, None)