From 415f57eae5706af685dbc2ae78823656403544e2 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 17 Dec 2024 20:02:02 +0000 Subject: [PATCH] Clarify thread handling of specific window tests --- internal/driver/glfw/window_test.go | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/internal/driver/glfw/window_test.go b/internal/driver/glfw/window_test.go index 8f543d14a8..de364386ef 100644 --- a/internal/driver/glfw/window_test.go +++ b/internal/driver/glfw/window_test.go @@ -68,7 +68,10 @@ func TestGLDriver_CreateWindow_EmptyTitle(t *testing.T) { } func TestGLDriver_CreateSplashWindow(t *testing.T) { - w := createSplashWindow().(*window) + var w *window + runOnMain(func() { // tests launch in a different context + w = d.CreateSplashWindow().(*window) + }) w.create() // Verify that the glfw driver implements desktop.Driver. @@ -1641,7 +1644,10 @@ func TestWindow_SetContent_Twice(t *testing.T) { } func TestWindow_SetFullScreen(t *testing.T) { - w := d.CreateWindow("Full").(*window) + var w *window + runOnMain(func() { // tests launch in a different context + w = d.CreateWindow("Full").(*window) + }) w.SetFullScreen(true) w.create() @@ -1676,18 +1682,9 @@ func TestWindow_SetFullScreen(t *testing.T) { // assert.True(t, w.FullScreen()) // } -func createSplashWindow() fyne.Window { - var w fyne.Window - runOnMain(func() { - w = d.CreateSplashWindow() - w.(*window).create() - }) - return w -} - func createWindow(title string) fyne.Window { var w fyne.Window - runOnMain(func() { + runOnMain(func() { // tests launch in a different context w = d.CreateWindow(title) w.(*window).create() })