Commit 7aa9fc56 authored by Guido van Rossum's avatar Guido van Rossum

Use uuencoded test images.

parent 684480f4
This diff is collapsed.
#! /usr/bin/env python #! /usr/bin/env python
"""Test script for the imageop module. This has the side """Test script for the imageop module. This has the side
effect of partially testing the imgfile module as well. effect of partially testing the imgfile module as well.
Roger E. Masse Roger E. Masse
""" """
from test_support import verbose
import imageop from test_support import verbose, unlink
import imageop, uu
def main(use_rgbimg=1): def main(use_rgbimg=1):
# Create binary test files
uu.decode(get_qualified_path('testrgb.uue'), 'test.rgb')
if use_rgbimg: if use_rgbimg:
image, width, height = getrgbimage('test.rgb') image, width, height = getrgbimage('test.rgb')
else: else:
...@@ -106,7 +111,10 @@ def main(use_rgbimg=1): ...@@ -106,7 +111,10 @@ def main(use_rgbimg=1):
# Convert a 2-bit greyscale image to an 8-bit greyscale image. # Convert a 2-bit greyscale image to an 8-bit greyscale image.
if verbose: if verbose:
print 'grey22grey' print 'grey22grey'
image = imageop.grey22grey (grey2image, width, height) image = imageop.grey22grey (grey2image, width, height)
# Cleanup
unlink('test.rgb')
def getrgbimage(name): def getrgbimage(name):
"""return a tuple consisting of image (in 'imgfile' format but """return a tuple consisting of image (in 'imgfile' format but
...@@ -160,6 +168,6 @@ def get_qualified_path(name): ...@@ -160,6 +168,6 @@ def get_qualified_path(name):
name = string.joinfields(parts, os.sep) name = string.joinfields(parts, os.sep)
return name return name
# rgbimg (unlike imgfile) is portable to platforms other than SGI. So we prefer to use it. # rgbimg (unlike imgfile) is portable to platforms other than SGI.
# So we prefer to use it.
main(use_rgbimg=1) main(use_rgbimg=1)
#! /usr/bin/env python #! /usr/bin/env python
"""Simple test script for imgfile.c """Simple test script for imgfile.c
Roger E. Masse Roger E. Masse
""" """
from test_support import verbose
import imgfile from test_support import verbose, unlink
import imgfile, uu, os
def main(): def main():
uu.decode(findfile('testrgb.uue'), 'test.rgb')
uu.decode(findfile('greyrgb.uue'), 'greytest.rgb')
# Test a 3 byte color image # Test a 3 byte color image
testimage('test.rgb') testimage('test.rgb')
...@@ -15,6 +20,16 @@ def main(): ...@@ -15,6 +20,16 @@ def main():
# Test a 1 byte greyscale image # Test a 1 byte greyscale image
testimage('greytest.rgb') testimage('greytest.rgb')
unlink('test.rgb')
unlink('greytest.rgb')
def findfile(file):
if os.path.isabs(file): return file
import sys
for dn in sys.path:
fn = os.path.join(dn, file)
if os.path.exists(fn): return fn
return file
def testimage(name): def testimage(name):
"""Run through the imgfile's battery of possible methods """Run through the imgfile's battery of possible methods
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment