get visual tests running on windows

This commit is contained in:
Dane Springmeyer 2014-09-06 23:04:01 +00:00
parent dc8a46017f
commit 43795532e5
2 changed files with 16 additions and 5 deletions

View file

@ -3,6 +3,7 @@
import os
import sys
import mapnik
import platform
try:
import json
@ -13,7 +14,7 @@ COMPUTE_THRESHOLD = 16
# testcase images are generated on OS X
# so they should exactly match
if os.uname()[0] == 'Darwin':
if platform.uname()[0] == 'Darwin':
COMPUTE_THRESHOLD = 2
# returns true if pixels are not identical

View file

@ -8,6 +8,7 @@ import mapnik
import shutil
import os.path
from compare import compare, compare_grids
import platform
try:
import json
@ -26,7 +27,7 @@ defaults = {
cairo_threshold = 10
agg_threshold = 0
if 'Linux' == os.uname()[0]:
if 'Linux' == platform.uname()[0]:
# we assume if linux then you are running packaged cairo
# which is older than the 1.12.14 version we used on OS X
# to generate the expected images, so we'll rachet back the threshold
@ -294,7 +295,10 @@ class Reporting:
def result_fail(self, actual, expected, diff):
self.failed += 1
if self.quiet:
sys.stderr.write('\x1b[31m.\x1b[0m')
if platform.uname()[0] == 'Windows':
sys.stderr.write('.')
else:
sys.stderr.write('\x1b[31m.\x1b[0m')
else:
print '\x1b[31m✘\x1b[0m (\x1b[34m%u different pixels\x1b[0m)' % diff
@ -308,9 +312,15 @@ class Reporting:
def result_pass(self, actual, expected, diff):
self.passed += 1
if self.quiet:
sys.stderr.write('\x1b[32m.\x1b[0m')
if platform.uname()[0] == 'Windows':
sys.stderr.write('.')
else:
sys.stderr.write('\x1b[32m.\x1b[0m')
else:
print '\x1b[32m✓\x1b[0m'
if platform.uname()[0] == 'Windows':
print '\x1b[32m✓\x1b[0m'
else:
print ''
def not_found(self, actual, expected):
self.failed += 1