tools: support gm import for taking screenshots, in addition to just import in v gret (the imagemagick ubuntu package on linux, does not have it in newer versions)

This commit is contained in:
Delyan Angelov 2025-09-08 16:29:30 +03:00
parent ff8e769691
commit 34f6845d75
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED
2 changed files with 7 additions and 2 deletions

View file

@ -19,7 +19,7 @@ runs:
with:
version: 1.0
packages: expect binutils postgresql sqlite3 clang valgrind \
imagemagick openimageio-tools xvfb xsel xclip \
imagemagick graphicsmagick-imagemagick-compat openimageio-tools xvfb xsel xclip \
liblapack3 libopenblas-base liblapacke-dev libopenblas-dev libopenmpi-dev \
libsodium-dev libpq-dev libssl-dev libsqlite3-dev \
libfreetype6-dev libxi-dev libxcursor-dev \

View file

@ -379,7 +379,12 @@ fn take_screenshots(opt Options, app AppConfig) ![]string {
// Use ImageMagick's `import` tool to take the screenshot
out_file := os.join_path(out_path, os.file_name(app.path) +
'_screenshot_${existing_screenshots.len:02}.png')
result := opt.verbose_execute('import -window root "${out_file}"')
screenshot_command := if opt.verbose_execute('import --version').exit_code != 0 {
'gm import -window root'
} else {
'import -window root'
}
result := opt.verbose_execute('${screenshot_command} ${os.quoted_path(out_file)}')
if result.exit_code != 0 {
p_app.signal_kill()
return error('Failed taking screenshot of `${app.abs_path}` to "${out_file}":\n${result.output}')