new design for rendertest (#8)
Что сделано: * Удалёны gif, тесты заметно ускорились из-за этого, даже не смотря что делаются png из tga форсировано теперь. * Добавлены темы, но светлой уделялось мало внимания. С костылём на автотёмную тему не знаю как будет тёмная тема работать, не проверял. * Изменён дизайн, теперь таблица-список картинок вынесена в отдельную боковую панель. * Появились разные режимы и настройки (лень перечислять там и так всё видно). * Исправлена ошибка сортировки которая проявлялась на chrome-подобных браузерах. * Исправлена ошибка с ориентацией картинок (поймал у себя что они оказались перевёрнутые). * Произошла некоторая реорганизация кодовой базы, некоторые функции были расширены, а что-то исправлено по мелочи. Reviewed-on: #8 Co-authored-by: NightFox <nightfox@dev.null> Co-committed-by: NightFox <nightfox@dev.null>
This commit was merged in pull request #8.
This commit is contained in:
@@ -11,6 +11,7 @@ import subprocess
|
||||
|
||||
ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||
imagecompare = f'{ROOT}/imagecompare'
|
||||
convert = f'convert' # set path for imagemagick convert if need
|
||||
WORKDIR = f'{ROOT}/work'
|
||||
REPORT_ROOT = f'{ROOT}' # FIXME should be workdir?
|
||||
|
||||
@@ -150,21 +151,25 @@ def compare():
|
||||
mkdir_p(WORKDIR)
|
||||
screenshot_base = f'{args.xash_dir}/valve/rendertest'
|
||||
diffs = []
|
||||
command_png()
|
||||
print(f'Compare...')
|
||||
with concurrent.futures.ThreadPoolExecutor() as executor:
|
||||
for test in args.tests:
|
||||
for channel, _ in channels.items():
|
||||
image_base = f'{test}_{channel}'
|
||||
image_test = f'{screenshot_base}/{image_base}.tga'
|
||||
#image_test = f'{screenshot_base}/{image_base}.tga'
|
||||
image_test = f'{ROOT}/work/gold/{image_base}.png'
|
||||
image_gold = f'{ROOT}/gold/{image_base}.png'
|
||||
image_diff = f'{WORKDIR}/{image_base}_diff.png'
|
||||
image_flip = f'{WORKDIR}/{image_base}_flip.gif'
|
||||
|
||||
diffs.append(executor.submit(compare_one, test, channel, image_base, image_gold, image_test, image_diff, image_flip))
|
||||
|
||||
executor.submit(subprocess.run, ['convert',
|
||||
'(', image_gold, '-bordercolor', 'gold', '-border', '2x2', '-gravity', 'SouthWest', '-font', 'Impact', '-pointsize', '24', '-fill', 'gold', '-stroke', 'black', '-annotate', '0', 'GOLD', ')',
|
||||
'(', image_test, '-bordercolor', 'white', '-border', '2x2', '-fill', 'white', '-annotate', '0', 'TEST', ')',
|
||||
'-loop', '0', '-set', 'delay', '100', image_flip], check=True)
|
||||
# legacy
|
||||
#executor.submit(subprocess.run, [convert,
|
||||
# '(', image_gold, '-bordercolor', 'gold', '-border', '2x2', '-gravity', 'SouthWest', '-font', 'Impact', '-pointsize', '24', '-fill', 'gold', '-stroke', 'black', '-annotate', '0', 'GOLD', ')',
|
||||
# '(', image_test, '-bordercolor', 'white', '-border', '2x2', '-fill', 'white', '-annotate', '0', 'TEST', ')',
|
||||
# '-loop', '0', '-set', 'delay', '100', image_flip], check=True)
|
||||
|
||||
results = [diff.result() for diff in diffs]
|
||||
# json.dump(results, open(f'{WORKDIR}/data.json', 'w'))
|
||||
@@ -187,8 +192,8 @@ def command_png():
|
||||
image_test = f'{screenshot_base}/{image_base}.tga'
|
||||
image_new_gold = f'{new_gold_base}/{image_base}.png'
|
||||
|
||||
print(f'{image_new_gold}')
|
||||
executor.submit(subprocess.run, ['convert', image_test, image_new_gold], check=True)
|
||||
print(f'convert to {image_new_gold}')
|
||||
executor.submit(subprocess.run, [convert, "-auto-orient", image_test, image_new_gold], check=True)
|
||||
|
||||
def command_run():
|
||||
compile()
|
||||
@@ -216,4 +221,3 @@ match args.command:
|
||||
|
||||
# TODO:
|
||||
# - settings object to pass as an argument
|
||||
# - HTML report
|
||||
|
||||
Reference in New Issue
Block a user