commit d53e7ae90806b1e0fb00c084e9beb55f07dd4d3e
parent 532140f5fcec848327d54b471a9ae1505f3e91b9
Author: Georges Dupéron <georges.duperon@gmail.com>
Date: Thu, 19 Jul 2018 00:12:52 +0200
macos: sikuli, change wallpaper (must be set using an absolute path)
Diffstat:
3 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
@@ -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 (?).
diff --git a/test/gui-sh-mac.sh b/test/gui-sh-mac.sh
@@ -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
diff --git a/utils/screenshots-loop.sh b/utils/screenshots-loop.sh
@@ -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