detached 0db6373

docs: clarify player integration test coverage

commit
0db6373b0bcb9aec5e0e601f2ed7b0bde394a986
author
brice · · 2026-04-10 03:44 UTC
parent
7618928
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +24 -4
M README.md +3 -1
@@ -41,6 +41,8 @@ The sync script is currently a placeholder for the planned header-import workflo
4141
4242 ## Integration tests
4343
44-Run integration tests (requires PipeWire runtime):
44+Tagged integration tests require a **real PipeWire runtime/daemon** and verify the public lifecycle API against a live runtime:
4545
4646 go test -tags integration ./integration ./pipewire -v
47+
48+These tests exercise state transitions (Idle → Playing → Stopped → Closed) through an actual PipeWire instance. Deeper cleanup internals are primarily covered by unit tests that use mocked dependencies.
@@ -41,6 +41,8 @@ The sync script is currently a placeholder for the planned header-import workflo
41 41
42 ## Integration tests42 ## Integration tests
43 43
44-Run integration tests (requires PipeWire runtime):44+Tagged integration tests require a **real PipeWire runtime/daemon** and verify the public lifecycle API against a live runtime:
45 45
46 go test -tags integration ./integration ./pipewire -v46 go test -tags integration ./integration ./pipewire -v
47+
48+These tests exercise state transitions (Idle → Playing → Stopped → Closed) through an actual PipeWire instance. Deeper cleanup internals are primarily covered by unit tests that use mocked dependencies.
M integration/player_test.go +21 -3
@@ -8,6 +8,10 @@ import (
88 "github.com/bnema/purego-pipewire/pipewire"
99 )
1010
11+// TestPlayerStartStopClose verifies the player lifecycle against a real PipeWire
12+// daemon. This test requires a running PipeWire runtime and only validates
13+// externally visible state transitions (Idle -> Playing -> Stopped -> Closed).
14+// Deeper cleanup internals are covered by unit tests.
1115 func TestPlayerStartStopClose(t *testing.T) {
1216 // Initialize PipeWire
1317 initResult, err := pipewire.Init()
@@ -36,18 +40,32 @@ func TestPlayerStartStopClose(t *testing.T) {
3640 t.Fatalf("NewPlayer returned error: %v", err)
3741 }
3842
39- // Test Start
43+ // Verify initial state is Idle
44+ if state := player.State(); state != pipewire.PlayerStateIdle {
45+ t.Errorf("Expected initial state Idle, got %v", state)
46+ }
47+
48+ // Test Start - should transition to Playing state
4049 if err := player.Start(); err != nil {
4150 t.Errorf("Start returned error: %v", err)
4251 }
52+ if state := player.State(); state != pipewire.PlayerStatePlaying {
53+ t.Errorf("After Start: expected state Playing, got %v", state)
54+ }
4355
44- // Test Stop
56+ // Test Stop - should transition to Stopped state
4557 if err := player.Stop(); err != nil {
4658 t.Errorf("Stop returned error: %v", err)
4759 }
60+ if state := player.State(); state != pipewire.PlayerStateStopped {
61+ t.Errorf("After Stop: expected state Stopped, got %v", state)
62+ }
4863
49- // Test Close
64+ // Test Close - should transition to Closed state
5065 if err := player.Close(); err != nil {
5166 t.Errorf("Close returned error: %v", err)
5267 }
68+ if state := player.State(); state != pipewire.PlayerStateClosed {
69+ t.Errorf("After Close: expected state Closed, got %v", state)
70+ }
5371 }
@@ -8,6 +8,10 @@ import (
8 "github.com/bnema/purego-pipewire/pipewire"8 "github.com/bnema/purego-pipewire/pipewire"
9 )9 )
10 10
11+// TestPlayerStartStopClose verifies the player lifecycle against a real PipeWire
12+// daemon. This test requires a running PipeWire runtime and only validates
13+// externally visible state transitions (Idle -> Playing -> Stopped -> Closed).
14+// Deeper cleanup internals are covered by unit tests.
11 func TestPlayerStartStopClose(t *testing.T) {15 func TestPlayerStartStopClose(t *testing.T) {
12 // Initialize PipeWire16 // Initialize PipeWire
13 initResult, err := pipewire.Init()17 initResult, err := pipewire.Init()
@@ -36,18 +40,32 @@ func TestPlayerStartStopClose(t *testing.T) {
36 t.Fatalf("NewPlayer returned error: %v", err)40 t.Fatalf("NewPlayer returned error: %v", err)
37 }41 }
38 42
39- // Test Start43+ // Verify initial state is Idle
44+ if state := player.State(); state != pipewire.PlayerStateIdle {
45+ t.Errorf("Expected initial state Idle, got %v", state)
46+ }
47+
48+ // Test Start - should transition to Playing state
40 if err := player.Start(); err != nil {49 if err := player.Start(); err != nil {
41 t.Errorf("Start returned error: %v", err)50 t.Errorf("Start returned error: %v", err)
42 }51 }
52+ if state := player.State(); state != pipewire.PlayerStatePlaying {
53+ t.Errorf("After Start: expected state Playing, got %v", state)
54+ }
43 55
44- // Test Stop56+ // Test Stop - should transition to Stopped state
45 if err := player.Stop(); err != nil {57 if err := player.Stop(); err != nil {
46 t.Errorf("Stop returned error: %v", err)58 t.Errorf("Stop returned error: %v", err)
47 }59 }
60+ if state := player.State(); state != pipewire.PlayerStateStopped {
61+ t.Errorf("After Stop: expected state Stopped, got %v", state)
62+ }
48 63
49- // Test Close64+ // Test Close - should transition to Closed state
50 if err := player.Close(); err != nil {65 if err := player.Close(); err != nil {
51 t.Errorf("Close returned error: %v", err)66 t.Errorf("Close returned error: %v", err)
52 }67 }
68+ if state := player.State(); state != pipewire.PlayerStateClosed {
69+ t.Errorf("After Close: expected state Closed, got %v", state)
70+ }
53 }71 }

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