Skip to content

Commit

Permalink
Clarify thread handling of specific window tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Dec 17, 2024
1 parent d64b90a commit 415f57e
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions internal/driver/glfw/window_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()
})
Expand Down

0 comments on commit 415f57e

Please sign in to comment.