...
1 package cview
2
3 import (
4 "fmt"
5
6 "github.com/gdamore/tcell/v3"
7 "github.com/gdamore/tcell/v3/vt"
8 )
9
10 const screenW, screenH = 80, 24
11
12
13 func newTestApp(root Primitive) (*Application, error) {
14
15 mt := vt.NewMockTerm(vt.MockOptSize{X: screenW, Y: screenH})
16 sc, err := tcell.NewTerminfoScreenFromTty(mt)
17 if err != nil {
18 return nil, fmt.Errorf("failed to create mock terminal screen: %s", err)
19 }
20 err = sc.Init()
21 if err != nil {
22 return nil, fmt.Errorf("failed to initialize mock terminal screen: %s", err)
23 }
24
25
26 app := NewApplication()
27 app.SetScreen(sc)
28 app.SetRoot(root, true)
29 return app, nil
30 }
31
View as plain text