added automated quick tests

This commit is contained in:
Egan Ford 2017-06-01 17:20:54 -06:00
parent 4bb916265b
commit be216e45cc
3 changed files with 161 additions and 2 deletions

80
quick.scrp Normal file
View File

@ -0,0 +1,80 @@
on run argv
set my_path to (system attribute "PWD") & "/"
set my_disk to item 1 of argv
set my_audio to item 2 of argv
set my_screen1 to item 3 of argv
set my_timeout1 to item 4 of argv
set my_screen2 to item 5 of argv
set my_timeout2 to item 6 of argv
set my_down to item 7 of argv
tell application "Virtual ]["
activate
-- may need delay for this error: execution error: Virtual ][ got an error: Connection is invalid. (-609)
delay 1.5
-- Close all open machines
close every machine saving no
-- Create a new (AppleIIe)
set theMachine to (make new AppleIIe)
tell theMachine
-- Change to a color screen
set monochrome screen to false
set scanlines to true
set speaker volume to 0.25
-- load disk
insert my_path & my_disk into device "S6D1"
-- splash page
try
with timeout of my_timeout1 seconds
waiting until screen equals imagefile POSIX path of (my_path & my_screen1)
end timeout
on error
return "ERROR: TIMEOUT: Virtual ][ screen != " & my_screen1
end try
-- full speed ahead
set speed to maximum
-- main screen
try
with timeout of my_timeout2 seconds
waiting until screen equals imagefile POSIX path of (my_path & my_screen2)
end timeout
on error
return "ERROR: TIMEOUT: Virtual ][ screen != " & my_screen2
end try
-- normal speed
set speed to regular
-- down arrow 17x and return
repeat my_down times
type key down arrow
delay 0.03
end repeat
delay 0.5
type line ""
delay 1.0
-- send audio
play my_path & my_audio on device "cassette recorder"
delay 1.0
-- full speed ahead
set speed to maximum
delay 0.5
-- normal speed
set speed to regular
-- eject tape
eject device "cassette recorder"
end tell
-- delay 0.5
-- close every machine saving no
-- quit
end tell
end run

80
quick.sh Executable file
View File

@ -0,0 +1,80 @@
#!/bin/bash
GAME="$1"
RAND=0
if [ "$GAME" = "random" ]
then
GAME=""
RAND=1
fi
ITEMS=$(curl -sL http://asciiexpress.net/gameserver/links.html | awk -F\" '{print $4}' | sort | grep -i "$GAME" | wc -l)
if (( RAND == 0 ))
then
if (( ITEMS == 0 ))
then
echo "no $GAME game found" >&2
exit 1
fi
curl -sL http://asciiexpress.net/gameserver/links.html | awk -F\" '{print $4}' | sort | grep -i "$GAME" | nl -nln
ITEM=1
if (( ITEMS > 1 ))
then
echo
echo -n "pick one: "
read ITEM
test -z "$ITEM" && ITEM=1
fi
LINE=$(curl -sL http://asciiexpress.net/gameserver/links.html | awk -F\" '{print $4}' | sort | grep -ni "$GAME" | head -$ITEM | tail -1 | awk -F: '{print $1}')
else
LINE=$(( RANDOM % ITEMS + 1))
fi
GAME=$(curl -sL http://asciiexpress.net/gameserver/links.html | sort | head -$LINE | tail -1 | awk -F\" '{print $4 "," $6}' | sed 's/.html$/.qr.wav/')
DOWN=$((LINE - 1))
TITLE=$(echo $GAME | awk -F, '{print $1}')
GAME_URL=$(echo $GAME | awk -F, '{print "http://asciiexpress.net/gameserver/" $2}')
rm -f quick.aif
echo
echo -n "Downloading $GAME_URL"
echo
curl -sL $GAME_URL | sox - quick.aif
echo
echo -n Launching $TITLE...
if ! OUTPUT=$(
osascript quick.scrp \
gameserverclient.dsk \
quick.aif \
c_gameserverdisk_splash.tiff 5 \
c_gameserverdisk_mainscreen.tiff 5 \
$DOWN
)
then
echo FAILED
exit 1
fi
if echo $OUTPUT | grep ERROR >/dev/null 2>&1
then
echo FAILED
echo $OUTPUT
echo
exit 1
fi
rm -f quick.aif
echo LAUNCHED
echo
#xdotool windowfocus $WINDOWID 2>/dev/null
#osascript -e 'activate application "XQuartz"'

View File

@ -31,8 +31,6 @@ on run argv
set monochrome screen to false
set scanlines to true
set speaker volume to 0.25
-- full speed ahead
-- set speed to maximum
-- load disk
insert my_path & my_disk into device "S6D1"
@ -65,6 +63,7 @@ on run argv
-- down arrow 17x and return
repeat 17 times
type key down arrow
delay 0.03
end repeat
-- ballblazer selected