| 222 | } |
| 223 | |
| 224 | func 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 | |
| 248 | func TestSetGlobalScale(t *testing.T) { |
| 249 | data := []struct { |