ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/test/py_tests/test_getinfo.py
Revision: 1.3
Committed: Mon Mar 28 17:48:43 2016 UTC (8 years, 1 month ago) by schorsch
Content type: text/x-python
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +0 -0 lines
State: FILE REMOVED
Log Message:
Refactoring of test suite, use independently of SCons and with Py2.7 or 3.x.

File Contents

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