Skip to content

Commit 3dae0a2

Browse files
Tests: Add tests for Options control panel
1 parent 953f09c commit 3dae0a2

File tree

2 files changed

+75
-1
lines changed

2 files changed

+75
-1
lines changed

notes/testplan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ Repeat for every desk accessory that runs in a window.
12021202

12031203
* Configure a system with a RAMCard, and ensure DeskTop is configured to copy to RAMCard on startup. Launch DeskTop. Apple Menu > Control Panels. Open Control Panel. Modify a setting e.g. the desktop pattern. Close the window. Reboot the system. Verify that the setting is retained.
12041204

1205-
## Options - need a way to eject via emulator from Lua
1205+
## Options - covered by `tests/options.lua`
12061206

12071207
* Open the Options DA. Eject the startup disk. Close the DA without changing any settings. Verify that you are not prompted to save.
12081208
* Open the Options DA. Eject the startup disk. Modify a setting and close the DA. Verify that you are prompted to save.

tests/options.lua

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
--[[ BEGINCONFIG ========================================
2+
3+
MODEL="apple2cp"
4+
MODELARGS="-ramsize 1152K -gameio joy"
5+
DISKARGS="-flop3 $HARDIMG"
6+
7+
======================================== ENDCONFIG ]]--
8+
9+
emu.wait(50) -- IIc emulation is very slow
10+
11+
test.Step(
12+
"No prompt if no change",
13+
function()
14+
local drive = apple2.Get35Drive1()
15+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU/CONTROL.PANELS/OPTIONS")
16+
17+
local current = drive.filename
18+
drive:unload()
19+
20+
a2d.CloseWindow()
21+
a2d.WaitForRepaint()
22+
test.Snap("verify no prompt to save")
23+
24+
drive:load(current)
25+
a2d.CloseAllWindows()
26+
end)
27+
28+
test.Step(
29+
"Prompt if changed",
30+
function()
31+
local drive = apple2.Get35Drive1()
32+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU/CONTROL.PANELS/OPTIONS")
33+
a2d.OAShortcut("5") -- show invisible files
34+
35+
local current = drive.filename
36+
drive:unload()
37+
38+
a2d.CloseWindow()
39+
a2d.WaitForRepaint()
40+
test.Snap("verify prompt to save")
41+
a2d.DialogCancel()
42+
43+
drive:load(current)
44+
a2d.CloseAllWindows()
45+
end)
46+
47+
test.Step(
48+
"Repaints when obscured",
49+
function()
50+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU/CONTROL.PANELS/OPTIONS")
51+
a2d.InMouseKeysMode(function(m)
52+
m.MoveToApproximately(280, 45)
53+
m.ButtonDown()
54+
m.MoveToApproximately(280,192)
55+
m.ButtonUp()
56+
end)
57+
a2d.WaitForRepaint()
58+
a2d.OAShortcut("1")
59+
a2d.OAShortcut("2")
60+
a2d.OAShortcut("3")
61+
test.Snap("verify no mispaints")
62+
a2d.CloseWindow()
63+
a2d.CloseAllWindows()
64+
end)
65+
66+
test.Step(
67+
"No crash after running",
68+
function()
69+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU/CONTROL.PANELS/OPTIONS")
70+
a2d.CloseWindow()
71+
a2d.InvokeMenuItem(a2d.APPLE_MENU, a2d.RUN_BASIC_HERE)
72+
a2d.WaitForRestart()
73+
test.Snap("verify no crash to monitor")
74+
end)

0 commit comments

Comments
 (0)