package tui import ( "errors" "fmt" "testing" "git.tordarus.net/Tordarus/tui" "git.tordarus.net/Tordarus/tui/views" "github.com/gdamore/tcell" ) func TestScreen(t *testing.T) { textView := views.NewTextView("hello world") eventView := views.NewEventView(textView) screen, err := tui.NewScreen(eventView) if err != nil { t.Error(err) return } eventView.KeyPressed = func(event *tui.KeyEvent) (consumed bool) { if event.Key() == tcell.KeyCtrlC { screen.StopWithError(errors.New(fmt.Sprintf("key: %#v | rune: %s", event.Key(), string(event.Rune())))) } //textView.Text = event.When().String() return true } err = screen.Start() fmt.Println(err) }