Skip to content

Commit ac8fc7d

Browse files
Tests: Add Find Files tests
1 parent a6c646a commit ac8fc7d

File tree

4 files changed

+132
-3
lines changed

4 files changed

+132
-3
lines changed

notes/testplan.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,17 +1351,16 @@ Run these tests on a system without a real-time clock:
13511351
* Configure a system with two joysticks (or paddles 2 and 3). Run the DA. Verify that after the second joystick is moved, a second indicator is shown.
13521352
* Configure a system with a single joystick. Run the DA. Move the joystick to the right and bottom extremes. Verify that the indicator does not wrap to the left or top edges.
13531353

1354-
## Find Files
1354+
## Find Files - covered by `tests/find_files.lua`
13551355

13561356
* Launch DeskTop. Close all windows. Apple Menu > Find Files. Type `PRODOS` and click Search. Verify that all volumes are searched recursively.
13571357
* Launch DeskTop. Open a volume window. Apple Menu > Find Files. Type `PRODOS` and click Search. Verify that only that volume's contents are searched recursively.
1358-
* Launch DeskTop. Open a volume window. Open a folder window. Apple Menu > Find Files. Type "PRODOS" and click Search. Verify that only that folder's contents are searched recursively.
1358+
* Launch DeskTop. Open a volume window. Open a folder window. Apple Menu > Find Files. Type `PRODOS` and click Search. Verify that only that folder's contents are searched recursively.
13591359
* Launch DeskTop. Open a window. Apple Menu > Find Files. Type `*` and click Search. Select a file in the list. Press Open-Apple+O. Verify that the Find Files window closes, that a window containing the file opens, and that the file icon is selected.
13601360
* Launch DeskTop. Open a window. Apple Menu > Find Files. Type `*` and click Search. Select a file in the list. Press Solid-Apple+O. Verify that the Find Files window closes, that a window containing the file opens, and that the file icon is selected.
13611361
* Launch DeskTop. Open a window. Apple Menu > Find Files. Type `*` and click Search. Double-click a file in the list. Verify that the Find Files window closes, that a window containing the file opens, and that the file icon is selected.
13621362
* Launch DeskTop. Open a volume window. Open a folder window. Activate the volume window. Apple Menu > Find Files. Type `*` and click Search. Double-click a file in the list that's inside the folder. Verify that the Find Files window closes, and that the file icon is selected.
13631363

1364-
* Create a set of nested directories, 21 levels deep or more (e.g. `/VOL/D/D/D/D/D/D/D/D/D/D/D/D/D/D/D/D/D/D/D/D/D`). Launch DeskTop and open the volume. Apple Menu > Find Files. Type `*` and click Search. Verify that the DA doesn't crash. (Not all files will be found, though.)
13651364
* Rename `/TESTS` to `/ABCDEF123456789`. Open the volume. Apple Menu > Find Files. Type *. Verify that the DA doesn't crash.
13661365
* Open `/TESTS/FIND.FILES`. Apple Menu > Find Files. Type `*` and click Search. Verify that the DA doesn't crash. (But the deeply nested `NOT.FOUND` file will not be found.)
13671366

res/tests.hdv

0 Bytes
Binary file not shown.

