Skip to content

Commit df95ebb

Browse files
Tests: coverage for open enclosing folder
1 parent af8642e commit df95ebb

File tree

3 files changed

+201
-2
lines changed

3 files changed

+201
-2
lines changed

notes/testplan.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ When steps say to a path e.g. `/TESTS/FOLDER/SUBFOLDER`, open the volume then ea
427427
* Launch DeskTop. Ensure nothing is selected. Press Open-Apple+Solid-Apple+Down. Verify that nothing happens.
428428

429429

430-
## Open Enclosing Folder
430+
## Open Enclosing Folder - covered by `tests/open_enclosing_folder.lua`
431431

432432
* Launch DeskTop. Open a volume window. Open a folder. Close the volume window. Press Open-Apple+Up. Verify that the volume window re-opens, and that the folder icon is selected. Press Open-Apple+Up again. Verify that the volume icon is selected.
433433
* Launch DeskTop. Open a volume window. Open a folder. Press Open-Apple+Up. Verify that the volume window is activated, and that the folder icon is selected. Press Open-Apple+Up again. Verify that the volume icon is selected.
@@ -437,7 +437,7 @@ When steps say to a path e.g. `/TESTS/FOLDER/SUBFOLDER`, open the volume then ea
437437
* Launch DeskTop. Open a volume window with multiple files. Open a folder. Close the volume window. Press Open-Apple+Up. Verify that the volume window is shown and the folder is selected. Press Right Arrow. Verify that only a single icon shows as selected.
438438

439439

440-
## Open Enclosing Folder Then Close
440+
## Open Enclosing Folder Then Close - covered by `tests/open_enclosing_folder_then_close.lua`
441441

442442
* Launch DeskTop. Open a volume window. Open a folder. Close the volume window. Press Open-Apple+Solid-Apple+Up. Verify that the volume window re-opens, and that the folder window closes, and that the folder icon is selected. Press Open-Apple+Solid-Apple+Up again. Verify that the volume window closes, and the volume icon is selected.
443443
* Launch DeskTop. Open a volume window. Open a folder. Press Open-Apple+Solid-Apple+Up. Verify that the volume window is activated, and that the folder window closes, and that the folder icon is selected. Press Open-Apple+Solid-Apple+Up again. Verify that the volume window closes, and that the volume icon is selected.

