28 lines
407 B
Go
28 lines
407 B
Go
|
package tui
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
"tui"
|
||
|
"tui/views"
|
||
|
|
||
|
"github.com/gdamore/tcell"
|
||
|
)
|
||
|
|
||
|
func TestScreen(t *testing.T) {
|
||
|
eventView := views.NewEventView()
|
||
|
screen, err := tui.NewScreen(eventView)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
eventView.KeyPressed = func(key tcell.Key) {
|
||
|
screen.StopWithError(errors.New(fmt.Sprintf("%#v", key)))
|
||
|
}
|
||
|
|
||
|
err = screen.Start()
|
||
|
fmt.Println(err)
|
||
|
}
|