AssertRender makes a new window from the body, waits until it is shown and all events have been handled, does any necessary re-rendering, asserts that its rendered image is the same as that stored at the given filename, saving the image to that filename if it does not already exist, and then closes
(t imagex.TestingT, filename string, fun ...func())
| 22 | // backslashes on Windows. See [Body.AssertRenderScreen] for a version |
| 23 | // that asserts the rendered image of the entire screen, not just this body. |
| 24 | func (b *Body) AssertRender(t imagex.TestingT, filename string, fun ...func()) { |
| 25 | b.runAndShowNewWindow() |
| 26 | for i := 0; i < len(fun); i++ { |
| 27 | fun[i]() |
| 28 | b.waitNoEvents() |
| 29 | } |
| 30 | if len(fun) == 0 { |
| 31 | // we didn't get it above |
| 32 | b.waitNoEvents() |
| 33 | } |
| 34 | |
| 35 | b.Scene.assertPixels(t, filename) |
| 36 | b.Close() |
| 37 | } |
| 38 | |
| 39 | // AssertRenderScreen is the same as [Body.AssertRender] except that it asserts the |
| 40 | // rendered image of the entire screen, not just this body. It should be used for |