tests/open_enclosing_folder.lua

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
2+
function OAUp()
3+
apple2.PressOA()
4+
apple2.UpArrowKey()
5+
emu.wait(1/60)
6+
apple2.ReleaseOA()
7+
end
8+
9+
test.Step(
10+
"Open enclosing folder",
11+
function()
12+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU", true)
13+
a2d.CycleWindows()
14+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "A2.DESKTOP", "volume window should be on top")
15+
a2d.CloseWindow()
16+
test.ExpectEquals(a2dtest.GetWindowCount(), 1, "one window should be open")
17+
18+
OAUp()
19+
test.ExpectEquals(a2dtest.GetWindowCount(), 2, "two windows should be open")
20+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "A2.DESKTOP", "volume window should be open again")
21+
test.Snap("verify folder icon is selected")
22+
23+
OAUp()
24+
test.ExpectEquals(a2dtest.GetWindowCount(), 2, "two windows should be open")
25+
test.Snap("verify volume icon is selected")
26+
27+
a2d.CloseAllWindows()
28+
end)
29+
30+
test.Step(
31+
"Reactivate existing window",
32+
function()
33+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU", true)
34+
test.ExpectEquals(a2dtest.GetWindowCount(), 2, "two windows should be open")
35+
36+
OAUp()
37+
test.ExpectEquals(a2dtest.GetWindowCount(), 2, "two windows should be open")
38+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "A2.DESKTOP", "volume window should be open again")
39+
test.Snap("verify folder icon is selected")
40+
41+
OAUp()
42+
test.ExpectEquals(a2dtest.GetWindowCount(), 2, "two windows should be open")
43+
test.Snap("verify volume icon is selected")
44+
45+
a2d.CloseAllWindows()
46+
end)
47+
48+
49+
test.Step(
50+
"View change",
51+
function()
52+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU", true)
53+
a2d.CycleWindows()
54+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "A2.DESKTOP", "volume window should be on top")
55+
a2d.InvokeMenuItem(a2d.VIEW_MENU, a2d.VIEW_BY_NAME)
56+
a2d.CycleWindows()
57+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "APPLE.MENU", "folder window should be on top")
58+
59+
OAUp()
60+
test.ExpectEquals(a2dtest.GetWindowCount(), 2, "two windows should be open")
61+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "A2.DESKTOP", "volume window should be open again")
62+
test.Snap("verify folder icon is selected")
63+
64+
OAUp()
65+
test.ExpectEquals(a2dtest.GetWindowCount(), 2, "two windows should be open")
66+
test.Snap("verify volume icon is selected")
67+
68+
a2d.CloseAllWindows()
69+
end)
70+
71+
test.Step(
72+
"Icon selection with keyboard",
73+
function()
74+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU", true)
75+
76+
OAUp()
77+
test.ExpectEquals(a2dtest.GetWindowCount(), 2, "two windows should be open")
78+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "A2.DESKTOP", "volume window should be open again")
79+
test.Snap("verify folder icon is selected")
80+
81+
apple2.RightArrowKey()
82+
a2d.WaitForRepaint()
83+
test.Snap("verify single icon is selected")
84+
85+
a2d.CloseAllWindows()
86+
end)
87+
88+
test.Step(
89+
"Icon selection with keyboard with window cycling",
90+
function()
91+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU")
92+
93+
OAUp()
94+
test.ExpectEquals(a2dtest.GetWindowCount(), 2, "two windows should be open")
95+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "A2.DESKTOP", "volume window should be open again")
96+
test.Snap("verify folder icon is selected")
97+
98+
apple2.RightArrowKey()
99+
a2d.WaitForRepaint()
100+
test.Snap("verify single icon is selected")
101+
102+
a2d.CloseAllWindows()
103+
end)
104+
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
2+
function OASAUp()
3+
apple2.PressOA()
4+
apple2.PressSA()
5+
apple2.UpArrowKey()
6+
emu.wait(1/60)
7+
apple2.ReleaseOA()
8+
apple2.ReleaseSA()
9+
end
10+
11+
test.Step(
12+
"Open enclosing folder",
13+
function()
14+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU")
15+
OASAUp()
16+
test.ExpectEquals(a2dtest.GetWindowCount(), 1, "one window should be open")
17+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "A2.DESKTOP", "volume window should be open again")
18+
test.Snap("verify folder icon is selected")
19+
20+
OASAUp()
21+
test.ExpectEquals(a2dtest.GetWindowCount(), 0, "no windows should be open")
22+
test.Snap("verify volume icon is selected")
23+
end)
24+
25+
test.Step(
26+
"Reactivate existing window",
27+
function()
28+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU", true)
29+
test.ExpectEquals(a2dtest.GetWindowCount(), 2, "two windows should be open")
30+
31+
OASAUp()
32+
test.ExpectEquals(a2dtest.GetWindowCount(), 1, "one windows should be open")
33+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "A2.DESKTOP", "volume window should be open again")
34+
test.Snap("verify folder icon is selected")
35+
36+
OASAUp()
37+
test.ExpectEquals(a2dtest.GetWindowCount(), 0, "no windows should be open")
38+
test.Snap("verify volume icon is selected")
39+
end)
40+
41+
42+
test.Step(
43+
"View change",
44+
function()
45+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU", true)
46+
a2d.CycleWindows()
47+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "A2.DESKTOP", "volume window should be on top")
48+
a2d.InvokeMenuItem(a2d.VIEW_MENU, a2d.VIEW_BY_NAME)
49+
a2d.CycleWindows()
50+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "APPLE.MENU", "folder window should be on top")
51+
52+
OASAUp()
53+
test.ExpectEquals(a2dtest.GetWindowCount(), 1, "one window should be open")
54+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "A2.DESKTOP", "volume window should be open again")
55+
test.Snap("verify folder icon is selected")
56+
57+
OASAUp()
58+
test.ExpectEquals(a2dtest.GetWindowCount(), 0, "no windows should be open")
59+
test.Snap("verify volume icon is selected")
60+
end)
61+
62+
test.Step(
63+
"Icon selection with keyboard",
64+
function()
65+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU", true)
66+
67+
OASAUp()
68+
test.ExpectEquals(a2dtest.GetWindowCount(), 1, "one window should be open")
69+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "A2.DESKTOP", "volume window should be open again")
70+
test.Snap("verify folder icon is selected")
71+
72+
apple2.RightArrowKey()
73+
a2d.WaitForRepaint()
74+
test.Snap("verify single icon is selected")
75+
76+
a2d.CloseAllWindows()
77+
end)
78+
79+
test.Step(
80+
"Icon selection with keyboard with window cycling",
81+
function()
82+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU")
83+
84+
OASAUp()
85+
test.ExpectEquals(a2dtest.GetWindowCount(), 1, "one window should be open")
86+
test.ExpectEqualsIgnoreCase(a2dtest.GetFrontWindowTitle(), "A2.DESKTOP", "volume window should be open again")
87+
test.Snap("verify folder icon is selected")
88+
89+
apple2.RightArrowKey()
90+
a2d.WaitForRepaint()
91+
test.Snap("verify single icon is selected")
92+
93+
a2d.CloseAllWindows()
94+
end)
95+

0 commit comments

Comments
 (0)