Example #1
0
    def testThumbByHeightPng (self):
        images_dir = "../test/images"

        fname_in = "outwiker_1.1.0_02.png"
        page = self.rootwiki[u"Страница 1"]

        Attachment (page).attach ([os.path.join (images_dir, fname_in) ] )

        newwidth = 249
        newheight = 215

        thumb_fname = self.thumbmaker.createThumbByHeight (page, fname_in, newheight)
        thumb_path = os.path.join (page.path, thumb_fname)

        (width, height) = getImageSize (thumb_path)
        
        self.assertTrue (os.path.exists (thumb_path), thumb_path)
        self.assertEqual (width, newwidth)
        self.assertEqual (height, newheight)
Example #2
0
    def testThumbByWidthJpeg (self):
        images_dir = "../test/images"

        fname_in = "first.jpg"
        page = self.rootwiki[u"Страница 1"]

        Attachment (page).attach ([os.path.join (images_dir, fname_in) ] )

        newwidth = 250
        newheight = 182

        thumb_fname = self.thumbmaker.createThumbByWidth (page, fname_in, newwidth)
        thumb_path = os.path.join (page.path, thumb_fname)

        (width, height) = getImageSize (thumb_path)
        
        self.assertTrue (os.path.exists (thumb_path), thumb_path)
        self.assertEqual (width, newwidth)
        self.assertEqual (height, newheight)
Example #3
0
    def testThumbByHeightPng(self):
        images_dir = "../test/images"

        fname_in = "outwiker_1.1.0_02.png"
        page = self.wikiroot[u"Страница 1"]

        Attachment(page).attach([os.path.join(images_dir, fname_in)])

        newwidth = 249
        newheight = 215

        thumb_fname = self.thumbmaker.createThumbByHeight(
            page, fname_in, newheight)
        thumb_path = os.path.join(page.path, thumb_fname)

        (width, height) = getImageSize(thumb_path)

        self.assertTrue(os.path.exists(thumb_path), thumb_path)
        self.assertEqual(width, newwidth)
        self.assertEqual(height, newheight)
Example #4
0
    def testThumbByWidthJpeg(self):
        images_dir = "../test/images"

        fname_in = "first.jpg"
        page = self.wikiroot[u"Страница 1"]

        Attachment(page).attach([os.path.join(images_dir, fname_in)])

        newwidth = 250
        newheight = 182

        thumb_fname = self.thumbmaker.createThumbByWidth(
            page, fname_in, newwidth)
        thumb_path = os.path.join(page.path, thumb_fname)

        (width, height) = getImageSize(thumb_path)

        self.assertTrue(os.path.exists(thumb_path), thumb_path)
        self.assertEqual(width, newwidth)
        self.assertEqual(height, newheight)
Example #5
0
    def testThumbByMaxSizeJpeg2 (self):
        images_dir = "../test/images"

        fname_in = "first_vertical.jpeg"
        page = self.rootwiki[u"Страница 1"]

        Attachment (page).attach ([os.path.join (images_dir, fname_in) ] )

        maxsize = 250

        newwidth = 182
        newheight = 250

        thumb_fname = self.thumbmaker.createThumbByMaxSize (page, fname_in, maxsize)
        thumb_path = os.path.join (page.path, thumb_fname)

        (width, height) = getImageSize (thumb_path)
        
        self.assertTrue (os.path.exists (thumb_path), thumb_path)
        self.assertEqual (width, newwidth)
        self.assertEqual (height, newheight)
Example #6
0
    def testThumbByMaxSizeJpeg2(self):
        images_dir = "../test/images"

        fname_in = "first_vertical.jpeg"
        page = self.wikiroot[u"Страница 1"]

        Attachment(page).attach([os.path.join(images_dir, fname_in)])

        maxsize = 250

        newwidth = 182
        newheight = 250

        thumb_fname = self.thumbmaker.createThumbByMaxSize(
            page, fname_in, maxsize)
        thumb_path = os.path.join(page.path, thumb_fname)

        (width, height) = getImageSize(thumb_path)

        self.assertTrue(os.path.exists(thumb_path), thumb_path)
        self.assertEqual(width, newwidth)
        self.assertEqual(height, newheight)