@@ -48,12 +48,11 @@ def main(args=None):
4848 parser .add_argument ('-o' , '--outputfile' , dest = 'outputfile' , action = 'store' , help = 'Output file name' , default = "tests.html" )
4949 parser .add_argument ('-d' , '--diff' , dest = 'CREATE_DIFF' , action = 'store_true' , help = 'Perform image diff' , default = False )
5050 parser .add_argument ('-t' , '--timestamp' , dest = 'ENABLE_TIMESTAMPS' , action = 'store_true' , help = 'Write image timestamps' , default = False )
51- parser .add_argument ('-w' , '--imagewidth' , type = int , dest = 'imagewidth' , action = 'store' , help = 'Set image display width' , default = 256 )
52- parser .add_argument ('-ht' , '--imageheight' , type = int , dest = 'imageheight' , action = 'store' , help = 'Set image display height' , default = 256 )
51+ parser .add_argument ('-w' , '--imagewidth' , type = int , dest = 'imagewidth' , action = 'store' , help = 'Set image display width. Default is 256. <= 0 means to resize dynamically' , default = 256 )
5352 parser .add_argument ('-l1' , '--lang1' , dest = 'lang1' , action = 'store' , help = 'First target language for comparison. Default is glsl' , default = "glsl" )
5453 parser .add_argument ('-l2' , '--lang2' , dest = 'lang2' , action = 'store' , help = 'Second target language for comparison. Default is osl' , default = "osl" )
5554 parser .add_argument ('-l3' , '--lang3' , dest = 'lang3' , action = 'store' , help = 'Third target language for comparison. Default is empty' , default = "" )
56- parser .add_argument ('-e' , '--error' , dest = 'error' , action = 'store' , help = 'Tolerance threshold. Default -1 disables pruning. When > 0 (and --diff is set), rows with all RMS < tolerance are omitted .' , default = - 1 , type = float )
55+ parser .add_argument ('-e' , '--error' , dest = 'error' , action = 'store' , help = 'Filter out results with RMS less than this. Negative means all results are kept .' , default = - 1 , type = float )
5756 parser .add_argument ('-f' , '--format' , dest = 'format' , choices = ['html' , 'json' , 'markdown' ], help = 'Output format: html, json, or markdown' , default = 'html' )
5857
5958 args = parser .parse_args (args )
@@ -249,7 +248,6 @@ def output_json(groups):
249248 "createDiff" : bool (args .CREATE_DIFF and DIFF_ENABLED ),
250249 "timestamps" : bool (args .ENABLE_TIMESTAMPS ),
251250 "imagewidth" : args .imagewidth ,
252- "imageheight" : args .imageheight ,
253251 "tolerance" : args .error ,
254252 },
255253 "groups" : groups
@@ -337,39 +335,37 @@ def output_html(groups):
337335 html_parts .append (" background-color: black;\n " )
338336 html_parts .append (" width: 100%;\n " )
339337 html_parts .append (" height: auto;\n " )
340- html_parts .append (" max-width: " + str (args .imagewidth ) + "px;\n " )
338+ if args .imagewidth and args .imagewidth > 0 :
339+ html_parts .append (" max-width: " + str (args .imagewidth ) + "px;\n " )
340+ else :
341+ html_parts .append (" max-width: 100%;\n " )
342+ html_parts .append (" object-fit: contain;\n " )
341343 html_parts .append (" }\n " )
342344 html_parts .append (" </style>\n " )
343345 html_parts .append ("</head>\n " )
344346 html_parts .append ("<body>\n " )
345- html_parts .append (" <div class='container-fluid py-4'>\n " )
347+ html_parts .append (" <div style='font-size:9pt;' class='small container-fluid py-4'>\n " )
346348
347349 if useThirdLang :
348350 html_parts .append (" <div class='mb-4'>" + args .lang1 + " (in: " + args .inputdir1 + ") vs " + args .lang2 + " (in: " + args .inputdir2 + ") vs " + args .lang3 + " (in: " + args .inputdir3 + ")</div>\n " )
349351 else :
350352 html_parts .append (" <div class='mb-4'>" + args .lang1 + " (in: " + args .inputdir1 + ") vs " + args .lang2 + " (in: " + args .inputdir2 + ")</div>\n " )
351353
352354 for group in groups :
353- html_parts .append (" <div class='border border-dark p-3 mb-4'>\n " )
354- html_parts .append (" <div class='text-break'>" + group ["group" ] + ":</div>\n " )
355-
356- # Calculate equal column width for this group
357- num_cols = len (group ["rows" ][0 ]["columns" ]) if group ["rows" ] and group ["rows" ][0 ]["columns" ] else 1
358- col_width = 12 // num_cols
359-
355+ html_parts .append (" <div class='border border-dark p-0 mb-0'>\n " )
356+ html_parts .append (" <div class='text-break w-64' style='font-size:9pt; word-break:break-all;'>" + group ["group" ] + ":</div>\n " )
360357 for row in group ["rows" ]:
361- html_parts .append (" <div class='row mb-3'>\n " )
362-
363- # Each column gets equal width
358+ html_parts .append (" <div class='d-flex flex-nowrap align-items-start p-2 mb-0'>\n " )
364359 for col in row ["columns" ]:
365- html_parts .append (" <div class='col-" + str (col_width ) + " text-center'>\n " )
360+ if args .imagewidth and args .imagewidth > 0 :
361+ html_parts .append (" <div class='d-inline-block text-start me-0'>\n " )
362+ else :
363+ html_parts .append (" <div class='d-inline-block text-start me-0' style='width:100%;'>\n " )
366364 if col .get ("image" ):
367- html_parts .append (" <img src='" + col ["image" ] + "' class='test-image img-fluid' loading='lazy' alt='" + col .get ("text" , "" ).replace ("<br>" , " " ) + "'/>\n " )
368- html_parts .append (" <div class='text-break mt-2 '>" + col .get ("text" , "" ) + "</div>\n " )
365+ html_parts .append (" <img src='" + col ["image" ] + "' class='test-image img-fluid' loading='lazy' alt='" + col .get ("text" , "" ).replace ("<br>" , " " ) + "'/>" )
366+ html_parts .append (" <div class='text-break mt-0 mb-0 '>" + col .get ("text" , "" ) + "</div>\n " )
369367 html_parts .append (" </div>\n " )
370-
371368 html_parts .append (" </div>\n " )
372-
373369 html_parts .append (" </div>\n " )
374370
375371 html_parts .append (" </div>\n " )
0 commit comments