detached f2d166b

orient_rounded_test.go RawHistoryFolder

1package vulkan
2
3import (
4	"image"
5	"testing"
6
7	"github.com/bnema/neferwl/internal/ports"
8)
9
10func TestOrientRoundedWindow(t *testing.T) {
11	for transform := ports.BufferTransform(0); transform < 8; transform++ {
12		r := &Renderer{width: 120, height: 90}
13		sw, sh := r.sceneSize(transform)
14		outer := image.Rect(9, 13, 69, 77)
15		body := outer.Inset(3)
16		s := ports.Scene{Scale: 1, Background: "#ffffff", Border: ports.Border{Width: 3, Active: "#ff8800"},
17			Windows:    []ports.SceneWindow{{ID: 1, Rect: ports.Rect{X: 9, Y: 13, W: 60, H: 64}, Inset: ports.SideAll, Radius: 10, Dim: 0.5}},
18			Separators: []ports.Separator{{Window: 1, Active: true}}}
19		contents := map[ports.WindowID]ports.SurfaceContent{1: {ID: 1, Width: 1, Height: 1, LogicalW: 54, LogicalH: 58, Solid: &ports.SolidColor{R: 1, A: 1}}}
20		ds := r.draws(s, contents, newDamage(&target{}, s, image.Rect(0, 0, sw, sh)))
21		if len(ds) != 4 {
22			t.Fatalf("transform %d: %d draws", transform, len(ds))
23		}
24		// Exercise the non-solid orient path as well as ring/body/dim solids.
25		ds[2].pc.misc[0] = modeImage
26		radii := ds[0].radii
27		r.orient(ds, transform)
28		wantOuter := roundRect(transform.RectToBuffer(outer, sw, sh))
29		wantBody := roundRect(transform.RectToBuffer(body, sw, sh))
30		wantHole := roundRect(transform.RectToBuffer(body.Inset(1), sw, sh))
31		if ds[0].round != wantOuter || ds[0].roundInner != wantHole || ds[0].radii != radii {
32			t.Fatalf("transform %d: ring clip %+v", transform, ds[0])
33		}
34		if ds[0].pc.misc[1]&flagRing == 0 {
35			t.Fatal("ring must precede content")
36		}
37		for i, d := range ds {
38			want := wantBody
39			if i == 0 || i == 3 {
40				want = wantOuter
41			}
42			if d.round != want {
43				t.Fatalf("transform %d draw %d clip %v want %v", transform, i, d.round, want)
44			}
45			rect := [4]float32{float32(d.pc.rect[0]), float32(d.pc.rect[1]), float32(d.pc.rect[2]), float32(d.pc.rect[3])}
46			if rect != want {
47				t.Fatalf("transform %d draw %d rect %v want %v", transform, i, rect, want)
48			}
49		}
50	}
51}

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