From 9dae276584ebde812c4bd72d7fd74eec93f0e142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6ran=20Karl?= <3951388+JoeKar@users.noreply.github.com> Date: Fri, 22 Sep 2023 19:28:10 +0200 Subject: [PATCH] test: Empty draw channel after every DoEvent() and before resizing the screen This is necessary since DoEvent() isn't called in a loop like in the main application, but as one-shot only. --- cmd/micro/micro_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/micro/micro_test.go b/cmd/micro/micro_test.go index ba5c9a24b8..b0a9abad84 100644 --- a/cmd/micro/micro_test.go +++ b/cmd/micro/micro_test.go @@ -90,6 +90,10 @@ func startup(args []string) (tcell.SimulationScreen, error) { return nil, err } + for len(screen.DrawChan()) > 0 { + <-screen.DrawChan() + } + s.InjectResize() handleEvent() @@ -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) {