Skip to content

Commit

Permalink
test: Empty draw channel after every DoEvent() and before resizing th…
Browse files Browse the repository at this point in the history
…e screen

This is necessary since DoEvent() isn't called in a loop like in the main
application, but as one-shot only.
  • Loading branch information
JoeKar committed Sep 22, 2023
1 parent 20fdb1a commit 9dae276
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/micro/micro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ func startup(args []string) (tcell.SimulationScreen, error) {
return nil, err
}

for len(screen.DrawChan()) > 0 {
<-screen.DrawChan()
}

s.InjectResize()
handleEvent()

Expand All @@ -107,7 +111,12 @@ func handleEvent() {
if e != nil {
screen.Events <- e
}

DoEvent()

for len(screen.DrawChan()) > 0 {
<-screen.DrawChan()
}
}

func injectKey(key tcell.Key, r rune, mod tcell.ModMask) {
Expand Down

0 comments on commit 9dae276

Please sign in to comment.