MCPcopy Create free account
hub / github.com/cogentcore/core / AssertRenderScreen

Method AssertRenderScreen

core/testing.go:42–55  ·  view source on GitHub ↗

AssertRenderScreen is the same as [Body.AssertRender] except that it asserts the rendered image of the entire screen, not just this body. It should be used for multi-scene tests like those of snackbars and dialogs.

(t imagex.TestingT, filename string, fun ...func())

Source from the content-addressed store, hash-verified

40// rendered image of the entire screen, not just this body. It should be used for
41// multi-scene tests like those of snackbars and dialogs.
42func (b *Body) AssertRenderScreen(t imagex.TestingT, filename string, fun ...func()) {
43 b.runAndShowNewWindow()
44 for i := 0; i < len(fun); i++ {
45 fun[i]()
46 b.waitNoEvents()
47 }
48 if len(fun) == 0 {
49 // we didn't get it above
50 b.waitNoEvents()
51 }
52
53 system.AssertCapture(t, filename)
54 b.Close()
55}
56
57// runAndShowNewWindow runs a new window and waits for it to be shown.
58func (b *Body) runAndShowNewWindow() {

Callers 14

TestCallFuncArgsFunction · 0.95
TestChooserClickFunction · 0.95
TestChooserEditableClickFunction · 0.95
TestChooserAllowNewClickFunction · 0.95
TestSnackbarTimeFunction · 0.95
TestButtonMenuClickFunction · 0.95
TestDialogMessageFunction · 0.95
TestSnackbarCustomFunction · 0.80

Calls 4

runAndShowNewWindowMethod · 0.95
waitNoEventsMethod · 0.95
CloseMethod · 0.95
AssertCaptureFunction · 0.92

Tested by 14

TestCallFuncArgsFunction · 0.76
TestChooserClickFunction · 0.76
TestChooserEditableClickFunction · 0.76
TestChooserAllowNewClickFunction · 0.76
TestSnackbarTimeFunction · 0.76
TestButtonMenuClickFunction · 0.76
TestDialogMessageFunction · 0.76
TestSnackbarCustomFunction · 0.64