(t *testing.T)
| 265 | } |
| 266 | |
| 267 | func TestSceneSwitching(t *testing.T) { |
| 268 | RegisterScene(&testScene2{}) |
| 269 | var buf bytes.Buffer |
| 270 | log.SetOutput(&buf) |
| 271 | Run(RunOptions{ |
| 272 | NoRun: true, |
| 273 | HeadlessMode: true, |
| 274 | }, &testScene{}) |
| 275 | SetSceneByName("testScene2", false) |
| 276 | if CurrentScene().Type() != "testScene2" { |
| 277 | t.Errorf("CurrentScene got wrong scene. was: %v, expected: %v", CurrentScene().Type(), "testScene2") |
| 278 | } |
| 279 | SetSceneByName("testScene", false) |
| 280 | expected := "Hiding testScene2.\n" |
| 281 | if !strings.HasSuffix(buf.String(), expected) { |
| 282 | t.Errorf("Did not properly set testScene1 and hide testScene2. was %v, expected: %v", buf.String(), expected) |
| 283 | } |
| 284 | buf.Reset() |
| 285 | SetSceneByName("testScene2", false) |
| 286 | expected = "Showing testScene2.\n" |
| 287 | if !strings.HasSuffix(buf.String(), expected) { |
| 288 | t.Errorf("Did not properly set and show testScene2. was: %v, expected: %v", buf.String(), expected) |
| 289 | } |
| 290 | err := SetSceneByName("doesNotExistScene", true) |
| 291 | if err == nil { |
| 292 | t.Error("No error when setting scene that doesn't exist.") |
| 293 | } |
| 294 | expected = "scene not registered:" |
| 295 | if !strings.HasPrefix(err.Error(), expected) { |
| 296 | t.Errorf("Did not recieve correct error for setting a scene that doesn't exist. was: %v, expected:%v", err.Error(), expected) |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | func TestUtils(t *testing.T) { |
| 301 | var buf bytes.Buffer |
nothing calls this directly
no test coverage detected