Checkpoint

This commit is contained in:
maze authored and maze committed 2026-10-29 17:29:54 +01:00
1 parent c5d6137fab
commit 4ae7655cd8
223 files changed
+14770 -18352

No files matched your search

+58
View File
@@ -0,0 +1,58 @@
package menu
import "testing"
// Example usage
type testDisplaySettings struct {
Brightness uint8 `icon:"☀️" menu:"Brightness"`
Contrast uint8 `icon:"🔆" menu:"Contrast level" step:"8"`
}
type testAudioSettings struct {
Volume uint8 `icon:"🔊" menu:"Volume" min:"1" max:"100"`
Mute bool `icon:"🔇" menu:"Mute"`
}
type testSpectrumSettings struct {
Waterfall bool `menu:"Waterfall display"`
Stereo bool `menu:"Use stereo channels"`
MinFrequency int `menu:"High pass frequency" min:"0" max:"22050" step:"50"`
MaxFrequency int `menu:"Low pass frequency" min:"0" max:"22050" step:"50"`
}
type testSettings struct {
Display testDisplaySettings `icon:"🖥️" menu:"Display"`
Audio testAudioSettings `icon:"🎧" menu:"Audio"`
Language string `icon:"🌐" menu:"Language"`
Spectrum testSpectrumSettings `menu:"Spectrum analyzer"`
Ignored float64 `menu:"-"`
}
func TestMenu(t *testing.T) {
var settings testSettings
menu, err := New(&settings, 4, nil)
if err != nil {
t.Error(err)
}
t.Logf("menu: %#+v", menu)
}
func TestMenuNil(t *testing.T) {
_, err := New(nil, 4, nil)
if err == nil {
t.Fatal("expected error")
return
}
t.Logf("expected error from nil, got %q", err)
}
func TestMenuNotPointer(t *testing.T) {
var settings testSettings
menu, err := New(settings, 4, nil)
if err != nil {
t.Error(err)
}
t.Logf("menu: %#+v", menu)
}