1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-12-01 22:52:01 +02:00

Add busy count for integration tests

Integration tests need to be notified when Lazygit is idle so they can progress to the next assertion / user action.
This commit is contained in:
Jesse Duffield
2023-07-03 14:16:43 +10:00
parent 631cf1e873
commit 6c4e7ee972
23 changed files with 184 additions and 78 deletions

View File

@@ -48,7 +48,7 @@ func (gui *Gui) newStringTask(view *gocui.View, str string) error {
func (gui *Gui) newStringTaskWithoutScroll(view *gocui.View, str string) error {
manager := gui.getManager(view)
f := func(stop chan struct{}) error {
f := func(tasks.TaskOpts) error {
gui.c.SetViewContent(view, str)
return nil
}
@@ -65,7 +65,7 @@ func (gui *Gui) newStringTaskWithoutScroll(view *gocui.View, str string) error {
func (gui *Gui) newStringTaskWithScroll(view *gocui.View, str string, originX int, originY int) error {
manager := gui.getManager(view)
f := func(stop chan struct{}) error {
f := func(tasks.TaskOpts) error {
gui.c.SetViewContent(view, str)
_ = view.SetOrigin(originX, originY)
return nil
@@ -81,7 +81,7 @@ func (gui *Gui) newStringTaskWithScroll(view *gocui.View, str string, originX in
func (gui *Gui) newStringTaskWithKey(view *gocui.View, str string, key string) error {
manager := gui.getManager(view)
f := func(stop chan struct{}) error {
f := func(tasks.TaskOpts) error {
gui.c.ResetViewOrigin(view)
gui.c.SetViewContent(view, str)
return nil
@@ -130,6 +130,8 @@ func (gui *Gui) getManager(view *gocui.View) *tasks.ViewBufferManager {
func() {
_ = view.SetOrigin(0, 0)
},
gui.c.GocuiGui().IncrementBusyCount,
gui.c.GocuiGui().DecrementBusyCount,
)
gui.viewBufferManagerMap[view.Name()] = manager
}