aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pipewire/core_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-11-30 01:39:39 +0900
committerOphestra <cat@gensokyo.uk>2025-11-30 01:39:39 +0900
commit3d4c7cdd9e82d1cc48e2564f4e5a569424a1819b (patch)
tree9d555cd3be52910e5dc05a352e60e3d631f8f31d /internal/pipewire/core_test.go
parent4fd6d6c037b30b02aff861542721b0cc40f083fe (diff)
internal/pipewire: implement Core::Error
Sample was captured from pw-cli. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire/core_test.go')
-rw-r--r--internal/pipewire/core_test.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/internal/pipewire/core_test.go b/internal/pipewire/core_test.go
index d2a1a0d0..9771eff3 100644
--- a/internal/pipewire/core_test.go
+++ b/internal/pipewire/core_test.go
@@ -144,6 +144,52 @@ func TestCorePing(t *testing.T) {
}.run(t)
}
+func TestCoreError(t *testing.T) {
+ t.Parallel()
+
+ encodingTestCases[pipewire.CoreError, *pipewire.CoreError]{
+ // captured from pw-cli
+ {"pw-cli", []byte{
+ /* size: rest of data */ 0x58, 0, 0, 0,
+ /* type: Struct */ 0xe, 0, 0, 0,
+
+ /* size: 4 bytes */ 4, 0, 0, 0,
+ /* type: Int */ 4, 0, 0, 0,
+ /* value: 2 */ 2, 0, 0, 0,
+ /* padding */ 0, 0, 0, 0,
+
+ /* size: 4 bytes */ 4, 0, 0, 0,
+ /* type: Int */ 4, 0, 0, 0,
+ /* value: 0x67 */ 0x67, 0, 0, 0,
+ /* padding */ 0, 0, 0, 0,
+
+ /* size: 4 bytes */ 4, 0, 0, 0,
+ /* type: Int */ 4, 0, 0, 0,
+ /* value: -1 */ 0xff, 0xff, 0xff, 0xff,
+ /* padding */ 0, 0, 0, 0,
+
+ /* size: 0x1b bytes */ 0x1b, 0, 0, 0,
+ /*type: String*/ 8, 0, 0, 0,
+
+ // value: "no permission to destroy 0\x00"
+ 0x6e, 0x6f, 0x20, 0x70,
+ 0x65, 0x72, 0x6d, 0x69,
+ 0x73, 0x73, 0x69, 0x6f,
+ 0x6e, 0x20, 0x74, 0x6f,
+ 0x20, 0x64, 0x65, 0x73,
+ 0x74, 0x72, 0x6f, 0x79,
+ 0x20, 0x30, 0,
+
+ /* padding */ 0, 0, 0, 0, 0,
+ }, pipewire.CoreError{
+ ID: 2,
+ Sequence: 0x67,
+ Result: -1,
+ Message: "no permission to destroy 0",
+ }, nil},
+ }.run(t)
+}
+
func TestCoreBoundProps(t *testing.T) {
t.Parallel()