[PATCH gio] cmd/gogio: test gogio using go import path
Export this patch
From: Walter Werner SCHNEIDER <contact@schnwalter.eu>
---
cmd/gogio/e2e_test.go | 24 +++++++++++++---------
cmd/gogio/testdata/{red.go => testdata.go} | 0
2 files changed, 14 insertions(+), 10 deletions(-)
rename cmd/gogio/testdata/{red.go => testdata.go} (100%)
diff --git a/cmd/gogio/e2e_test.go b/cmd/gogio/e2e_test.go
index 346d000..63cdc29 100644
--- a/cmd/gogio/e2e_test.go
+++ b/cmd/gogio/e2e_test.go
@@ -23,6 +23,8 @@ var raceEnabled = false
var headless = flag.Bool("headless", true, "run end-to-end tests in headless mode")
const appid = "localhost.gogio.endtoend"
+const testdataWithGoImportPkgPath = "gioui.org/cmd/gogio/testdata"
+const testdataWithRelativePkgPath = "testdata/testdata.go"
// TestDriver is implemented by each of the platforms we can run end-to-end
// tests on. None of its methods return any errors, as the errors are directly
@@ -70,31 +72,33 @@ func TestEndToEnd(t *testing.T) {
// Keep this list local, to not reuse TestDriver objects.
subtests := []struct {
- name string
- driver TestDriver
+ name string
+ driver TestDriver
+ pkgPath string
}{
- {"X11", &X11TestDriver{}},
- {"Wayland", &WaylandTestDriver{}},
- {"JS", &JSTestDriver{}},
- {"Android", &AndroidTestDriver{}},
- {"Windows", &WineTestDriver{}},
+ {"X11 using go import path", &X11TestDriver{}, testdataWithGoImportPkgPath},
+ {"X11", &X11TestDriver{}, testdataWithRelativePkgPath},
+ {"Wayland", &WaylandTestDriver{}, testdataWithRelativePkgPath},
+ {"JS", &JSTestDriver{}, testdataWithRelativePkgPath},
+ {"Android", &AndroidTestDriver{}, testdataWithRelativePkgPath},
+ {"Windows", &WineTestDriver{}, testdataWithRelativePkgPath},
}
for _, subtest := range subtests {
t.Run(subtest.name, func(t *testing.T) {
subtest := subtest // copy the changing loop variable
t.Parallel()
- runEndToEndTest(t, subtest.driver)
+ runEndToEndTest(t, subtest.driver, subtest.pkgPath)
})
}
}
-func runEndToEndTest(t *testing.T, driver TestDriver) {
+func runEndToEndTest(t *testing.T, driver TestDriver, pkgPath string) {
size := image.Point{X: 800, Y: 600}
driver.initBase(t, size.X, size.Y)
t.Log("starting driver and gio app")
- driver.Start("testdata/red.go")
+ driver.Start(pkgPath)
beef := color.NRGBA{R: 0xde, G: 0xad, B: 0xbe, A: 0xff}
white := color.NRGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff}
diff --git a/cmd/gogio/testdata/red.go b/cmd/gogio/testdata/testdata.go
similarity index 100%
rename from cmd/gogio/testdata/red.go
rename to cmd/gogio/testdata/testdata.go
--
2.26.2