Skip to content

Commit a305cc2

Browse files
Testing: Add tests around name casing
1 parent 96cbf61 commit a305cc2

File tree

4 files changed

+372
-5
lines changed

4 files changed

+372
-5
lines changed

notes/testplan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ For the following cases, open `/TESTS` and `/TESTS/FOLDER`:
714714

715715
* Find make a copy of a `PRODOS` system file. Rename it to have a ".SYSTEM" suffix. Verify that it updates to have an application icon. Rename it again to remove the suffix. Verify that it updates to have a system file icon. Repeat several times. Verify that the icon has not shifted in position.
716716

717-
## Name Casing
717+
## Name Casing -- covered by `tests/name_casing.lua`
718718

719719
* Verify that GS/OS volume name cases show correctly.
720720
* Verify that GS/OS file name cases show correctly in `/TESTS/PROPERTIES/GS.OS.NAMES`

tests/lib/a2d.lua

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,19 @@ function a2d.RenamePath(path, newname)
320320
a2d.RenameSelection(newname)
321321
end
322322

323+
function a2d.DuplicateSelection(newname)
324+
a2d.OAShortcut("D")
325+
apple2.ControlKey("X") -- clear
326+
apple2.Type(newname)
327+
apple2.ReturnKey()
328+
a2d.WaitForRepaint()
329+
end
330+
331+
function a2d.DuplicatePath(path, newname)
332+
a2d.SelectPath(path)
333+
a2d.DuplicateSelection(newname)
334+
end
335+
323336
function a2d.DeleteSelection()
324337
a2d.OADelete()
325338
emu.wait(5) -- wait for enumeration
@@ -348,10 +361,20 @@ function a2d.CreateFolder(path)
348361
a2d.WaitForRepaint()
349362
end
350363

351-
function a2d.EraseVolume(name)
364+
function a2d.FormatVolume(name, opt_new_name)
365+
a2d.SelectPath("/"..name)
366+
a2d.InvokeMenuItem(a2d.SPECIAL_MENU, a2d.SPECIAL_FORMAT_DISK)
367+
apple2.Type(opt_new_name or name)
368+
a2d.DialogOK()
369+
a2d.WaitForRepaint()
370+
a2d.DialogOK() -- confirm overwrite
371+
emu.wait(5)
372+
end
373+
374+
function a2d.EraseVolume(name, opt_new_name)
352375
a2d.SelectPath("/"..name)
353376
a2d.InvokeMenuItem(a2d.SPECIAL_MENU, a2d.SPECIAL_ERASE_DISK)
354-
apple2.Type(name) -- new name
377+
apple2.Type(opt_new_name or name)
355378
a2d.DialogOK()
356379
a2d.WaitForRepaint()
357380
a2d.DialogOK() -- confirm overwrite
@@ -418,6 +441,12 @@ function a2d.ToggleOptionShowShortcutsOnStartup()
418441
a2d.CloseWindow()
419442
a2d.CloseAllWindows()
420443
end
444+
function a2d.ToggleOptionPreserveCase()
445+
a2d.OpenPath("/A2.DESKTOP/APPLE.MENU/CONTROL.PANELS/OPTIONS")
446+
a2d.OAShortcut("4") -- Toggle "Preserve uppercase and lowercase in names"
447+
a2d.CloseWindow()
448+
a2d.CloseAllWindows()
449+
end
421450

422451
function a2d.Quit()
423452
a2d.InvokeMenuItem(a2d.FILE_MENU, -1)

tests/lib/apple2.lua

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,12 +537,23 @@ function apple2.ResetMouse()
537537
mouse_y = 0
538538
end
539539

540-
function apple2.ClickMouseButton()
540+
function apple2.PressMouseButton()
541541
EnsureMouse()
542542
local field = get_field(mouse.b.port, mouse.b.field)
543543
field:set_value(1)
544544
emu.wait(1/60)
545-
field:clear_value(1)
545+
end
546+
547+
function apple2.ReleaseMouseButton()
548+
EnsureMouse()
549+
local field = get_field(mouse.b.port, mouse.b.field)
550+
field:clear_value()
551+
emu.wait(1/60)
552+
end
553+
554+
function apple2.ClickMouseButton()
555+
PressMouseButton()
556+
ReleaseMouseButton()
546557
end
547558

548559
function apple2.DoubleClickMouseButton()

0 commit comments

Comments
 (0)