mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-08 12:48:03 +02:00
script tests: add test utils
This commit is contained in:
parent
1b09061b9d
commit
a1e79cc84b
1 changed files with 36 additions and 0 deletions
36
tests/scripts/scripts/lib/test-utils.lua
Normal file
36
tests/scripts/scripts/lib/test-utils.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
-- WirePlumber
|
||||
|
||||
-- Copyright © 2022 Collabora Ltd.
|
||||
-- @author Ashok Sidipotu <ashok.sidipotu@collabora.com>
|
||||
|
||||
-- SPDX-License-Identifier: MIT
|
||||
|
||||
-- Script is a Lua Module of common Lua test utility functions
|
||||
|
||||
local tutils = {}
|
||||
|
||||
function tutils.createNode(name, media_class, factory_name)
|
||||
local properties = {}
|
||||
properties ["node.name"] = name
|
||||
properties ["media.class"] = media_class
|
||||
properties ["factory.name"] = factory_name
|
||||
|
||||
node = Node ("adapter", properties)
|
||||
node:activate (Feature.Proxy.BOUND, function (n)
|
||||
Log.info(node, "created and activated node: "
|
||||
.. n.properties ["node.name"])
|
||||
end)
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
tutils.linkables_om = ObjectManager {
|
||||
Interest {
|
||||
type = "SiLinkable",
|
||||
Constraint { "item.factory.name", "c", "si-audio-adapter", "si-node" },
|
||||
Constraint { "active-features", "!", 0, type = "gobject" },
|
||||
}
|
||||
}
|
||||
tutils.linkables_om:activate()
|
||||
|
||||
return tutils
|
||||
Loading…
Add table
Reference in a new issue