feat/data-dnd e05cb15

capture_workspace_e2e_test.go RawHistoryFolder

1package core_test
2
3import (
4	"testing"
5
6	"github.com/bnema/neferwl/internal/ports"
7)
8
9// configureOf returns the next ConfigureWindow of id, skipping other commands.
10func (r *captureRig) configureOf(t *testing.T, id ports.WindowID) ports.ConfigureWindow {
11	t.Helper()
12	for {
13		if v, ok := receive(t, r.commands).(ports.ConfigureWindow); ok && v.ID == id {
14			return v
15		}
16	}
17}
18
19// A session keeps capturing a workspace that leaves the screen: the state
20// stays active, the scene carries a sibling CaptureScene, and the window is
21// configured Captured (sized, physically invisible) until the session stops.
22func TestCaptureSessionSurvivesWorkspaceSwitch(t *testing.T) {
23	r := captureCore(t)
24	r.client <- ports.WindowMapped{ID: 1}
25	scene(t, r.scenes)
26	// Mapping the window adds a spare workspace: wait for the inventory that lists it.
27	var ws []ports.WorkspaceInfo
28	for len(ws) < 2 {
29		ws = receive(t, r.workspaces).Outputs[0].Workspaces
30	}
31	r.client <- ports.CaptureSessionOpen{ID: 1, Workspace: ws[0].ID}
32	if st := r.state(t); !st.Active {
33		t.Fatalf("state %+v", st)
34	}
35	on := r.sceneWith(t, true)
36	if on.CaptureScene != nil {
37		t.Fatalf("a workspace on screen needs no capture scene: %+v", on.CaptureScene)
38	}
39	// The window is shown and not Captured until its workspace leaves.
40	for len(r.commands) > 0 {
41		if v, ok := (<-r.commands).(ports.ConfigureWindow); ok && v.ID == 1 && (!v.Visible || v.Captured) {
42			t.Fatalf("shown window %+v", v)
43		}
44	}
45
46	r.client <- ports.WorkspaceActivate{IDs: []uint64{ws[1].ID}}
47	var off ports.Scene
48	for {
49		off = scene(t, r.scenes)
50		if off.CaptureScene != nil {
51			break
52		}
53	}
54	if off.Capture.Workspace != ws[0].ID {
55		t.Fatalf("capture %+v", off.Capture)
56	}
57	c := off.CaptureScene
58	if c.Capture != nil || c.CaptureScene != nil || len(c.Layers) != 0 || c.Seq != off.Seq || c.OutputWidth != 100 || c.OutputHeight != 80 {
59		t.Fatalf("capture scene %+v (root seq %d)", c, off.Seq)
60	}
61	if len(c.Windows) != 1 || c.Windows[0].ID != 1 || c.Windows[0].Hidden || c.Windows[0].Rect.W <= 0 {
62		t.Fatalf("capture windows %+v", c.Windows)
63	}
64	for _, w := range off.Windows {
65		if w.ID == 1 && !w.Hidden {
66			t.Fatalf("captured window drawn on screen: %+v", w)
67		}
68	}
69	hid := r.configureOf(t, 1)
70	if hid.Visible || hid.Activated || !hid.Captured || hid.Width <= 0 {
71		t.Fatalf("captured hidden window %+v", hid)
72	}
73
74	// Stopping the session hides the window for real again.
75	r.client <- ports.CaptureSessionClose{ID: 1}
76	var after ports.Scene
77	for {
78		if after = scene(t, r.scenes); after.Capture == nil {
79			break
80		}
81	}
82	end := r.configureOf(t, 1)
83	if end.Captured || end.Visible || end.Width != hid.Width {
84		t.Fatalf("released window %+v", end)
85	}
86}

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 25

Tags 10

↑↓ moveenter openesc close