macos: sikuli, change wallpaper (must be set using an absolute path)

This commit is contained in:
Georges Dupéron 2018-07-19 00:12:52 +02:00
parent 532140f5fc
commit d53e7ae908
3 changed files with 39 additions and 4 deletions

View File

@ -416,7 +416,9 @@ test/macos-sh: build/check_makefile \
osascript -e 'tell app "Terminal" to activate'
osascript -e 'tell app "Terminal" to do script "'"$$PWD"'/os.bat"'
sleep 5
(date +%n && sleep 0.2 && date +%n) || true
screencapture deploy-screenshots/screencapture-os-bat.png
./utils/gui-wrapper-mac.sh 1024x768x24 ./test/gui-sh-mac.sh ${os_filename}
# See https://wiki.osdev.org/EFI#Emulation to emulate an UEFI system with qemu, to test the EFI boot from hdd / cd / fd (?).

21
test/gui-sh-mac.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
set -e
if test $# -ne 1 || test "$1" = '-h' -o "$1" = '--help'; then
echo "Usage: $0 operating_system_file"
fi
# Force the path to be relative or absolute, but with at least one /
# Otherwise, the command will be searched in the $PATH, instead of using the
# given file.
os_filename="$(dirname "$1")/$(basename "$1")"
osascript -e 'tell app "Terminal" to activate'
osascript -e 'tell app "Terminal" to do script "'"$PWD"'/os.bat"' &
pid=$!
runsikulix -r test/check-gui-sh.sikuli && exitcode=$? || exitcode=$?
screencapture "./deploy-screenshots/$(basename "$0" .sh).png"
kill $pid
exit $exitcode

View File

@ -2,17 +2,29 @@
set -e
if test $# -ne 1 || test "$1" = "-h" -o "$1" = "--help"; then
echo "Usage: $0 path/to/screenshots/directory"
usage() {
echo "Usage: $0 {x11|mac} path/to/screenshots/directory"
}
if test $# -ne 2 || test "$1" = "-h" -o "$1" = "--help"; then
usage
exit 1
fi
screenshots_dir="$1"
platform="$1"
screenshots_dir="$2"
case $platform in
x11) screenshot_tool=scrot;;
mac) screenshot_tool=screencapture;;
*) usage; exit 1;;
esac
for i in `seq 100`; do
if test -e "$screenshots_dir/stop-screenshots"; then
break
fi
scrot "$screenshots_dir/$(printf %03d.png $i)" || break
"$screenshot_tool" "$screenshots_dir/$(printf %03d.png $i)" || break
sleep 0.2
done