diff options
| author | adamdottv <[email protected]> | 2025-04-28 08:46:09 -0500 |
|---|---|---|
| committer | adamdottv <[email protected]> | 2025-04-30 07:46:34 -0500 |
| commit | 61b605e724eb4cc50ab831534fcdd18e031d68eb (patch) | |
| tree | b15b074a8fed1931e179a8d3df08d05b753c7aa3 /internal/tui/theme/theme_test.go | |
| parent | 61d9dc95111d2645a49816f6d9d6cc1014be1a22 (diff) | |
| download | opencode-61b605e724eb4cc50ab831534fcdd18e031d68eb.tar.gz opencode-61b605e724eb4cc50ab831534fcdd18e031d68eb.zip | |
feat: themes
Diffstat (limited to 'internal/tui/theme/theme_test.go')
| -rw-r--r-- | internal/tui/theme/theme_test.go | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/internal/tui/theme/theme_test.go b/internal/tui/theme/theme_test.go new file mode 100644 index 000000000..5ec810e33 --- /dev/null +++ b/internal/tui/theme/theme_test.go @@ -0,0 +1,89 @@ +package theme + +import ( + "testing" +) + +func TestThemeRegistration(t *testing.T) { + // Get list of available themes + availableThemes := AvailableThemes() + + // Check if "catppuccin" theme is registered + catppuccinFound := false + for _, themeName := range availableThemes { + if themeName == "catppuccin" { + catppuccinFound = true + break + } + } + + if !catppuccinFound { + t.Errorf("Catppuccin theme is not registered") + } + + // Check if "gruvbox" theme is registered + gruvboxFound := false + for _, themeName := range availableThemes { + if themeName == "gruvbox" { + gruvboxFound = true + break + } + } + + if !gruvboxFound { + t.Errorf("Gruvbox theme is not registered") + } + + // Check if "monokai" theme is registered + monokaiFound := false + for _, themeName := range availableThemes { + if themeName == "monokai" { + monokaiFound = true + break + } + } + + if !monokaiFound { + t.Errorf("Monokai theme is not registered") + } + + // Try to get the themes and make sure they're not nil + catppuccin := GetTheme("catppuccin") + if catppuccin == nil { + t.Errorf("Catppuccin theme is nil") + } + + gruvbox := GetTheme("gruvbox") + if gruvbox == nil { + t.Errorf("Gruvbox theme is nil") + } + + monokai := GetTheme("monokai") + if monokai == nil { + t.Errorf("Monokai theme is nil") + } + + // Test switching theme + originalTheme := CurrentThemeName() + + err := SetTheme("gruvbox") + if err != nil { + t.Errorf("Failed to set theme to gruvbox: %v", err) + } + + if CurrentThemeName() != "gruvbox" { + t.Errorf("Theme not properly switched to gruvbox") + } + + err = SetTheme("monokai") + if err != nil { + t.Errorf("Failed to set theme to monokai: %v", err) + } + + if CurrentThemeName() != "monokai" { + t.Errorf("Theme not properly switched to monokai") + } + + // Switch back to original theme + _ = SetTheme(originalTheme) +}
\ No newline at end of file |
