feat/data-dnd e05cb15

frame_pulse_test.go RawHistoryFolder

1package core
2
3import (
4	"context"
5	"testing"
6	"time"
7
8	"github.com/bnema/neferwl/internal/ports"
9)
10
11// stepScenes steps only the screen and returns the scene of each output.
12func stepScenes(t *testing.T, c *Core, only *screen) map[string]ports.Scene {
13	t.Helper()
14	if err := c.step(context.Background(), only); err != nil {
15		t.Fatal(err)
16	}
17	out := map[string]ports.Scene{}
18	for _, s := range <-c.ch.Scenes {
19		out[s.Output] = s
20	}
21	return out
22}
23
24// While the focus pulse runs on the focused output, a flip of another output
25// keeps the focused output's Seq; its own flip samples the pulse.
26func TestFlipOfOtherOutputKeepsPulseSeq(t *testing.T) {
27	c, ic := pulseCore(t)
28	a := c.cur()
29	c.addScreen(ports.OutputInfo{Name: "B", Width: 300, Height: 200})
30	b := c.screens[1]
31	for id := WindowID(3); id <= 5; id++ {
32		b.mon.AddWindow(id)
33	}
34	indicatorScene(t, c)
35
36	// A pulse on window 1 of A.
37	a.mon.Current().FocusID(1)
38	indicatorScene(t, c)
39	ic.now = ic.now.Add(pulseSettle)
40	if !c.pulseTick() {
41		t.Fatal("no pulse after settle")
42	}
43	// A camera transition runs on B.
44	w := b.mon.Current()
45	w.view.off = 100
46	w.view.motion = newMotion(viewSpring(w.view.off, 0), ic.now, 1)
47
48	ic.now = ic.now.Add(pulseRise / 2)
49	first := stepScenes(t, c, a)
50	if pulseOf(first["A"], 1) <= 0 {
51		t.Fatalf("no pulse on A: %v", pulseOf(first["A"], 1))
52	}
53	ic.now = ic.now.Add(10 * time.Millisecond)
54	second := stepScenes(t, c, b)
55	if second["A"].Seq != first["A"].Seq || !second["A"].SameAs(first["A"]) {
56		t.Fatalf("A changed on a flip of B: Seq %d, was %d", second["A"].Seq, first["A"].Seq)
57	}
58	if second["B"].SameAs(first["B"]) {
59		t.Fatal("B did not move on its own flip")
60	}
61	ic.now = ic.now.Add(10 * time.Millisecond)
62	third := stepScenes(t, c, a)
63	if third["A"].Seq <= second["A"].Seq || pulseOf(third["A"], 1) == pulseOf(second["A"], 1) {
64		t.Fatalf("A did not sample the pulse on its own flip: Seq %d, was %d", third["A"].Seq, second["A"].Seq)
65	}
66	if third["B"].Seq != second["B"].Seq {
67		t.Fatalf("B changed on a flip of A: Seq %d, was %d", third["B"].Seq, second["B"].Seq)
68	}
69}

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 23

Tags 10

↑↓ moveenter openesc close