feat/data-dnd e05cb15

frame_output_test.go RawHistoryFolder

1package core_test
2
3import (
4	"testing"
5	"time"
6
7	"github.com/bnema/neferwl/internal/ports"
8)
9
10func sceneFor(set []ports.Scene, output string) ports.Scene {
11	for _, s := range set {
12		if s.Output == output {
13			return s
14		}
15	}
16	return ports.Scene{}
17}
18
19// A page flip of one output advances only that output's springs: the other
20// output keeps its scene (and Seq) until its own flip.
21func TestFlipAdvancesOnlyItsOutput(t *testing.T) {
22	r := startSwipe(t, nil)
23	threeColumns(t, r)
24	second := ports.OutputInfo{Name: "DP-2", Width: 800, Height: 600, RefreshMilli: 60000}
25	r.plug(t, second)
26	r.input <- ports.PointerMotion{X: 1000, Y: 300}
27	scene(t, r.scenes)
28	for id := ports.WindowID(4); id <= 6; id++ {
29		r.mapWindow(t, id)
30	}
31	// A running landing on each output.
32	r.input <- ports.PointerMotion{X: 100, Y: 300}
33	scene(t, r.scenes)
34	r.flick(t, 10, -40, 0)
35	r.input <- ports.PointerMotion{X: 1000, Y: 300}
36	scene(t, r.scenes)
37	r.flick(t, 10, -40, 0)
38	r.drain()
39
40	// The first flip of each output moves its columns.
41	r.advance(32 * time.Millisecond)
42	r.frames <- ports.OutputFrame{Output: wide.Name}
43	set := receive(t, r.scenes)
44	a, b := sceneFor(set, wide.Name), sceneFor(set, second.Name)
45	r.advance(32 * time.Millisecond)
46	r.frames <- ports.OutputFrame{Output: second.Name}
47	set = receive(t, r.scenes)
48	a2, b2 := sceneFor(set, wide.Name), sceneFor(set, second.Name)
49	if a2.Seq != a.Seq || !a2.SameAs(a) {
50		t.Fatalf("DP-1 changed on a flip of DP-2: Seq %d, was %d", a2.Seq, a.Seq)
51	}
52	if b2.Seq <= b.Seq || b2.SameAs(b) {
53		t.Fatalf("DP-2 did not move on its own flip: Seq %d, was %d", b2.Seq, b.Seq)
54	}
55
56	// And the other way round.
57	r.advance(32 * time.Millisecond)
58	r.frames <- ports.OutputFrame{Output: wide.Name}
59	set = receive(t, r.scenes)
60	a3, b3 := sceneFor(set, wide.Name), sceneFor(set, second.Name)
61	if a3.Seq <= a2.Seq || a3.SameAs(a2) {
62		t.Fatalf("DP-1 did not move on its own flip: Seq %d, was %d", a3.Seq, a2.Seq)
63	}
64	if b3.Seq != b2.Seq || !b3.SameAs(b2) {
65		t.Fatalf("DP-2 changed on a flip of DP-1: Seq %d, was %d", b3.Seq, b2.Seq)
66	}
67}

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