Initial attempt at making rogue work with application overrides.

This commit is contained in:
Storm Dragon committed 2026-10-28 16:24:44 -04:00
1 parent 088f706cb4
commit 46dc520854
15 files changed
+1836 -111

No files matched your search

+47 -1
View File
@@ -35,12 +35,56 @@ func override_screen(terminal int, kind string) screen.Snapshot {
s.Attributes[111] = screen.Attribute{Foreground: screen.ColorIndexed, Background: screen.ColorIndexed | 7}
case "networkmanager":
copy(s.Line(2), []rune("┌──────── NetworkManager TUI ─────────┐"))
case "rogue":
copy(s.Line(5), []rune("|..@...+"))
copy(s.Line(23), []rune("Level: 1 Gold: 0 Hp: 12(12) Str: 16(16) Arm: 4 Exp: 1/0"))
default:
copy(s.Line(23), []rune(kind))
}
return s
}
func TestRogueMenuSelectionNamedReadProfileAndShellExit(t *testing.T) {
a, voice := persistence_application(t, true)
override_read(t, a, override_screen(1, "rogue"))
a.open_applications()
a.ui.handle(interaction.Key{Text: "r"})
if got := voice.messages[len(voice.messages)-1]; got != "Rogue" {
t.Fatal(got)
}
a.ui.handle(interaction.Key{Name: "enter"})
override_read(t, a, override_screen(1, "rogue"))
if a.overrideCurrent == nil || a.overrideCurrent.id != "rogue" {
t.Fatal("Rogue not activated")
}
a.handle_command(command.ReadLiveRegion1)
if got := voice.messages[len(voice.messages)-1]; got != "Health: 12 of 12" {
t.Fatal(got)
}
base := a.overrideCurrent.underlying.settings.live.Presentation.Speech.Rate
a.handle_command(command.NextQuickValue)
rate := a.settings.live.Presentation.Speech.Rate
if rate == base {
t.Fatal("application rate unchanged")
}
a.save_settings()
finish_persistence(t, a, false)
path := filepath.Join(filepath.Dir(a.options.ConfigPath), "applications", "rogue.toml")
doc, err := config.Open_application_document(path, a.overrideCurrent.base)
if err != nil || doc.Settings.Presentation.Speech.Rate != rate {
t.Fatal("Rogue profile not saved", err)
}
override_read(t, a, override_screen(1, "[Username@host directory] $"))
if a.overrideCurrent != nil || a.overrides[1] != nil || a.settings.live.Presentation.Speech.Rate != base {
t.Fatal("shell did not restore default settings")
}
a.select_override("rogue")
override_read(t, a, override_screen(1, "rogue"))
if a.overrideCurrent == nil || a.settings.live.Presentation.Speech.Rate != rate {
t.Fatal("Rogue profile not reloaded")
}
}
func TestOverrideRestoresSynthesizerAndKeepsSaveBlockedUntilCompletion(t *testing.T) {
for _, failed := range []bool{false, true} {
a, voice, _ := selection_application(t, true)
@@ -136,8 +180,9 @@ func TestApplicationsMenuActivatesOnlyOnEnterAndReleasesCapture(t *testing.T) {
for _, step := range []struct{ key, want string }{
{"down", "NetworkManager"},
{"down", "Ninjam"},
{"down", "Rogue"},
{"down", "Default"},
{"up", "Ninjam"},
{"up", "Rogue"},
} {
a.ui.handle(interaction.Key{Name: step.key})
if got := voice.messages[len(voice.messages)-1]; got != step.want {
@@ -172,6 +217,7 @@ func TestApplicationsMenuActivatesOnlyOnEnterAndReleasesCapture(t *testing.T) {
t.Fatal("Cancel button changed selection")
}
a.open_applications()
a.ui.handle(interaction.Key{Name: "down"}) // Rogue
a.ui.handle(interaction.Key{Name: "down"}) // list wraps to Default
a.ui.handle(interaction.Key{Name: "enter"})
if a.saves_unavailable() || a.engine.Tracking_mode() != "cursor" {