1 |
schorsch |
1.1 |
|
2 |
|
|
|
3 |
|
|
import os |
4 |
|
|
import math |
5 |
|
|
import string |
6 |
|
|
import unittest |
7 |
|
|
|
8 |
|
|
from unit_tools import support |
9 |
|
|
from unit_tools import lcompare |
10 |
|
|
|
11 |
|
|
class GetinfoTestCase(unittest.TestCase): |
12 |
|
|
def setUp(self): |
13 |
|
|
self.oldpath = os.environ['PATH'] |
14 |
|
|
os.environ['PATH'] = os.path.abspath(support.BINDIR) |
15 |
|
|
|
16 |
|
|
def tearDown(self): |
17 |
|
|
os.environ['PATH'] = self.oldpath |
18 |
|
|
|
19 |
|
|
|
20 |
|
|
def test_getinfo(self): |
21 |
|
|
picfile = support.datafile('Earth128.pic') |
22 |
|
|
cmd = 'getinfo "%s"' % picfile |
23 |
|
|
res0 = os.popen(cmd).read() |
24 |
|
|
result = lcompare.split_headers(res0) |
25 |
|
|
exps = '''%s: |
26 |
|
|
Xim format conversion by: |
27 |
|
|
FORMAT=32-bit_rle_rgbe |
28 |
|
|
pfilt -e 2 -x 512 -y 512 -p 1 -r .67 |
29 |
|
|
EXPOSURE=4.926198e+00 |
30 |
|
|
normpat |
31 |
|
|
pfilt -1 -e .2 |
32 |
|
|
EXPOSURE=2.000000e-01 |
33 |
|
|
pfilt -x 128 -y 128 |
34 |
|
|
PIXASPECT=0.500000 |
35 |
|
|
EXPOSURE=2.571646e+00''' % picfile |
36 |
|
|
expect = lcompare.split_headers(exps) |
37 |
|
|
try: lcompare.llcompare(result, expect, ignore_empty=1) |
38 |
|
|
except lcompare.error, e: |
39 |
|
|
self.fail('%s [%s]' % (str(e),cmd)) |
40 |
|
|
|
41 |
|
|
def test_getinfo_d(self): |
42 |
|
|
picfile = support.datafile('Earth128.pic') |
43 |
|
|
cmd = 'getinfo -d "%s"' % picfile |
44 |
|
|
res0 = os.popen(cmd).read() |
45 |
|
|
result = map(string.split,string.split(res0, '\n')) |
46 |
|
|
exps = '''%s: -Y 128 +X 128''' % picfile |
47 |
|
|
expect = map(string.split, string.split(exps, '\n')) |
48 |
|
|
try: lcompare.llcompare(result, expect, ignore_empty=1) |
49 |
|
|
except lcompare.error, e: |
50 |
|
|
self.fail('%s [%s]' % (str(e),cmd)) |
51 |
|
|
|
52 |
|
|
def main(): |
53 |
|
|
support.run_case(GetinfoTestCase) |
54 |
|
|
|
55 |
|
|
if __name__ == '__main__': |
56 |
|
|
main() |
57 |
|
|
|
58 |
|
|
# vi: set ts=4 sw=4 : |