tests/find_files.lua

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
--[[ BEGINCONFIG ========================================
2+
3+
MODELARGS="-sl2 mouse -sl7 cffa2"
4+
DISKARGS="-hard1 $HARDIMG -hard2 res/tests.hdv"
5+
6+
======================================== ENDCONFIG ]]--
7+
8+
test.Step(
9+
"Search all volumes",
10+
function()
11+
a2d.CloseAllWindows()
12+
a2d.InvokeMenuItem(a2d.APPLE_MENU, a2d.FIND_FILES)
13+
apple2.Type("PRODOS")
14+
a2d.DialogOK()
15+
emu.wait(10)
16+
test.Snap("verify all volumes searched")
17+
a2d.DialogCancel()
18+
end)
19+
20+
test.Step(
21+
"Search open volume",
22+
function()
23+
a2d.OpenPath("/A2.DESKTOP")
24+
a2d.InvokeMenuItem(a2d.APPLE_MENU, a2d.FIND_FILES)
25+
apple2.Type("PRODOS")
26+
a2d.DialogOK()
27+
emu.wait(10)
28+
test.Snap("verify only open volume searched")
29+
a2d.DialogCancel()
30+
end)
31+
32+
test.Step(
33+
"Search open volume",
34+
function()
35+
a2d.OpenPath("/A2.DESKTOP/EXTRAS")
36+
a2d.InvokeMenuItem(a2d.APPLE_MENU, a2d.FIND_FILES)
37+
apple2.Type("PRODOS")
38+
a2d.DialogOK()
39+
emu.wait(10)
40+
test.Snap("verify only open folder searched")
41+
a2d.DialogCancel()
42+
end)
43+
44+
test.Step(
45+
"OA+O on selection",
46+
function()
47+
a2d.OpenPath("/A2.DESKTOP")
48+
a2d.InvokeMenuItem(a2d.APPLE_MENU, a2d.FIND_FILES)
49+
apple2.Type("CAL*")
50+
a2d.DialogOK()
51+
emu.wait(10)
52+
apple2.DownArrowKey() -- select first result
53+
a2d.OAShortcut("O")
54+
a2d.WaitForRepaint()
55+
test.Snap("verify window opened and file selected")
56+
end)
57+
58+
test.Step(
59+
"SA+O on selection",
60+
function()
61+
a2d.OpenPath("/A2.DESKTOP")
62+
a2d.InvokeMenuItem(a2d.APPLE_MENU, a2d.FIND_FILES)
63+
apple2.Type("CAL*")
64+
a2d.DialogOK()
65+
emu.wait(10)
66+
apple2.DownArrowKey() -- select first result
67+
a2d.SAShortcut("O")
68+
a2d.WaitForRepaint()
69+
test.Snap("verify window opened and file selected")
70+
end)
71+
72+
test.Step(
73+
"Double-click on selection in inactive window",
74+
function()
75+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU", true) -- leave parent open
76+
a2d.CycleWindows() -- put volume in foreground
77+
a2d.InvokeMenuItem(a2d.APPLE_MENU, a2d.FIND_FILES)
78+
apple2.Type("CAL*")
79+
a2d.DialogOK()
80+
emu.wait(10)
81+
a2d.InMouseKeysMode(function(m)
82+
m.MoveToApproximately(100,60)
83+
m.DoubleClick()
84+
end)
85+
a2d.WaitForRepaint()
86+
test.Snap("verify window activated and file selected")
87+
end)
88+
89+
test.Step(
90+
"Deeply nested",
91+
function()
92+
a2d.OpenPath("/TESTS/FIND.FILES")
93+
a2d.InvokeMenuItem(a2d.APPLE_MENU, a2d.FIND_FILES)
94+
apple2.Type("*")
95+
a2d.DialogOK()
96+
emu.wait(10)
97+
test.Snap("verify no crash")
98+
end)
99+
100+
test.Step(
101+
"Long pathnames",
102+
function()
103+
a2d.RenamePath("/TESTS", "ABCDEF123456789")
104+
a2d.OpenPath("/ABCDEF123456789")
105+
a2d.InvokeMenuItem(a2d.APPLE_MENU, a2d.FIND_FILES)
106+
apple2.Type("*")
107+
a2d.DialogOK()
108+
emu.wait(10)
109+
test.Snap("verify no crash")
110+
a2d.RenamePath("/ABCDEF123456789", "/TESTS")
111+
end)
112+
113+
test.Step(
114+
"Selection",
115+
function()
116+
a2d.OpenPath("/TESTS/FOLDER")
117+
a2d.InvokeMenuItem(a2d.APPLE_MENU, a2d.FIND_FILES)
118+
apple2.Type("*")
119+
a2d.DialogOK()
120+
emu.wait(10)
121+
apple2.DownArrowKey()
122+
apple2.ReturnKey()
123+
emu.wait(10)
124+
apple2.DownArrowKey()
125+
test.Snap("verify only one entry appears highlighted")
126+
end)
127+
128+
129+

tests/lib/a2d.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ for k,v in pairs({
109109
CONTROL_PANELS = 3,
110110
CALCULATOR = 6,
111111
CHANGE_TYPE = 8,
112+
FIND_FILES = 9,
112113
RUN_BASIC_HERE = 11,
113114
SORT_DIRECTORY = 12,
114115

0 commit comments

Comments
 (0)