mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
cmd/gogio: start using testing.T.Cleanup
Now that we use tip due to breaking changes in Go's JS APIs, let's replace our hacky cleanup list code with 1.14's upcoming testing.T.Cleanup. Adding more deliberate uses of tip would ususally be best avoided, but these will only affect developers working on gio's tests, not regular users of gio. While at it, remove some debug t.Logf calls I forgot to remove. Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
This commit is contained in:
@@ -24,11 +24,7 @@ type TestDriver interface {
|
||||
//
|
||||
// When the function returns, the gio app must be ready to use on the
|
||||
// platform, with its initial frame fully drawn.
|
||||
//
|
||||
// The returned cleanup funcs must be run in reverse order, to mimic
|
||||
// deferred funcs.
|
||||
// TODO(mvdan): replace with testing.T.Cleanup once Go 1.14 is out.
|
||||
Start(t *testing.T, path string, width, height int) (cleanups []func())
|
||||
Start(t *testing.T, path string, width, height int)
|
||||
|
||||
// Screenshot takes a screenshot of the Gio app on the platform.
|
||||
Screenshot() image.Image
|
||||
@@ -67,10 +63,7 @@ func TestEndToEnd(t *testing.T) {
|
||||
|
||||
func runEndToEndTest(t *testing.T, driver TestDriver) {
|
||||
size := image.Point{X: 800, Y: 600}
|
||||
cleanups := driver.Start(t, "testdata/red.go", size.X, size.Y)
|
||||
for _, cleanup := range cleanups {
|
||||
defer cleanup()
|
||||
}
|
||||
driver.Start(t, "testdata/red.go", size.X, size.Y)
|
||||
|
||||
// The colors are split in four rectangular sections. Check the corners
|
||||
// of each of the sections. We check the corners left to right, top to
|
||||
|
||||
Reference in New Issue
Block a user