MCPcopy
hub / github.com/EngoEngine/engo / TestOverrideCloseAction

Function TestOverrideCloseAction

engo_test.go:224–246  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

222}
223
224func TestOverrideCloseAction(t *testing.T) {
225 var buf bytes.Buffer
226 log.SetOutput(&buf)
227 expected := "[WARNING] default close action set to false, please make sure you manually handle this\n"
228
229 testChan := make(chan struct{})
230 go func() {
231 Run(RunOptions{
232 HeadlessMode: true,
233 OverrideCloseAction: true,
234 }, &testRunScene{1})
235 testChan <- struct{}{}
236 }()
237 select {
238 case <-testChan:
239 case <-time.After(1 * time.Second):
240 t.Error("Timed out while waiting for Headless Run to return from loop. Exit wasn't called within 1 second.")
241 }
242
243 if !strings.HasSuffix(buf.String(), expected) {
244 t.Errorf("calling closeEvent with Override set did not write expected output to log. Wanted: %v, got: %v", expected, buf.String())
245 }
246}
247
248func TestSetGlobalScale(t *testing.T) {
249 data := []struct {

Callers

nothing calls this directly

Calls 2

RunFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected