Use uuencoded test images.

This commit is contained in:
Guido van Rossum 1997-04-16 00:30:45 +00:00
parent 684480f419
commit 7aa9fc5642
4 changed files with 1579 additions and 9 deletions

1547
Lib/test/greyrgb.uue Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,14 +1,19 @@
#! /usr/bin/env python
"""Test script for the imageop module. This has the side
effect of partially testing the imgfile module as well.
Roger E. Masse
"""
from test_support import verbose
import imageop
from test_support import verbose, unlink
import imageop, uu
def main(use_rgbimg=1):
# Create binary test files
uu.decode(get_qualified_path('testrgb.uue'), 'test.rgb')
if use_rgbimg:
image, width, height = getrgbimage('test.rgb')
else:
@ -108,6 +113,9 @@ def main(use_rgbimg=1):
print 'grey22grey'
image = imageop.grey22grey (grey2image, width, height)
# Cleanup
unlink('test.rgb')
def getrgbimage(name):
"""return a tuple consisting of image (in 'imgfile' format but
using rgbimg instead) width and height"""
@ -160,6 +168,6 @@ def get_qualified_path(name):
name = string.joinfields(parts, os.sep)
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)

View File

@ -1,20 +1,35 @@
#! /usr/bin/env python
"""Simple test script for imgfile.c
Roger E. Masse
"""
from test_support import verbose
import imgfile
from test_support import verbose, unlink
import imgfile, uu, os
def main():
uu.decode(findfile('testrgb.uue'), 'test.rgb')
uu.decode(findfile('greyrgb.uue'), 'greytest.rgb')
# Test a 3 byte color image
testimage('test.rgb')
# Test a 1 byte greyscale image
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):
"""Run through the imgfile's battery of possible methods