mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2025-12-24 21:20:03 +01:00
linking tests: add non default device tests
This commit is contained in:
parent
0d0230177a
commit
de24f7a432
4 changed files with 91 additions and 6 deletions
|
|
@ -12,8 +12,15 @@ script_tester = executable('script-tester',
|
|||
)
|
||||
|
||||
test(
|
||||
'test-lua-event-policy-hooks',
|
||||
'test-linking-non-default-device-node',
|
||||
script_tester,
|
||||
args: ['policy-tests', 'policy-hooks.lua'],
|
||||
args: ['script-tests', '00-test-linking-non-default-device-node.lua'],
|
||||
env: common_env,
|
||||
)
|
||||
|
||||
test(
|
||||
'test-linking-non-default-device-node-capture',
|
||||
script_tester,
|
||||
args: ['script-tests', '01-test-linking-non-default-device-node-capture.lua'],
|
||||
env: common_env,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
-- create stream nodes
|
||||
-- create device nodes
|
||||
-- register the bottom hook
|
||||
-- push find-si-target-event
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
-- Tests linking of streams and non default devices. These devices nodes are
|
||||
-- neither defined nor default.
|
||||
|
||||
local pu = require ("policy-utils")
|
||||
local tu = require ("test-utils")
|
||||
|
||||
Script.async_activation = true
|
||||
|
||||
tu.createDeviceNode ("nondefault-device-node", "Audio/Sink")
|
||||
|
||||
tu.createStreamNode ("stream-node")
|
||||
|
||||
SimpleEventHook {
|
||||
name = "linking/test-linking",
|
||||
after = "linking/link-target",
|
||||
interests = {
|
||||
EventInterest {
|
||||
Constraint { "event.type", "=", "select-target" },
|
||||
},
|
||||
},
|
||||
execute = function (event)
|
||||
local source, om, si, si_props, si_flags, target =
|
||||
pu:unwrap_find_target_event (event)
|
||||
|
||||
if not target then
|
||||
return
|
||||
end
|
||||
|
||||
Log.info (si, string.format ("testPolicy: handling item: %s (%s) si id(%s)",
|
||||
tostring (si_props ["node.name"]),
|
||||
tostring (si_props ["node.id"]), si.id))
|
||||
|
||||
local link = pu.lookupLink (si.id, si_flags.peer_id)
|
||||
assert (link ~= nil)
|
||||
assert (si_props ["node.name"] == "stream-node")
|
||||
assert (target.properties ["node.name"] == "nondefault-device-node")
|
||||
assert ((link:get_active_features () & Feature.SessionItem.ACTIVE) ~= 0)
|
||||
|
||||
Script:finish_activation ()
|
||||
end
|
||||
}:register ()
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
-- Tests linking of streams and non default devices. These devices nodes are
|
||||
-- neither defined nor default.
|
||||
|
||||
local pu = require ("policy-utils")
|
||||
local tu = require ("test-utils")
|
||||
|
||||
Script.async_activation = true
|
||||
|
||||
tu.createDeviceNode ("nondefault-device-node", "Audio/Source")
|
||||
|
||||
tu.createStreamNode ("stream-node")
|
||||
|
||||
SimpleEventHook {
|
||||
name = "linking/test-linking",
|
||||
after = "linking/link-target",
|
||||
interests = {
|
||||
EventInterest {
|
||||
Constraint { "event.type", "=", "select-target" },
|
||||
},
|
||||
},
|
||||
execute = function (event)
|
||||
local source, om, si, si_props, si_flags, target =
|
||||
pu:unwrap_find_target_event (event)
|
||||
|
||||
if not target then
|
||||
return
|
||||
end
|
||||
|
||||
Log.info (si, string.format ("testPolicy: handling item: %s (%s) si id(%s)",
|
||||
tostring (si_props ["node.name"]),
|
||||
tostring (si_props ["node.id"]), si.id))
|
||||
|
||||
local link = pu.lookupLink (si.id, si_flags.peer_id)
|
||||
assert (link ~= nil)
|
||||
assert (si_props ["node.name"] == "stream-node")
|
||||
assert (target.properties ["node.name"] == "nondefault-device-node")
|
||||
assert ((link:get_active_features () & Feature.SessionItem.ACTIVE) ~= 0)
|
||||
|
||||
Script:finish_activation ()
|
||||
end
|
||||
}:register ()
|
||||
Loading…
Add table
Reference in a new issue