|
12 | 12 | import re |
13 | 13 | import sys |
14 | 14 | import logging |
| 15 | +import vcs |
15 | 16 |
|
16 | 17 | defaultThreshold=10.0 |
17 | 18 |
|
| 19 | +def init(): |
| 20 | + testingDir = os.path.join(os.path.dirname(__file__), "..") |
| 21 | + sys.path.append(testingDir) |
| 22 | + |
| 23 | + vcsinst = vcs.init() |
| 24 | + vcsinst.setantialiasing(0) |
| 25 | + vcsinst.drawlogooff() |
| 26 | + vcsinst.setbgoutputdimensions(1200,1091,units="pixels") |
| 27 | + return vcsinst |
| 28 | + |
| 29 | +def run(vcsinst, fname, baseline=sys.argv[1], threshold=defaultThreshold): |
| 30 | + vcsinst.png(fname) |
| 31 | + sys.exit(check_result_image(fname, baseline, threshold)) |
| 32 | + |
| 33 | +def run_wo_terminate(vcsinst, fname, baseline=sys.argv[1], threshold=defaultThreshold): |
| 34 | + vcsinst.png(fname) |
| 35 | + return check_result_image(fname, baseline, threshold) |
| 36 | + |
18 | 37 | def image_compare(testImage, baselineImage): |
19 | 38 | imageDiff = vtk.vtkImageDifference() |
20 | 39 | imageDiff.SetInputData(testImage) |
@@ -53,8 +72,8 @@ def find_alternates(fname): |
53 | 72 | results.append(os.path.join(dirname, i)) |
54 | 73 | return results |
55 | 74 |
|
56 | | -def check_result_image(fname, baselinefname, threshold = defaultThreshold, |
57 | | - baseline = True, cleanup=True): |
| 75 | +def check_result_image(fname, baselinefname=sys.argv[1], threshold=defaultThreshold, |
| 76 | + baseline=True, cleanup=True): |
58 | 77 | testImage = image_from_file(fname) |
59 | 78 | if testImage is None: |
60 | 79 | print "Testing image missing, test failed." |
|
0 commit comments