Skip to content

Commit

Permalink
tests/test_gamera: add test for to_pil_rgb().
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilk committed Jun 8, 2015
1 parent ae9d242 commit fdd6bf9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/coverage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ lib.cli 228 62 94 45 67% 102-119, 261-285,
lib.djvu_support 257 120 89 52 50% 48-50, 85, 112, 115, 124, 144-166, 170-173, 176-178, 182-185, 189, 195-203, 206-220, 224, 226, 228, 230, 232, 238-239, 248-249, 252, 254, 257, 270-310, 313-321
lib.filetype 18 0 4 1 95%
lib.fs 14 0 2 0 100%
lib.gamera_support 134 4 44 2 97% 205-207, 210
lib.gamera_support 134 1 44 2 98% 210
lib.ipc 79 1 32 6 94% 106
lib.templates 40 0 14 0 100%
lib.temporary 20 0 0 0 100%
Expand All @@ -19,4 +19,4 @@ lib.xmp.libxmp_backend 66 4 20 2 93% 51-54
lib.xmp.namespaces 6 0 0 0 100%
lib.xmp.pyexiv2_backend 119 2 20 1 98% 124-125
---------------------------------------------------------------------
TOTAL 1099 193 337 110 79%
TOTAL 1099 190 337 110 79%
24 changes: 24 additions & 0 deletions tests/test_gamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@

from . common import (
assert_equal,
assert_images_equal,
assert_is_instance,
assert_is_none,
fork_isolation,
)

from PIL import Image as pil

from lib import gamera_support as gamera

datadir = os.path.join(os.path.dirname(__file__), 'data')
Expand Down Expand Up @@ -78,4 +81,25 @@ def test_grey(self):
for x in self._test_methods('greyscale-packbits.tiff'):
yield x

class test_to_pil_rgb():

@fork_isolation
def _test(self, path):
path = os.path.join(datadir, path)
in_image = pil.open(path)
if in_image.mode != 'RGB':
in_image = in_image.convert('RGB')
assert_equal(in_image.mode, 'RGB')
gamera.init()
gamera_image = gamera.load_image(path)
out_image = gamera.to_pil_rgb(gamera_image)
assert_equal(out_image.mode, 'RGB')
assert_images_equal(in_image, out_image)

def test_color(self):
self._test('ycbcr-jpeg.tiff')

def test_grey(self):
self._test('greyscale-packbits.tiff')

# vim:ts=4 sts=4 sw=4 et

0 comments on commit fdd6bf9

Please sign in to comment.