mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 01:45:36 +00:00
cmd/gogio: add gogio test for go import path
Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
This commit is contained in:
committed by
Elias Naur
parent
9b54892cc4
commit
4f8150cd59
+16
-10
@@ -68,33 +68,39 @@ func TestEndToEnd(t *testing.T) {
|
|||||||
|
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
const (
|
||||||
|
testdataWithGoImportPkgPath = "gioui.org/cmd/gogio/testdata"
|
||||||
|
testdataWithRelativePkgPath = "testdata/testdata.go"
|
||||||
|
)
|
||||||
// Keep this list local, to not reuse TestDriver objects.
|
// Keep this list local, to not reuse TestDriver objects.
|
||||||
subtests := []struct {
|
subtests := []struct {
|
||||||
name string
|
name string
|
||||||
driver TestDriver
|
driver TestDriver
|
||||||
|
pkgPath string
|
||||||
}{
|
}{
|
||||||
{"X11", &X11TestDriver{}},
|
{"X11 using go import path", &X11TestDriver{}, testdataWithGoImportPkgPath},
|
||||||
{"Wayland", &WaylandTestDriver{}},
|
{"X11", &X11TestDriver{}, testdataWithRelativePkgPath},
|
||||||
{"JS", &JSTestDriver{}},
|
{"Wayland", &WaylandTestDriver{}, testdataWithRelativePkgPath},
|
||||||
{"Android", &AndroidTestDriver{}},
|
{"JS", &JSTestDriver{}, testdataWithRelativePkgPath},
|
||||||
{"Windows", &WineTestDriver{}},
|
{"Android", &AndroidTestDriver{}, testdataWithRelativePkgPath},
|
||||||
|
{"Windows", &WineTestDriver{}, testdataWithRelativePkgPath},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, subtest := range subtests {
|
for _, subtest := range subtests {
|
||||||
t.Run(subtest.name, func(t *testing.T) {
|
t.Run(subtest.name, func(t *testing.T) {
|
||||||
subtest := subtest // copy the changing loop variable
|
subtest := subtest // copy the changing loop variable
|
||||||
t.Parallel()
|
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}
|
size := image.Point{X: 800, Y: 600}
|
||||||
driver.initBase(t, size.X, size.Y)
|
driver.initBase(t, size.X, size.Y)
|
||||||
|
|
||||||
t.Log("starting driver and gio app")
|
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}
|
beef := color.NRGBA{R: 0xde, G: 0xad, B: 0xbe, A: 0xff}
|
||||||
white := color.NRGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff}
|
white := color.NRGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff}
|
||||||
|
|||||||
Reference in New Issue
Block a user