Skip to content

Commit d56a9bf

Browse files
Tests: add test for window restoration
1 parent 397fadc commit d56a9bf

19 files changed

+161
-38
lines changed

notes/testplan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ For the following cases, open `/TESTS` and `/TESTS/FOLDER`:
762762
* Open a window. Drag the window so that the left edge of the window is offscreen. Verify that the "X Items" display gets cut off. Drag the window so that the right edge of the window is offscreen. Verify that the "XK available" display gets cut off. Repeat with the window sized so that both scrollbars appear and thumbs moved to the middle of the scrollbars.
763763

764764

765-
## Window Restoration
765+
## Window Restoration - mostly covered by `tests/window_restoration.lua`
766766

767767
* Launch DeskTop. Open a subdirectory folder. Quit and relaunch DeskTop. Verify that the used/free numbers in the restored windows are non-zero.
768768

tests/alerts.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test.Step(
2222
function()
2323
a2d.AddShortcut("/A2.DESKTOP/APPLE.MENU/CALCULATOR")
2424
a2d.ToggleOptionShowShortcutsOnStartup() -- Enable
25-
a2d.Restart()
25+
a2d.Reboot()
2626

2727
apple2.Type("1")
2828
a2d.DialogOK()

tests/calendar.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ end)
1717
test.Step(
1818
"Calendar - without real-time clock",
1919
function()
20-
a2d.RemoveClockDriverAndRestart()
20+
a2d.RemoveClockDriverAndReboot()
2121

2222
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU/CALENDAR")
2323
a2d.WaitForRepaint()

tests/control_panel_ramcard.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test.Step(
99
"Settings saved back to boot volume",
1010
function()
1111
a2d.ToggleOptionCopyToRAMCard() -- enable
12-
a2d.Restart()
12+
a2d.Reboot()
1313

1414
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU/CONTROL.PANELS/CONTROL.PANEL")
1515
apple2.RightArrowKey()
@@ -18,7 +18,7 @@ test.Step(
1818
a2d.WaitForRepaint()
1919
a2d.CloseWindow()
2020
a2d.CloseAllWindows()
21-
a2d.Restart()
21+
a2d.Reboot()
2222

2323
test.Snap("verify changed desktop is retained")
2424
end)

tests/date_and_time.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ test.Step(
1616
a2dtest.ExpectFullRepaint(a2d.DialogOK)
1717
test.Snap("verify 24-hour format shown")
1818
a2d.CloseAllWindows()
19-
a2d.Restart()
19+
a2d.Reboot()
2020
end)
2121

2222
test.Step(
@@ -75,7 +75,7 @@ test.Step(
7575
a2d.CloseAllWindows()
7676
end)
7777

78-
a2d.RemoveClockDriverAndRestart()
78+
a2d.RemoveClockDriverAndReboot()
7979

8080
test.Step(
8181
"Fresh disk image",
@@ -88,7 +88,7 @@ test.Step(
8888
test.Snap("verify dates now Today")
8989
a2d.SelectAndOpen("DATE.AND.TIME")
9090
a2dtest.ExpectMinimalRepaint(a2d.DialogOK)
91-
a2d.Restart()
91+
a2d.Reboot()
9292
end)
9393

9494
test.Step(
@@ -104,7 +104,7 @@ test.Step(
104104
test.Snap("verify date is modified")
105105
a2d.DialogOK()
106106
-- Should write timestamp to DESKTOP.SYSTEM. Restart to verify.
107-
a2d.Restart()
107+
a2d.Reboot()
108108

109109
-- Create new folder
110110
a2d.CreateFolder("/RAM1/NOT.TODAY")

tests/desk_accessories.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function MoveDoesntRepaintTest(name, path, x, y, opt_threshold)
4141

4242
a2d.CloseWindow()
4343
a2d.CloseAllWindows()
44-
a2d.Restart()
44+
a2d.Reboot()
4545
end)
4646
end
4747

tests/international.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
============================================================]]--
77

88
-- Remove clock driver (to avoid build-relative dates)
9-
a2d.RemoveClockDriverAndRestart()
9+
a2d.RemoveClockDriverAndReboot()
1010

1111
test.Step(
1212
"International - full repaint",

tests/lib/a2d.lua

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,9 @@ end
378378
-- Configuration
379379
--------------------------------------------------
380380

381-
function a2d.RemoveClockDriverAndRestart()
381+
function a2d.RemoveClockDriverAndReboot()
382382
a2d.DeletePath("/A2.DESKTOP/CLOCK.SYSTEM")
383-
a2d.Restart()
383+
a2d.Reboot()
384384
end
385385

386386
function a2d.ToggleOptionCopyToRAMCard()
@@ -396,8 +396,19 @@ function a2d.ToggleOptionShowShortcutsOnStartup()
396396
a2d.CloseAllWindows()
397397
end
398398

399+
function a2d.Quit()
400+
a2d.InvokeMenuItem(a2d.FILE_MENU, -1)
401+
a2d.WaitForRestart()
402+
end
403+
404+
function a2d.QuitAndRestart()
405+
a2d.Quit()
406+
apple2.ReturnKey() -- Launch PRODOS in Bitsy Bye
407+
a2d.WaitForRestart()
408+
end
409+
399410
-- Reboot via menu equivalent of PR#7
400-
function a2d.Restart()
411+
function a2d.Reboot()
401412
a2d.InvokeMenuItem(a2d.STARTUP_MENU, 1) -- startup volume index
402413
a2d.WaitForRestart()
403414
end
@@ -533,6 +544,16 @@ function a2d.GrowWindowBy(x, y)
533544
a2d.WaitForRepaint()
534545
end
535546

547+
function a2d.DragSelectMultipleVolumes()
548+
a2d.InMouseKeysMode(function(m)
549+
m.MoveToApproximately(560,20)
550+
m.ButtonDown()
551+
m.MoveByApproximately(-80, 130)
552+
m.ButtonUp()
553+
a2d.WaitForRepaint()
554+
end)
555+
end
556+
536557
--------------------------------------------------
537558
-- Modifier Key Combos
538559
--------------------------------------------------

tests/lib/apple2.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ function apple2.CompareDHR(bytes)
814814
local expected = bytes[row*80+col]
815815
local actual = apple2.GetDoubleHiresByte(row, col)
816816
if actual ~= expected then
817-
print(string.format("difference at %04X - %02X vs. %02X", (row*80+col), actual, expected))
817+
print(string.format("difference at row %d col %d - %02X vs. %02X", row, col, actual, expected))
818818
return false
819819
end
820820
end

tests/lib/test.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ end
5252
-- test.Variants({"v1", "v2"}, function(idx) ... end}
5353
function test.Variants(t, func)
5454
for idx, name in pairs(t) do
55-
test.Step(name, function() return func(idx) end)
55+
test.Step(name, function() return func(idx, name) end)
5656
end
5757
end
5858

0 commit comments

Comments
 (0)