v0.2.0 13c6a90

drm_inventory_test.go RawHistoryFolder

1package app
2
3import (
4	"errors"
5	"testing"
6
7	"github.com/bnema/neferwl/internal/ports"
8)
9
10func TestRetainedHeadsOnCardReadError(t *testing.T) {
11	first := []ports.OutputHead{{Info: ports.OutputInfo{Name: "DP-1"}, Enabled: true}}
12	other := []ports.OutputHead{{Info: ports.OutputInfo{Name: "HDMI-1"}, Enabled: true}}
13	cached := retainedHeads(nil, first, nil)
14	cached = retainedHeads(cached, nil, errors.New("resources unavailable"))
15	combined := append(append([]ports.OutputHead{}, cached...), other...)
16	if len(combined) != 2 || combined[0].Info.Name != "DP-1" || combined[1].Info.Name != "HDMI-1" {
17		t.Fatalf("failed card lost its inventory: %+v", combined)
18	}
19	if got := retainedHeads(cached, nil, nil); len(got) != 0 {
20		t.Fatalf("successful empty inventory should clear cache: %+v", got)
21	}
22}
23
24func TestReleasedHeadOnInventoryError(t *testing.T) {
25	mode := ports.OutputMode{Width: 1920, Height: 1080}
26	previous := []ports.OutputHead{{Info: ports.OutputInfo{Name: "DP-1"}, Enabled: true, Current: &mode}, {Info: ports.OutputInfo{Name: "HDMI-1"}, Enabled: true, Current: &mode}}
27	// Both a disabled stop and an unsuccessful restart release the old instance.
28	for _, restart := range []bool{false, true} {
29		t.Run(map[bool]string{false: "disabled", true: "restart"}[restart], func(t *testing.T) {
30			heads := releasedHead(append([]ports.OutputHead(nil), previous...), "DP-1")
31			heads = retainedHeads(heads, nil, errors.New("inventory unavailable"))
32			if heads[0].Enabled || heads[0].Current != nil || !heads[1].Enabled {
33				t.Fatalf("released connector inventory: %+v", heads)
34			}
35		})
36	}
37}

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