aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pipewire/core_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pipewire/core_test.go')
-rw-r--r--internal/pipewire/core_test.go56
1 files changed, 55 insertions, 1 deletions
diff --git a/internal/pipewire/core_test.go b/internal/pipewire/core_test.go
index 6d73b5c4..7785a74f 100644
--- a/internal/pipewire/core_test.go
+++ b/internal/pipewire/core_test.go
@@ -171,7 +171,7 @@ func TestCoreError(t *testing.T) {
/* padding */ 0, 0, 0, 0,
/* size: 0x1b bytes */ 0x1b, 0, 0, 0,
- /*type: String */ 8, 0, 0, 0,
+ /* type: String */ 8, 0, 0, 0,
// value: "no permission to destroy 0\x00"
0x6e, 0x6f, 0x20, 0x70,
@@ -306,6 +306,60 @@ func TestCoreGetRegistry(t *testing.T) {
}.run(t)
}
+func TestCoreCreateObject(t *testing.T) {
+ t.Parallel()
+
+ encodingTestCases[pipewire.CoreCreateObject, *pipewire.CoreCreateObject]{
+ {"sample", []byte{
+ /* size: rest of data */ 0x70, 0, 0, 0,
+ /* type: Struct */ 0xe, 0, 0, 0,
+
+ /* size: 0x13 bytes */ 0x13, 0, 0, 0,
+ /* type: String */ 8, 0, 0, 0,
+
+ // value: "spa-device-factory\x00"
+ 0x73, 0x70, 0x61, 0x2d,
+ 0x64, 0x65, 0x76, 0x69,
+ 0x63, 0x65, 0x2d, 0x66,
+ 0x61, 0x63, 0x74, 0x6f,
+ 0x72, 0x79, 0, 0,
+ 0, 0, 0, 0,
+
+ /* size: 0x1a bytes */ 0x1a, 0, 0, 0,
+ /* type: String */ 8, 0, 0, 0,
+
+ // value: "PipeWire:Interface:Device\x00"
+ 0x50, 0x69, 0x70, 0x65,
+ 0x57, 0x69, 0x72, 0x65,
+ 0x3a, 0x49, 0x6e, 0x74,
+ 0x65, 0x72, 0x66, 0x61,
+ 0x63, 0x65, 0x3a, 0x44,
+ 0x65, 0x76, 0x69, 0x63,
+ 0x65, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ /* size: 4 bytes */ 4, 0, 0, 0,
+ /* type: Int */ 4, 0, 0, 0,
+ /* value: 3 */ 3, 0, 0, 0,
+ /* padding */ 0, 0, 0, 0,
+
+ /* size */ 0, 0, 0, 0,
+ /* type: None */ 1, 0, 0, 0,
+
+ /* size: 4 bytes */ 4, 0, 0, 0,
+ /* type: Int */ 4, 0, 0, 0,
+ /* value: 0xbad */ 0xad, 0xb, 0, 0,
+ /* padding */ 0, 0, 0, 0,
+ }, pipewire.CoreCreateObject{
+ FactoryName: "spa-device-factory",
+ Type: pipewire.PW_TYPE_INTERFACE_Device,
+ Version: pipewire.PW_VERSION_FACTORY,
+ Properties: new(pipewire.SPADict),
+ NewID: 0xbad,
+ }, nil},
+ }.run(t)
+}
+
func TestRegistryGlobal(t *testing.T) {
t.Parallel()