diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-11-29 23:23:19 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-11-29 23:25:29 +0900 |
| commit | 4fd6d6c037b30b02aff861542721b0cc40f083fe (patch) | |
| tree | 1677c4cc52e4d6d84b43d5aaebb1a5c7e61c28b8 /internal/pipewire/core_test.go | |
| parent | de3fc7ba381988c06fdbb0be8446b8e8d2e75af4 (diff) | |
internal/pipewire: implement Core::Ping, Core::Pong
I could not get the server to produce these events, however I am confident enough with the implementation to do it by hand.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire/core_test.go')
| -rw-r--r-- | internal/pipewire/core_test.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/internal/pipewire/core_test.go b/internal/pipewire/core_test.go index be3f1f94..d2a1a0d0 100644 --- a/internal/pipewire/core_test.go +++ b/internal/pipewire/core_test.go @@ -119,6 +119,31 @@ func TestCoreDone(t *testing.T) { }.run(t) } +func TestCorePing(t *testing.T) { + t.Parallel() + + encodingTestCases[pipewire.CorePing, *pipewire.CorePing]{ + // handmade sample + {"sample", []byte{ + /* size: rest of data */ 0x20, 0, 0, 0, + /* type: Struct */ pipewire.SPA_TYPE_Struct, 0, 0, 0, + + /* size: 4 bytes */ 4, 0, 0, 0, + /* type: Int */ pipewire.SPA_TYPE_Int, 0, 0, 0, + /* value: -1 */ 0xff, 0xff, 0xff, 0xff, + /* padding */ 0, 0, 0, 0, + + /* size: 4 bytes */ 4, 0, 0, 0, + /* type: Int */ pipewire.SPA_TYPE_Int, 0, 0, 0, + /* value: 0 */ 0, 0, 0, 0, + /* padding */ 0, 0, 0, 0, + }, pipewire.CorePing{ + ID: -1, + Sequence: 0, + }, nil}, + }.run(t) +} + func TestCoreBoundProps(t *testing.T) { t.Parallel() @@ -177,6 +202,31 @@ func TestCoreSync(t *testing.T) { }.run(t) } +func TestCorePong(t *testing.T) { + t.Parallel() + + encodingTestCases[pipewire.CorePong, *pipewire.CorePong]{ + // handmade sample + {"sample", []byte{ + /* size: rest of data */ 0x20, 0, 0, 0, + /* type: Struct */ pipewire.SPA_TYPE_Struct, 0, 0, 0, + + /* size: 4 bytes */ 4, 0, 0, 0, + /* type: Int */ pipewire.SPA_TYPE_Int, 0, 0, 0, + /* value: -1 */ 0xff, 0xff, 0xff, 0xff, + /* padding */ 0, 0, 0, 0, + + /* size: 4 bytes */ 4, 0, 0, 0, + /* type: Int */ pipewire.SPA_TYPE_Int, 0, 0, 0, + /* value: 0 */ 0, 0, 0, 0, + /* padding */ 0, 0, 0, 0, + }, pipewire.CorePong{ + ID: -1, + Sequence: 0, + }, nil}, + }.run(t) +} + func TestCoreGetRegistry(t *testing.T) { t.Parallel() |
