def test_thumb(s): thumb = thumbnails.get_thumbnail(s.filename, (50, 60), ignore_temp=False) #check for right scaling s.failUnless(thumb) s.failUnlessEqual((thumb.get_width(), thumb.get_height()), (50, 25)) #test the thumbnail filename uri = fsn2uri(s.filename) name = hash.md5(uri.encode("ascii")).hexdigest() + ".png" path = thumbnails.get_thumbnail_folder() path = os.path.join(path, "normal", name) s.failUnless(os.path.isfile(path)) #check for metadata thumb_pb = GdkPixbuf.Pixbuf.new_from_file(path) meta_mtime = thumb_pb.get_option("tEXt::Thumb::MTime") meta_uri = thumb_pb.get_option("tEXt::Thumb::URI") s.failUnlessEqual(int(meta_mtime), int(mtime(s.filename))) s.failUnlessEqual(meta_uri, uri) #check rights if os.name != "nt": s.failUnlessEqual(os.stat(path).st_mode, 33152)
def test_thumb(s): thumb = thumbnails.get_thumbnail(s.filename, (50, 60)) #check for right scaling s.failUnless(thumb) s.failUnlessEqual((thumb.get_width(), thumb.get_height()), (50, 3)) #test the thumbnail filename uri = "file://" + pathname2url(s.filename) name = hash.md5(uri).hexdigest() + ".png" path = thumbnails.get_thumbnail_folder() path = os.path.join(path, "normal", name) s.failUnless(os.path.isfile(path)) #check for metadata thumb_pb = GdkPixbuf.Pixbuf.new_from_file(path) meta_mtime = thumb_pb.get_option("tEXt::Thumb::MTime") meta_uri = thumb_pb.get_option("tEXt::Thumb::URI") s.failUnlessEqual(int(meta_mtime), int(mtime(s.filename))) s.failUnlessEqual(meta_uri, uri) #check rights if os.name != "nt": s.failUnlessEqual(os.stat(path).st_mode, 33152)
def test_get_thumbnail_folder(self): path = thumbnails.get_thumbnail_folder() self.assertTrue(isinstance(path, fsnative))
def test_get_thumbnail_folder(self): path = thumbnails.get_thumbnail_folder() self.assertTrue(is_fsnative(path))
def test_get_thumbnail_folder(self): path = thumbnails.get_thumbnail_folder() self.assertTrue(isinstance(path, fsnative))
def test_get_thumbnail_folder(self): path = thumbnails.get_thumbnail_folder() self.assertTrue(is_fsnative(path))