test(ui): skip gtk window tests without display
- commit
- dccb0ab13030ef8150047d731cf8924a88eb9585
- author
- brice · · 2026-04-16 03:30 UTC
- parent
- 802dc32
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +60 -48
M internal/ui/app_browser_launch_test.go +60 -48
| @@ -3,7 +3,10 @@ package ui | |||
| 3 | 3 | import ( | |
| 4 | 4 | "context" | |
| 5 | 5 | "io" | |
| 6 | + | "os" | |
| 7 | + | "path/filepath" | |
| 6 | 8 | "reflect" | |
| 9 | + | "strings" | |
| 7 | 10 | "testing" | |
| 8 | 11 | "unsafe" | |
| 9 | 12 | ||
| @@ -21,6 +24,7 @@ import ( | |||
| 21 | 24 | "github.com/bnema/dumber/internal/ui/layout" | |
| 22 | 25 | layoutmocks "github.com/bnema/dumber/internal/ui/layout/mocks" | |
| 23 | 26 | "github.com/bnema/dumber/internal/ui/window" | |
| 27 | + | "github.com/bnema/puregotk/v4/gdk" | |
| 24 | 28 | "github.com/bnema/puregotk/v4/gio" | |
| 25 | 29 | "github.com/bnema/puregotk/v4/gtk" | |
| 26 | 30 | ) | |
| @@ -69,6 +73,54 @@ func (r *fakeSessionStateRepo) GetAllSnapshots(context.Context) ([]*entity.Sessi | |||
| 69 | 73 | ||
| 70 | 74 | func (r *fakeSessionStateRepo) GetTotalSnapshotsSize(context.Context) (int64, error) { return 0, nil } | |
| 71 | 75 | ||
| 76 | + | func testHasUsableGTKDisplay() bool { | |
| 77 | + | if waylandDisplay := os.Getenv("WAYLAND_DISPLAY"); waylandDisplay != "" { | |
| 78 | + | candidates := []string{waylandDisplay} | |
| 79 | + | if runtimeDir := os.Getenv("XDG_RUNTIME_DIR"); runtimeDir != "" && !filepath.IsAbs(waylandDisplay) { | |
| 80 | + | candidates = append([]string{filepath.Join(runtimeDir, waylandDisplay)}, candidates...) | |
| 81 | + | } | |
| 82 | + | for _, candidate := range candidates { | |
| 83 | + | if _, err := os.Stat(candidate); err == nil { | |
| 84 | + | return true | |
| 85 | + | } | |
| 86 | + | } | |
| 87 | + | } | |
| 88 | + | ||
| 89 | + | if display := os.Getenv("DISPLAY"); display != "" { | |
| 90 | + | if strings.HasPrefix(display, ":") { | |
| 91 | + | displayNum := strings.TrimPrefix(display, ":") | |
| 92 | + | displayNum = strings.SplitN(displayNum, ".", 2)[0] | |
| 93 | + | if displayNum == "" { | |
| 94 | + | return false | |
| 95 | + | } | |
| 96 | + | if _, err := os.Stat(filepath.Join("/tmp/.X11-unix", "X"+displayNum)); err == nil { | |
| 97 | + | return true | |
| 98 | + | } | |
| 99 | + | return false | |
| 100 | + | } | |
| 101 | + | return true | |
| 102 | + | } | |
| 103 | + | ||
| 104 | + | return false | |
| 105 | + | } | |
| 106 | + | ||
| 107 | + | func requireGTKDisplayApp(t *testing.T) *gtk.Application { | |
| 108 | + | t.Helper() | |
| 109 | + | if !testHasUsableGTKDisplay() { | |
| 110 | + | t.Skip("GTK display not available") | |
| 111 | + | } | |
| 112 | + | EnsureAdwaitaInitialized() | |
| 113 | + | if gdk.DisplayGetDefault() == nil { | |
| 114 | + | t.Skip("GTK display not available") | |
| 115 | + | } | |
| 116 | + | appID := AppID | |
| 117 | + | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |
| 118 | + | if gtkApp == nil { | |
| 119 | + | t.Fatal("gtk application creation failed") | |
| 120 | + | } | |
| 121 | + | return gtkApp | |
| 122 | + | } | |
| 123 | + | ||
| 72 | 124 | // setDependencyField uses reflection to reach unexported dependency fields for tests. | |
| 73 | 125 | // Keep this test-only so production visibility stays narrow. | |
| 74 | 126 | func setDependencyField(t *testing.T, deps *Dependencies, field string, value any) { | |
| @@ -283,12 +335,7 @@ func TestApp_OpenFreshWindowRecordsTabOwnership(t *testing.T) { | |||
| 283 | 335 | } | |
| 284 | 336 | ||
| 285 | 337 | func TestApp_RestoreSessionClearsStaleUIStateBeforeApplyingRestoredTabs(t *testing.T) { | |
| 286 | - | EnsureAdwaitaInitialized() | |
| 287 | - | appID := AppID | |
| 288 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |
| 289 | - | if gtkApp == nil { | |
| 290 | - | t.Fatal("gtk application creation failed") | |
| 291 | - | } | |
| 338 | + | gtkApp := requireGTKDisplayApp(t) | |
| 292 | 339 | defer gtkApp.Unref() | |
| 293 | 340 | ||
| 294 | 341 | mainWindow, err := window.New(context.Background(), gtkApp, "top") | |
| @@ -344,12 +391,7 @@ func TestApp_RestoreSessionClearsStaleUIStateBeforeApplyingRestoredTabs(t *testi | |||
| 344 | 391 | } | |
| 345 | 392 | ||
| 346 | 393 | func TestApp_RestoreSessionWiresStackedPaneTitleBarCallbacks(t *testing.T) { | |
| 347 | - | EnsureAdwaitaInitialized() | |
| 348 | - | appID := AppID | |
| 349 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |
| 350 | - | if gtkApp == nil { | |
| 351 | - | t.Fatal("gtk application creation failed") | |
| 352 | - | } | |
| 394 | + | gtkApp := requireGTKDisplayApp(t) | |
| 353 | 395 | defer gtkApp.Unref() | |
| 354 | 396 | ||
| 355 | 397 | mainWindow, err := window.New(context.Background(), gtkApp, "top") | |
| @@ -613,12 +655,7 @@ func TestApp_OwnerOrLastFocusedBrowserWindowPrefersPaneOwner(t *testing.T) { | |||
| 613 | 655 | } | |
| 614 | 656 | ||
| 615 | 657 | func TestApp_HandlePaneWindowTitleChangedTargetsOwningWindow(t *testing.T) { | |
| 616 | - | EnsureAdwaitaInitialized() | |
| 617 | - | appID := AppID | |
| 618 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |
| 619 | - | if gtkApp == nil { | |
| 620 | - | t.Fatal("gtk application creation failed") | |
| 621 | - | } | |
| 658 | + | gtkApp := requireGTKDisplayApp(t) | |
| 622 | 659 | defer gtkApp.Unref() | |
| 623 | 660 | ||
| 624 | 661 | firstMainWindow, err := window.New(context.Background(), gtkApp, "top") | |
| @@ -657,12 +694,7 @@ func TestApp_HandlePaneWindowTitleChangedTargetsOwningWindow(t *testing.T) { | |||
| 657 | 694 | } | |
| 658 | 695 | ||
| 659 | 696 | func TestApp_ActivateBrowserWindowResyncsTitleFromBackgroundPane(t *testing.T) { | |
| 660 | - | EnsureAdwaitaInitialized() | |
| 661 | - | appID := AppID | |
| 662 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |
| 663 | - | if gtkApp == nil { | |
| 664 | - | t.Fatal("gtk application creation failed") | |
| 665 | - | } | |
| 697 | + | gtkApp := requireGTKDisplayApp(t) | |
| 666 | 698 | defer gtkApp.Unref() | |
| 667 | 699 | ||
| 668 | 700 | firstMainWindow, err := window.New(context.Background(), gtkApp, "top") | |
| @@ -707,12 +739,7 @@ func TestApp_ActivateBrowserWindowResyncsTitleFromBackgroundPane(t *testing.T) { | |||
| 707 | 739 | } | |
| 708 | 740 | ||
| 709 | 741 | func TestApp_HandlePaneFullscreenChangedTargetsOwningWindow(t *testing.T) { | |
| 710 | - | EnsureAdwaitaInitialized() | |
| 711 | - | appID := AppID | |
| 712 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |
| 713 | - | if gtkApp == nil { | |
| 714 | - | t.Fatal("gtk application creation failed") | |
| 715 | - | } | |
| 742 | + | gtkApp := requireGTKDisplayApp(t) | |
| 716 | 743 | defer gtkApp.Unref() | |
| 717 | 744 | ||
| 718 | 745 | firstMainWindow, err := window.New(context.Background(), gtkApp, "top") | |
| @@ -759,12 +786,7 @@ func TestApp_HandlePaneFullscreenChangedTargetsOwningWindow(t *testing.T) { | |||
| 759 | 786 | } | |
| 760 | 787 | ||
| 761 | 788 | func TestApp_HandlePaneFullscreenChangedIgnoresUnresolvedPane(t *testing.T) { | |
| 762 | - | EnsureAdwaitaInitialized() | |
| 763 | - | appID := AppID | |
| 764 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |
| 765 | - | if gtkApp == nil { | |
| 766 | - | t.Fatal("gtk application creation failed") | |
| 767 | - | } | |
| 789 | + | gtkApp := requireGTKDisplayApp(t) | |
| 768 | 790 | defer gtkApp.Unref() | |
| 769 | 791 | ||
| 770 | 792 | firstMainWindow, err := window.New(context.Background(), gtkApp, "top") | |
| @@ -881,12 +903,7 @@ func TestApp_MoveActivePaneToTabFromBrowserWindowActivatesTargetOwnerForCrossWin | |||
| 881 | 903 | } | |
| 882 | 904 | ||
| 883 | 905 | func TestApp_InitKeyboardHandlerDoesNotReattachExistingWindowInput(t *testing.T) { | |
| 884 | - | EnsureAdwaitaInitialized() | |
| 885 | - | appID := AppID | |
| 886 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |
| 887 | - | if gtkApp == nil { | |
| 888 | - | t.Fatal("gtk application creation failed") | |
| 889 | - | } | |
| 906 | + | gtkApp := requireGTKDisplayApp(t) | |
| 890 | 907 | defer gtkApp.Unref() | |
| 891 | 908 | ||
| 892 | 909 | mainWindow, err := window.New(context.Background(), gtkApp, "top") | |
| @@ -946,12 +963,7 @@ func (*testFocusedInputProvider) GetFocusedInput() port.TextInputTarget { return | |||
| 946 | 963 | func (*testFocusedInputProvider) SetFocusedInput(port.TextInputTarget) {} | |
| 947 | 964 | ||
| 948 | 965 | func TestApp_UpdateBrowserWindowTabBarVisibilityHonorsHideWhenSingleTabDisabled(t *testing.T) { | |
| 949 | - | EnsureAdwaitaInitialized() | |
| 950 | - | appID := AppID | |
| 951 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |
| 952 | - | if gtkApp == nil { | |
| 953 | - | t.Fatal("gtk application creation failed") | |
| 954 | - | } | |
| 966 | + | gtkApp := requireGTKDisplayApp(t) | |
| 955 | 967 | defer gtkApp.Unref() | |
| 956 | 968 | ||
| 957 | 969 | mainWindow := &window.MainWindow{} | |
| @@ -3,7 +3,10 @@ package ui | |||||
| 3 | import ( | 3 | import ( | ||
| 4 | "context" | 4 | "context" | ||
| 5 | "io" | 5 | "io" | ||
| 6 | + | "os" | |||
| 7 | + | "path/filepath" | |||
| 6 | "reflect" | 8 | "reflect" | ||
| 9 | + | "strings" | |||
| 7 | "testing" | 10 | "testing" | ||
| 8 | "unsafe" | 11 | "unsafe" | ||
| 9 | 12 | ||||
| @@ -21,6 +24,7 @@ import ( | |||||
| 21 | "github.com/bnema/dumber/internal/ui/layout" | 24 | "github.com/bnema/dumber/internal/ui/layout" | ||
| 22 | layoutmocks "github.com/bnema/dumber/internal/ui/layout/mocks" | 25 | layoutmocks "github.com/bnema/dumber/internal/ui/layout/mocks" | ||
| 23 | "github.com/bnema/dumber/internal/ui/window" | 26 | "github.com/bnema/dumber/internal/ui/window" | ||
| 27 | + | "github.com/bnema/puregotk/v4/gdk" | |||
| 24 | "github.com/bnema/puregotk/v4/gio" | 28 | "github.com/bnema/puregotk/v4/gio" | ||
| 25 | "github.com/bnema/puregotk/v4/gtk" | 29 | "github.com/bnema/puregotk/v4/gtk" | ||
| 26 | ) | 30 | ) | ||
| @@ -69,6 +73,54 @@ func (r *fakeSessionStateRepo) GetAllSnapshots(context.Context) ([]*entity.Sessi | |||||
| 69 | 73 | ||||
| 70 | func (r *fakeSessionStateRepo) GetTotalSnapshotsSize(context.Context) (int64, error) { return 0, nil } | 74 | func (r *fakeSessionStateRepo) GetTotalSnapshotsSize(context.Context) (int64, error) { return 0, nil } | ||
| 71 | 75 | ||||
| 76 | + | func testHasUsableGTKDisplay() bool { | |||
| 77 | + | if waylandDisplay := os.Getenv("WAYLAND_DISPLAY"); waylandDisplay != "" { | |||
| 78 | + | candidates := []string{waylandDisplay} | |||
| 79 | + | if runtimeDir := os.Getenv("XDG_RUNTIME_DIR"); runtimeDir != "" && !filepath.IsAbs(waylandDisplay) { | |||
| 80 | + | candidates = append([]string{filepath.Join(runtimeDir, waylandDisplay)}, candidates...) | |||
| 81 | + | } | |||
| 82 | + | for _, candidate := range candidates { | |||
| 83 | + | if _, err := os.Stat(candidate); err == nil { | |||
| 84 | + | return true | |||
| 85 | + | } | |||
| 86 | + | } | |||
| 87 | + | } | |||
| 88 | + | ||||
| 89 | + | if display := os.Getenv("DISPLAY"); display != "" { | |||
| 90 | + | if strings.HasPrefix(display, ":") { | |||
| 91 | + | displayNum := strings.TrimPrefix(display, ":") | |||
| 92 | + | displayNum = strings.SplitN(displayNum, ".", 2)[0] | |||
| 93 | + | if displayNum == "" { | |||
| 94 | + | return false | |||
| 95 | + | } | |||
| 96 | + | if _, err := os.Stat(filepath.Join("/tmp/.X11-unix", "X"+displayNum)); err == nil { | |||
| 97 | + | return true | |||
| 98 | + | } | |||
| 99 | + | return false | |||
| 100 | + | } | |||
| 101 | + | return true | |||
| 102 | + | } | |||
| 103 | + | ||||
| 104 | + | return false | |||
| 105 | + | } | |||
| 106 | + | ||||
| 107 | + | func requireGTKDisplayApp(t *testing.T) *gtk.Application { | |||
| 108 | + | t.Helper() | |||
| 109 | + | if !testHasUsableGTKDisplay() { | |||
| 110 | + | t.Skip("GTK display not available") | |||
| 111 | + | } | |||
| 112 | + | EnsureAdwaitaInitialized() | |||
| 113 | + | if gdk.DisplayGetDefault() == nil { | |||
| 114 | + | t.Skip("GTK display not available") | |||
| 115 | + | } | |||
| 116 | + | appID := AppID | |||
| 117 | + | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |||
| 118 | + | if gtkApp == nil { | |||
| 119 | + | t.Fatal("gtk application creation failed") | |||
| 120 | + | } | |||
| 121 | + | return gtkApp | |||
| 122 | + | } | |||
| 123 | + | ||||
| 72 | // setDependencyField uses reflection to reach unexported dependency fields for tests. | 124 | // setDependencyField uses reflection to reach unexported dependency fields for tests. | ||
| 73 | // Keep this test-only so production visibility stays narrow. | 125 | // Keep this test-only so production visibility stays narrow. | ||
| 74 | func setDependencyField(t *testing.T, deps *Dependencies, field string, value any) { | 126 | func setDependencyField(t *testing.T, deps *Dependencies, field string, value any) { | ||
| @@ -283,12 +335,7 @@ func TestApp_OpenFreshWindowRecordsTabOwnership(t *testing.T) { | |||||
| 283 | } | 335 | } | ||
| 284 | 336 | ||||
| 285 | func TestApp_RestoreSessionClearsStaleUIStateBeforeApplyingRestoredTabs(t *testing.T) { | 337 | func TestApp_RestoreSessionClearsStaleUIStateBeforeApplyingRestoredTabs(t *testing.T) { | ||
| 286 | - | EnsureAdwaitaInitialized() | 338 | + | gtkApp := requireGTKDisplayApp(t) |
| 287 | - | appID := AppID | |||
| 288 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |||
| 289 | - | if gtkApp == nil { | |||
| 290 | - | t.Fatal("gtk application creation failed") | |||
| 291 | - | } | |||
| 292 | defer gtkApp.Unref() | 339 | defer gtkApp.Unref() | ||
| 293 | 340 | ||||
| 294 | mainWindow, err := window.New(context.Background(), gtkApp, "top") | 341 | mainWindow, err := window.New(context.Background(), gtkApp, "top") | ||
| @@ -344,12 +391,7 @@ func TestApp_RestoreSessionClearsStaleUIStateBeforeApplyingRestoredTabs(t *testi | |||||
| 344 | } | 391 | } | ||
| 345 | 392 | ||||
| 346 | func TestApp_RestoreSessionWiresStackedPaneTitleBarCallbacks(t *testing.T) { | 393 | func TestApp_RestoreSessionWiresStackedPaneTitleBarCallbacks(t *testing.T) { | ||
| 347 | - | EnsureAdwaitaInitialized() | 394 | + | gtkApp := requireGTKDisplayApp(t) |
| 348 | - | appID := AppID | |||
| 349 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |||
| 350 | - | if gtkApp == nil { | |||
| 351 | - | t.Fatal("gtk application creation failed") | |||
| 352 | - | } | |||
| 353 | defer gtkApp.Unref() | 395 | defer gtkApp.Unref() | ||
| 354 | 396 | ||||
| 355 | mainWindow, err := window.New(context.Background(), gtkApp, "top") | 397 | mainWindow, err := window.New(context.Background(), gtkApp, "top") | ||
| @@ -613,12 +655,7 @@ func TestApp_OwnerOrLastFocusedBrowserWindowPrefersPaneOwner(t *testing.T) { | |||||
| 613 | } | 655 | } | ||
| 614 | 656 | ||||
| 615 | func TestApp_HandlePaneWindowTitleChangedTargetsOwningWindow(t *testing.T) { | 657 | func TestApp_HandlePaneWindowTitleChangedTargetsOwningWindow(t *testing.T) { | ||
| 616 | - | EnsureAdwaitaInitialized() | 658 | + | gtkApp := requireGTKDisplayApp(t) |
| 617 | - | appID := AppID | |||
| 618 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |||
| 619 | - | if gtkApp == nil { | |||
| 620 | - | t.Fatal("gtk application creation failed") | |||
| 621 | - | } | |||
| 622 | defer gtkApp.Unref() | 659 | defer gtkApp.Unref() | ||
| 623 | 660 | ||||
| 624 | firstMainWindow, err := window.New(context.Background(), gtkApp, "top") | 661 | firstMainWindow, err := window.New(context.Background(), gtkApp, "top") | ||
| @@ -657,12 +694,7 @@ func TestApp_HandlePaneWindowTitleChangedTargetsOwningWindow(t *testing.T) { | |||||
| 657 | } | 694 | } | ||
| 658 | 695 | ||||
| 659 | func TestApp_ActivateBrowserWindowResyncsTitleFromBackgroundPane(t *testing.T) { | 696 | func TestApp_ActivateBrowserWindowResyncsTitleFromBackgroundPane(t *testing.T) { | ||
| 660 | - | EnsureAdwaitaInitialized() | 697 | + | gtkApp := requireGTKDisplayApp(t) |
| 661 | - | appID := AppID | |||
| 662 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |||
| 663 | - | if gtkApp == nil { | |||
| 664 | - | t.Fatal("gtk application creation failed") | |||
| 665 | - | } | |||
| 666 | defer gtkApp.Unref() | 698 | defer gtkApp.Unref() | ||
| 667 | 699 | ||||
| 668 | firstMainWindow, err := window.New(context.Background(), gtkApp, "top") | 700 | firstMainWindow, err := window.New(context.Background(), gtkApp, "top") | ||
| @@ -707,12 +739,7 @@ func TestApp_ActivateBrowserWindowResyncsTitleFromBackgroundPane(t *testing.T) { | |||||
| 707 | } | 739 | } | ||
| 708 | 740 | ||||
| 709 | func TestApp_HandlePaneFullscreenChangedTargetsOwningWindow(t *testing.T) { | 741 | func TestApp_HandlePaneFullscreenChangedTargetsOwningWindow(t *testing.T) { | ||
| 710 | - | EnsureAdwaitaInitialized() | 742 | + | gtkApp := requireGTKDisplayApp(t) |
| 711 | - | appID := AppID | |||
| 712 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |||
| 713 | - | if gtkApp == nil { | |||
| 714 | - | t.Fatal("gtk application creation failed") | |||
| 715 | - | } | |||
| 716 | defer gtkApp.Unref() | 743 | defer gtkApp.Unref() | ||
| 717 | 744 | ||||
| 718 | firstMainWindow, err := window.New(context.Background(), gtkApp, "top") | 745 | firstMainWindow, err := window.New(context.Background(), gtkApp, "top") | ||
| @@ -759,12 +786,7 @@ func TestApp_HandlePaneFullscreenChangedTargetsOwningWindow(t *testing.T) { | |||||
| 759 | } | 786 | } | ||
| 760 | 787 | ||||
| 761 | func TestApp_HandlePaneFullscreenChangedIgnoresUnresolvedPane(t *testing.T) { | 788 | func TestApp_HandlePaneFullscreenChangedIgnoresUnresolvedPane(t *testing.T) { | ||
| 762 | - | EnsureAdwaitaInitialized() | 789 | + | gtkApp := requireGTKDisplayApp(t) |
| 763 | - | appID := AppID | |||
| 764 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |||
| 765 | - | if gtkApp == nil { | |||
| 766 | - | t.Fatal("gtk application creation failed") | |||
| 767 | - | } | |||
| 768 | defer gtkApp.Unref() | 790 | defer gtkApp.Unref() | ||
| 769 | 791 | ||||
| 770 | firstMainWindow, err := window.New(context.Background(), gtkApp, "top") | 792 | firstMainWindow, err := window.New(context.Background(), gtkApp, "top") | ||
| @@ -881,12 +903,7 @@ func TestApp_MoveActivePaneToTabFromBrowserWindowActivatesTargetOwnerForCrossWin | |||||
| 881 | } | 903 | } | ||
| 882 | 904 | ||||
| 883 | func TestApp_InitKeyboardHandlerDoesNotReattachExistingWindowInput(t *testing.T) { | 905 | func TestApp_InitKeyboardHandlerDoesNotReattachExistingWindowInput(t *testing.T) { | ||
| 884 | - | EnsureAdwaitaInitialized() | 906 | + | gtkApp := requireGTKDisplayApp(t) |
| 885 | - | appID := AppID | |||
| 886 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |||
| 887 | - | if gtkApp == nil { | |||
| 888 | - | t.Fatal("gtk application creation failed") | |||
| 889 | - | } | |||
| 890 | defer gtkApp.Unref() | 907 | defer gtkApp.Unref() | ||
| 891 | 908 | ||||
| 892 | mainWindow, err := window.New(context.Background(), gtkApp, "top") | 909 | mainWindow, err := window.New(context.Background(), gtkApp, "top") | ||
| @@ -946,12 +963,7 @@ func (*testFocusedInputProvider) GetFocusedInput() port.TextInputTarget { return | |||||
| 946 | func (*testFocusedInputProvider) SetFocusedInput(port.TextInputTarget) {} | 963 | func (*testFocusedInputProvider) SetFocusedInput(port.TextInputTarget) {} | ||
| 947 | 964 | ||||
| 948 | func TestApp_UpdateBrowserWindowTabBarVisibilityHonorsHideWhenSingleTabDisabled(t *testing.T) { | 965 | func TestApp_UpdateBrowserWindowTabBarVisibilityHonorsHideWhenSingleTabDisabled(t *testing.T) { | ||
| 949 | - | EnsureAdwaitaInitialized() | 966 | + | gtkApp := requireGTKDisplayApp(t) |
| 950 | - | appID := AppID | |||
| 951 | - | gtkApp := gtk.NewApplication(&appID, gio.GApplicationNonUniqueValue) | |||
| 952 | - | if gtkApp == nil { | |||
| 953 | - | t.Fatal("gtk application creation failed") | |||
| 954 | - | } | |||
| 955 | defer gtkApp.Unref() | 967 | defer gtkApp.Unref() | ||
| 956 | 968 | ||||
| 957 | mainWindow := &window.MainWindow{} | 969 | mainWindow := &window.MainWindow{} | ||