cef_frame_rate_test.go RawHistoryFolder

1package config
2
3import "testing"
4
5func TestCEFAdaptiveWindowlessFrameRateDefaults(t *testing.T) {
6	cfg := DefaultConfig().Engine.CEF
7
8	if !cfg.AdaptiveWindowlessFrameRate {
9		t.Fatal("adaptive windowless frame-rate should be enabled by default")
10	}
11	if cfg.WindowlessFrameRate != 0 {
12		t.Fatalf("default explicit windowless frame-rate = %d, want 0 for adaptive", cfg.WindowlessFrameRate)
13	}
14	if got := cfg.CEFWindowlessFrameRate(); got != int32(defaultCEFWindowlessFrameRate) {
15		t.Fatalf("initial/fallback frame-rate = %d, want %d", got, defaultCEFWindowlessFrameRate)
16	}
17	if got := cfg.CEFWindowlessFrameRateMax(); got != int32(defaultCEFWindowlessFrameRateMax) {
18		t.Fatalf("max frame-rate = %d, want %d", got, defaultCEFWindowlessFrameRateMax)
19	}
20	if !cfg.CEFAdaptiveWindowlessFrameRate() {
21		t.Fatal("adaptive should be effective when enabled and no explicit frame-rate is set")
22	}
23}
24
25func TestCEFAdaptiveWindowlessFrameRateDisabledByExplicitFrameRate(t *testing.T) {
26	cfg := CEFEngineConfig{AdaptiveWindowlessFrameRate: true, WindowlessFrameRate: 144}
27
28	if cfg.CEFAdaptiveWindowlessFrameRate() {
29		t.Fatal("explicit windowless_frame_rate should disable adaptive frame-rate")
30	}
31	if got := cfg.CEFWindowlessFrameRate(); got != 144 {
32		t.Fatalf("explicit frame-rate = %d, want 144", got)
33	}
34}
35
36func TestCEFWindowlessFrameRateFallbackWhenAdaptiveDisabled(t *testing.T) {
37	cfg := CEFEngineConfig{AdaptiveWindowlessFrameRate: false, WindowlessFrameRate: 0}
38
39	if cfg.CEFAdaptiveWindowlessFrameRate() {
40		t.Fatal("adaptive should be disabled when adaptive flag is false")
41	}
42	if got := cfg.CEFWindowlessFrameRate(); got != defaultCEFWindowlessFrameRate {
43		t.Fatalf("frame-rate = %d, want default %d", got, defaultCEFWindowlessFrameRate)
44	}
45}
46
47func TestCEFWindowlessFrameRateUsesExplicitValueWhenAdaptiveDisabled(t *testing.T) {
48	cfg := CEFEngineConfig{AdaptiveWindowlessFrameRate: false, WindowlessFrameRate: 75}
49
50	if cfg.CEFAdaptiveWindowlessFrameRate() {
51		t.Fatal("adaptive should remain disabled with explicit frame-rate")
52	}
53	if got := cfg.CEFWindowlessFrameRate(); got != 75 {
54		t.Fatalf("frame-rate = %d, want explicit 75", got)
55	}
56}
57
58func TestCEFWindowlessFrameRateBoundaries(t *testing.T) {
59	tests := []struct {
60		name string
61		cfg  CEFEngineConfig
62		want int32
63	}{
64		{name: "negative falls back", cfg: CEFEngineConfig{WindowlessFrameRate: -1}, want: defaultCEFWindowlessFrameRate},
65		{name: "above max remains explicit", cfg: CEFEngineConfig{WindowlessFrameRate: 300, WindowlessFrameRateMax: 240}, want: 300},
66	}
67	for _, tt := range tests {
68		t.Run(tt.name, func(t *testing.T) {
69			if got := tt.cfg.CEFWindowlessFrameRate(); got != tt.want {
70				t.Fatalf("CEFWindowlessFrameRate() = %d, want %d", got, tt.want)
71			}
72		})
73	}
74}

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 8

Tags 42

↑↓ moveenter openesc close