detached 755c788

test: add integration coverage for player lifecycle

commit
755c788668ba4ac6db31d43e2002bc819eed666c
author
brice · · 2026-04-09 15:54 UTC
parent
d1e8691
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +59 -0
M README.md +6 -0
@@ -38,3 +38,9 @@ The sync script is currently a placeholder for the planned header-import workflo
3838
3939 - Go 1.26.1+
4040 - Linux with PipeWire 0.3 runtime libraries
41+
42+## Integration tests
43+
44+Run integration tests (requires PipeWire runtime):
45+
46+ go test -tags integration ./integration ./pipewire -v
@@ -38,3 +38,9 @@ The sync script is currently a placeholder for the planned header-import workflo
38 38
39 - Go 1.26.1+39 - Go 1.26.1+
40 - Linux with PipeWire 0.3 runtime libraries40 - Linux with PipeWire 0.3 runtime libraries
41+
42+## Integration tests
43+
44+Run integration tests (requires PipeWire runtime):
45+
46+ go test -tags integration ./integration ./pipewire -v
A integration/player_test.go +53 -0
@@ -0,0 +1,53 @@
1+//go:build integration
2+
3+package integration
4+
5+import (
6+ "testing"
7+
8+ "github.com/bnema/purego-pipewire/pipewire"
9+)
10+
11+func TestPlayerStartStopClose(t *testing.T) {
12+ // Initialize PipeWire
13+ initResult, err := pipewire.Init()
14+ if err != nil {
15+ t.Fatalf("Init returned error: %v", err)
16+ }
17+ defer initResult.Deinit()
18+
19+ // Create player with specified configuration
20+ config := pipewire.PlayerConfig{
21+ SampleRate: 48000,
22+ Channels: 2,
23+ FramesPerBuffer: 256,
24+ SampleFormat: pipewire.SampleFormatF32,
25+ UnderrunPolicy: pipewire.UnderrunFillSilence,
26+ }
27+
28+ callbacks := pipewire.PlayerCallbacks{
29+ Fill: func(buf *pipewire.PCMBuffer) (int, error) {
30+ return buf.Frames, nil
31+ },
32+ }
33+
34+ player, err := pipewire.NewPlayer(config, callbacks)
35+ if err != nil {
36+ t.Fatalf("NewPlayer returned error: %v", err)
37+ }
38+
39+ // Test Start
40+ if err := player.Start(); err != nil {
41+ t.Errorf("Start returned error: %v", err)
42+ }
43+
44+ // Test Stop
45+ if err := player.Stop(); err != nil {
46+ t.Errorf("Stop returned error: %v", err)
47+ }
48+
49+ // Test Close
50+ if err := player.Close(); err != nil {
51+ t.Errorf("Close returned error: %v", err)
52+ }
53+}
@@ -0,0 +1,53 @@
1+//go:build integration
2+
3+package integration
4+
5+import (
6+ "testing"
7+
8+ "github.com/bnema/purego-pipewire/pipewire"
9+)
10+
11+func TestPlayerStartStopClose(t *testing.T) {
12+ // Initialize PipeWire
13+ initResult, err := pipewire.Init()
14+ if err != nil {
15+ t.Fatalf("Init returned error: %v", err)
16+ }
17+ defer initResult.Deinit()
18+
19+ // Create player with specified configuration
20+ config := pipewire.PlayerConfig{
21+ SampleRate: 48000,
22+ Channels: 2,
23+ FramesPerBuffer: 256,
24+ SampleFormat: pipewire.SampleFormatF32,
25+ UnderrunPolicy: pipewire.UnderrunFillSilence,
26+ }
27+
28+ callbacks := pipewire.PlayerCallbacks{
29+ Fill: func(buf *pipewire.PCMBuffer) (int, error) {
30+ return buf.Frames, nil
31+ },
32+ }
33+
34+ player, err := pipewire.NewPlayer(config, callbacks)
35+ if err != nil {
36+ t.Fatalf("NewPlayer returned error: %v", err)
37+ }
38+
39+ // Test Start
40+ if err := player.Start(); err != nil {
41+ t.Errorf("Start returned error: %v", err)
42+ }
43+
44+ // Test Stop
45+ if err := player.Stop(); err != nil {
46+ t.Errorf("Stop returned error: %v", err)
47+ }
48+
49+ // Test Close
50+ if err := player.Close(); err != nil {
51+ t.Errorf("Close returned error: %v", err)
52+ }
53+}

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 1

Tags 8

↑↓ moveenter openesc close