mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
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:
parent
ff8e769691
commit
34f6845d75
2 changed files with 7 additions and 2 deletions
|
@ -19,7 +19,7 @@ runs:
|
||||||
with:
|
with:
|
||||||
version: 1.0
|
version: 1.0
|
||||||
packages: expect binutils postgresql sqlite3 clang valgrind \
|
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 \
|
liblapack3 libopenblas-base liblapacke-dev libopenblas-dev libopenmpi-dev \
|
||||||
libsodium-dev libpq-dev libssl-dev libsqlite3-dev \
|
libsodium-dev libpq-dev libssl-dev libsqlite3-dev \
|
||||||
libfreetype6-dev libxi-dev libxcursor-dev \
|
libfreetype6-dev libxi-dev libxcursor-dev \
|
||||||
|
|
|
@ -379,7 +379,12 @@ fn take_screenshots(opt Options, app AppConfig) ![]string {
|
||||||
// Use ImageMagick's `import` tool to take the screenshot
|
// Use ImageMagick's `import` tool to take the screenshot
|
||||||
out_file := os.join_path(out_path, os.file_name(app.path) +
|
out_file := os.join_path(out_path, os.file_name(app.path) +
|
||||||
'_screenshot_${existing_screenshots.len:02}.png')
|
'_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 {
|
if result.exit_code != 0 {
|
||||||
p_app.signal_kill()
|
p_app.signal_kill()
|
||||||
return error('Failed taking screenshot of `${app.abs_path}` to "${out_file}":\n${result.output}')
|
return error('Failed taking screenshot of `${app.abs_path}` to "${out_file}":\n${result.output}')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue