52 lines
1.7 KiB
Go
52 lines
1.7 KiB
Go
//go:build !nogui
|
|
|
|
package gui
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/wailsapp/wails/v3/pkg/application"
|
|
)
|
|
|
|
// StringKe on Discord: magpie restarted for an update while another app was
|
|
// full screen, and from then on its window opened only on that app's Space.
|
|
// The window moves to the Space the user is on when shown, and can still go
|
|
// full screen; it doesn't join every Space.
|
|
func TestMainWindowFollowsActiveSpace(t *testing.T) {
|
|
m := mainMacWindow()
|
|
b := m.CollectionBehavior
|
|
if b&application.MacWindowCollectionBehaviorMoveToActiveSpace == 0 {
|
|
t.Errorf("main window collection behaviour %d does not move to the active Space", b)
|
|
}
|
|
if b&application.MacWindowCollectionBehaviorFullScreenPrimary == 0 {
|
|
t.Errorf("main window collection behaviour %d can no longer go full screen", b)
|
|
}
|
|
if b&(application.MacWindowCollectionBehaviorCanJoinAllSpaces|application.MacWindowCollectionBehaviorFullScreenAuxiliary) != 0 {
|
|
t.Errorf("main window collection behaviour %d joins all Spaces or full-screen ones", b)
|
|
}
|
|
if m.TitleBar != application.MacTitleBarHiddenInset {
|
|
t.Errorf("main window title bar changed: %+v", m.TitleBar)
|
|
}
|
|
}
|
|
|
|
// StringKe on Discord: a full-screen window closed left a black Space
|
|
// behind. On the Mac it leaves full screen before it is hidden.
|
|
func TestCloseStepLeavesFullscreen(t *testing.T) {
|
|
cases := []struct {
|
|
goos string
|
|
fullscreen bool
|
|
want closeAction
|
|
}{
|
|
{"darwin", true, closeLeaveFullscreen},
|
|
{"darwin", false, closeHide},
|
|
{"windows", true, closeHide},
|
|
{"linux", true, closeHide},
|
|
{"linux", false, closeHide},
|
|
}
|
|
for _, c := range cases {
|
|
if got := closeStep(c.goos, c.fullscreen); got != c.want {
|
|
t.Errorf("closeStep(%s, fullscreen=%v) = %v, want %v", c.goos, c.fullscreen, got, c.want)
|
|
}
|
|
}
|
|
}
|