diff options
-rw-r--r-- | openscad.pro | 15 | ||||
-rwxr-xr-x | tests/test_cmdline_tool.py | 52 |
2 files changed, 7 insertions, 60 deletions
diff --git a/openscad.pro b/openscad.pro index 40c7d3d..099af35 100644 --- a/openscad.pro +++ b/openscad.pro @@ -16,14 +16,13 @@ win32 { # get VERSION from system date isEmpty(VERSION) { - win32 { + win32-msvc*: { # # Windows XP date command only has one argument, /t # and it can print the date in various localized formats. # This code will detect MM/DD/YYYY, YYYY/MM/DD, and DD/MM/YYYY # SYSDATE = $$system(date /t) - message("Reading date from Windows date.exe... " $$SYSDATE) SYSDATE = $$replace(SYSDATE,"/",".") SYSDATE ~= s/[A-Za-z]*// # remove name of day DATE_SPLIT=$$split(SYSDATE, ".") @@ -34,13 +33,12 @@ isEmpty(VERSION) { TEST2=$$find(DATE_Z, [0-9]{4} ) QDATE = $$_DATE_ - message("Reading date from QMAKE ..." $$QDATE) QDATE_SPLIT = $$split(QDATE) QDAY = $$member(QDATE_SPLIT,2) !isEmpty(TEST1) { contains( QDAY, $$DATE_Z ) { - message("Assuming YYYY/MM/DD format") + # message("Assuming YYYY/MM/DD format") VERSION_YEAR = $$DATE_X VERSION_MONTH = $$DATE_Y VERSION_DAY = $$DATE_Z @@ -48,12 +46,12 @@ isEmpty(VERSION) { } else { !isEmpty(TEST2) { contains( DATE_X, $$QDAY ) { - message("Assuming DD/MM/YYYY format" $$DATE_X $$DATE_Y $$DATE_Z ) + # message("Assuming DD/MM/YYYY format" $$DATE_X $$DATE_Y $$DATE_Z ) VERSION_DAY = $$DATE_X VERSION_MONTH = $$DATE_Y VERSION_YEAR = $$DATE_Z } else { - message("Assuming MM/DD/YYYY format" $$DATE_X $$DATE_Y $$DATE_Z ) + # message("Assuming MM/DD/YYYY format" $$DATE_X $$DATE_Y $$DATE_Z ) VERSION_MONTH = $$DATE_X VERSION_DAY = $$DATE_Y VERSION_YEAR = $$DATE_Z @@ -62,8 +60,9 @@ isEmpty(VERSION) { # test1 and test2 both empty error("Couldn't parse Windows date. please run 'qmake VERSION=YYYY.MM.DD' with todays date") } - } - message("YMD version:" $$VERSION_YEAR $$VERSION_MONTH $$VERSION_DAY) + } # isEmpty(TEST1) + VERSION = $$VERSION_YEAR"."$$VERSION_MONTH"."$$VERSION_DAY + # message("YMD Version:" $$VERSION) } else { # Unix/Mac VERSION = $$system(date "+%Y.%m.%d") diff --git a/tests/test_cmdline_tool.py b/tests/test_cmdline_tool.py index b6afbec..42fca74 100755 --- a/tests/test_cmdline_tool.py +++ b/tests/test_cmdline_tool.py @@ -69,56 +69,12 @@ def compare_default(resultfilename): return False return True -def append_html_output(expectedfilename, resultfilename): - # 1 if html directory & file not there, create them - # 2 copy expected filename image and result filename image to dir - # 3 append html to show differences - # 4 dump platform.platform() - expectedimg = os.path.basename(expectedfilename) - resultimg = os.path.basename(resultfilename) - template = ''' -<p> -<div style="border:1px solid gray;padding:10px;"> -Test command: <b>///TESTCMD///</b> Test name: <b>///TESTNAME///</b> <br/> - <div style="float: left; width: 50%;"> - <br/> - Expected:<br/> - <img style="border:1px solid gray; width:90%;" src="///EXPECTED///"/> - </div> - - <div style="float: right; width: 50%;"> - Actual:<br/> - (Platform: ///PLATFORM///)<br/> - <img style="border:1px solid gray; width:90%;" src="///RESULT///"/> - </div> -<br style="clear:both;"/> -</div> -<p> -''' - html = template - html = html.replace('///EXPECTED///',expectedimg) - html = html.replace('///RESULT///',resultimg) - html = html.replace('///TESTCMD///',os.path.basename(options.cmd)) - html = html.replace('///TESTNAME///',options.testname) - html = html.replace('///PLATFORM///',platform.platform()) - try: - shutil.copy(expectedfilename,options.imgdiff_dir) - shutil.copy(resultfilename,options.imgdiff_dir) - f = open(options.imgdiff_htmlfile,'a') - f.write(html) - f.close() - print >> sys.stderr, "appended " + options.imgdiff_htmlfile - except: - print >> sys.stderr, "error appending " + options.imgdiff_htmlfile - print >> sys.stderr, sys.exc_info() - def compare_png(resultfilename): if not resultfilename: print >> sys.stderr, "Error: OpenSCAD did not generate an image" return False print >> sys.stderr, 'Yee image compare: ', expectedfilename, ' ', resultfilename if execute_and_redirect("./yee_compare", [expectedfilename, resultfilename, "-downsample", "2", "-threshold", "200"], sys.stderr) != 0: - append_html_output(expectedfilename, resultfilename) return False return True @@ -188,14 +144,6 @@ if __name__ == '__main__': options.generate = False options.suffix = "txt" - options.imgdiff_dir = 'imgdiff-fail' - options.imgdiff_htmlfile = os.path.join(options.imgdiff_dir,'failed.html') - try: - if not os.path.isdir(options.imgdiff_dir): - os.mkdir(options.imgdiff_dir) - except: - print >> sys.stderr, "error creating " + options.imgdiff_dir, sys.exc_info() - for o, a in opts: if o in ("-g", "--generate"): options.generate = True elif o in ("-s", "--suffix"): |