detached bea0cdf

test: update integration tests for gotk4 API changes

- Use gdk.ControlMask for keyboard shortcut modifiers
- Remove deprecated Config fields (InitialURL, ZoomDefault)
- Fix GetZoom() return signature (no error return)
commit
bea0cdf5d8a9aa4f580518ad56dbdab0e69616fc
author
bamen · · 2025-10-14 18:31 UTC
parent
ac1f058
signature
unsigned
3 files · +7 -8
M tests/integration/test_external_shortcuts.go +4 -2
@@ -1,8 +1,10 @@
11 package integration
22
33 import (
4- "github.com/bnema/dumber/pkg/webkit"
54 "testing"
5+
6+ "github.com/bnema/dumber/pkg/webkit"
7+ "github.com/diamondburned/gotk4/pkg/gdk/v4"
68 )
79
810 // Integration: keyboard shortcuts work on external sites once implemented.
@@ -11,7 +13,7 @@ func Test_WebKit_ExternalShortcuts_Integration(t *testing.T) {
1113 if err != nil {
1214 t.Fatalf("NewWebView failed: %v", err)
1315 }
14- if err := view.RegisterKeyboardShortcut("Ctrl+K", func() {}); err != nil {
16+ if err := view.RegisterKeyboardShortcut("k", uint(gdk.ControlMask), func() {}); err != nil {
1517 t.Fatalf("RegisterKeyboardShortcut should succeed, got: %v", err)
1618 }
1719 }
@@ -1,8 +1,10 @@
1 package integration1 package integration
2 2
3 import (3 import (
4- "github.com/bnema/dumber/pkg/webkit"
5 "testing"4 "testing"
5+
6+ "github.com/bnema/dumber/pkg/webkit"
7+ "github.com/diamondburned/gotk4/pkg/gdk/v4"
6 )8 )
7 9
8 // Integration: keyboard shortcuts work on external sites once implemented.10 // Integration: keyboard shortcuts work on external sites once implemented.
@@ -11,7 +13,7 @@ func Test_WebKit_ExternalShortcuts_Integration(t *testing.T) {
11 if err != nil {13 if err != nil {
12 t.Fatalf("NewWebView failed: %v", err)14 t.Fatalf("NewWebView failed: %v", err)
13 }15 }
14- if err := view.RegisterKeyboardShortcut("Ctrl+K", func() {}); err != nil {16+ if err := view.RegisterKeyboardShortcut("k", uint(gdk.ControlMask), func() {}); err != nil {
15 t.Fatalf("RegisterKeyboardShortcut should succeed, got: %v", err)17 t.Fatalf("RegisterKeyboardShortcut should succeed, got: %v", err)
16 }18 }
17 }19 }
M tests/integration/test_webkit_basic.go +1 -1
@@ -7,7 +7,7 @@ import (
77
88 // Integration: basic WebKit window and navigation works.
99 func Test_WebKit_BasicWindow_Integration(t *testing.T) {
10- view, err := webkit.NewWebView(&webkit.Config{InitialURL: "about:blank"})
10+ view, err := webkit.NewWebView(&webkit.Config{})
1111 if err != nil {
1212 t.Fatalf("NewWebView failed: %v", err)
1313 }
@@ -7,7 +7,7 @@ import (
7 7
8 // Integration: basic WebKit window and navigation works.8 // Integration: basic WebKit window and navigation works.
9 func Test_WebKit_BasicWindow_Integration(t *testing.T) {9 func Test_WebKit_BasicWindow_Integration(t *testing.T) {
10- view, err := webkit.NewWebView(&webkit.Config{InitialURL: "about:blank"})10+ view, err := webkit.NewWebView(&webkit.Config{})
11 if err != nil {11 if err != nil {
12 t.Fatalf("NewWebView failed: %v", err)12 t.Fatalf("NewWebView failed: %v", err)
13 }13 }
M tests/integration/test_zoom_persistence.go +2 -5
@@ -7,17 +7,14 @@ import (
77
88 // Integration: zoom persists across operations (with DB) once implemented.
99 func Test_WebKit_ZoomPersistence_Integration(t *testing.T) {
10- view, err := webkit.NewWebView(&webkit.Config{ZoomDefault: 1.0})
10+ view, err := webkit.NewWebView(&webkit.Config{})
1111 if err != nil {
1212 t.Fatalf("NewWebView failed: %v", err)
1313 }
1414 if err := view.SetZoom(1.1); err != nil {
1515 t.Fatalf("SetZoom should succeed, got: %v", err)
1616 }
17- z, err := view.GetZoom()
18- if err != nil {
19- t.Fatalf("GetZoom should succeed, got: %v", err)
20- }
17+ z := view.GetZoom()
2118 if z != 1.1 {
2219 t.Fatalf("expected zoom 1.1, got %v", z)
2320 }
@@ -7,17 +7,14 @@ import (
7 7
8 // Integration: zoom persists across operations (with DB) once implemented.8 // Integration: zoom persists across operations (with DB) once implemented.
9 func Test_WebKit_ZoomPersistence_Integration(t *testing.T) {9 func Test_WebKit_ZoomPersistence_Integration(t *testing.T) {
10- view, err := webkit.NewWebView(&webkit.Config{ZoomDefault: 1.0})10+ view, err := webkit.NewWebView(&webkit.Config{})
11 if err != nil {11 if err != nil {
12 t.Fatalf("NewWebView failed: %v", err)12 t.Fatalf("NewWebView failed: %v", err)
13 }13 }
14 if err := view.SetZoom(1.1); err != nil {14 if err := view.SetZoom(1.1); err != nil {
15 t.Fatalf("SetZoom should succeed, got: %v", err)15 t.Fatalf("SetZoom should succeed, got: %v", err)
16 }16 }
17- z, err := view.GetZoom()17+ z := view.GetZoom()
18- if err != nil {
19- t.Fatalf("GetZoom should succeed, got: %v", err)
20- }
21 if z != 1.1 {18 if z != 1.1 {
22 t.Fatalf("expected zoom 1.1, got %v", z)19 t.Fatalf("expected zoom 1.1, got %v", z)
23 }20 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close