1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-16 22:41:52 +03:00

various changes to improve integration tests

This commit is contained in:
Jesse Duffield
2022-09-09 21:11:05 -07:00
parent 7b757d1cfe
commit 7af7af27c6
103 changed files with 2883 additions and 1525 deletions

View File

@ -206,6 +206,16 @@ func NewGui(mode OutputMode, supportOverlaps bool, playMode PlayMode, headless b
return nil, err
}
if headless || runtime.GOOS == "windows" {
g.maxX, g.maxY = g.screen.Size()
} else {
// TODO: find out if we actually need this bespoke logic for linux
g.maxX, g.maxY, err = g.getTermWindowSize()
if err != nil {
return nil, err
}
}
g.outputMode = mode
g.stop = make(chan struct{})
@ -225,15 +235,6 @@ func NewGui(mode OutputMode, supportOverlaps bool, playMode PlayMode, headless b
}
}
if runtime.GOOS != "windows" {
g.maxX, g.maxY, err = g.getTermWindowSize()
if err != nil {
return nil, err
}
} else {
g.maxX, g.maxY = Screen.Size()
}
g.BgColor, g.FgColor, g.FrameColor = ColorDefault, ColorDefault, ColorDefault
g.SelBgColor, g.SelFgColor, g.SelFrameColor = ColorDefault, ColorDefault, ColorDefault

View File

@ -84,6 +84,10 @@ func (g *Gui) tcellInitSimulation() error {
} else {
g.screen = s
Screen = s
// setting to a larger value than the typical terminal size
// so that during a test we're more likely to see an item to select in a view.
s.SetSize(100, 100)
s.Sync()
return nil
}
}

View File

@ -1245,6 +1245,9 @@ func (v *View) SelectedLineIdx() int {
// expected to only be used in tests
func (v *View) SelectedLine() string {
if len(v.lines) == 0 {
return ""
}
line := v.lines[v.SelectedLineIdx()]
str := lineType(line).String()
return strings.Replace(str, "\x00", " ", -1)