Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
 def test_get_thumbnail_folder(self):
     path = thumbnails.get_thumbnail_folder()
     self.assertTrue(isinstance(path, fsnative))
Exemplo n.º 4
0
 def test_get_thumbnail_folder(self):
     path = thumbnails.get_thumbnail_folder()
     self.assertTrue(is_fsnative(path))
Exemplo n.º 5
0
 def test_get_thumbnail_folder(self):
     path = thumbnails.get_thumbnail_folder()
     self.assertTrue(isinstance(path, fsnative))
Exemplo n.º 6
0
 def test_get_thumbnail_folder(self):
     path = thumbnails.get_thumbnail_folder()
     self.assertTrue(is_fsnative(path))