script-tester: pass the fixture pointer to plugin
This commit is contained in:

committed by
Julian Bouzas

parent
c9e55e6565
commit
d4d4e23e9c
@@ -16,7 +16,7 @@ struct _WpScriptTester
|
|||||||
{
|
{
|
||||||
WpPlugin parent;
|
WpPlugin parent;
|
||||||
struct pw_stream *stream;
|
struct pw_stream *stream;
|
||||||
GWeakRef client_core;
|
ScriptRunnerFixture *test_fixture;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -26,7 +26,7 @@ enum {
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_EXPORT_CORE,
|
PROP_TEST_FIXTURE,
|
||||||
PROP_SUPPORTED_FEATURES,
|
PROP_SUPPORTED_FEATURES,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ static void
|
|||||||
wp_script_tester_create_stream (WpScriptTester *self, const gchar *stream_type,
|
wp_script_tester_create_stream (WpScriptTester *self, const gchar *stream_type,
|
||||||
WpProperties *stream_props)
|
WpProperties *stream_props)
|
||||||
{
|
{
|
||||||
g_autoptr (WpCore) core = g_weak_ref_get (&self->client_core);
|
ScriptRunnerFixture *f = self->test_fixture;
|
||||||
WpProperties *props = NULL;
|
WpProperties *props = NULL;
|
||||||
const struct spa_pod *params [1];
|
const struct spa_pod *params [1];
|
||||||
uint8_t buffer [1024];
|
uint8_t buffer [1024];
|
||||||
@@ -76,7 +76,7 @@ wp_script_tester_create_stream (WpScriptTester *self, const gchar *stream_type,
|
|||||||
wp_properties_add (props, stream_props);
|
wp_properties_add (props, stream_props);
|
||||||
|
|
||||||
self->stream = pw_stream_new (
|
self->stream = pw_stream_new (
|
||||||
wp_core_get_pw_core (core),
|
wp_core_get_pw_core (f->base.client_core),
|
||||||
"stream-node", wp_properties_to_pw_properties (props));
|
"stream-node", wp_properties_to_pw_properties (props));
|
||||||
|
|
||||||
params [0] = spa_format_audio_raw_build (&b, SPA_PARAM_EnumFormat,
|
params [0] = spa_format_audio_raw_build (&b, SPA_PARAM_EnumFormat,
|
||||||
@@ -100,8 +100,8 @@ wp_script_tester_set_property (GObject *object, guint property_id,
|
|||||||
WpScriptTester *self = WP_SCRIPT_TESTER (object);
|
WpScriptTester *self = WP_SCRIPT_TESTER (object);
|
||||||
|
|
||||||
switch (property_id) {
|
switch (property_id) {
|
||||||
case PROP_EXPORT_CORE:
|
case PROP_TEST_FIXTURE:
|
||||||
g_weak_ref_set (&self->client_core, g_value_get_object (value));
|
self->test_fixture = g_value_get_pointer (value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
@@ -116,8 +116,8 @@ wp_script_tester_get_property (GObject *object, guint property_id, GValue *value
|
|||||||
WpScriptTester *self = WP_SCRIPT_TESTER (object);
|
WpScriptTester *self = WP_SCRIPT_TESTER (object);
|
||||||
|
|
||||||
switch (property_id) {
|
switch (property_id) {
|
||||||
case PROP_EXPORT_CORE:
|
case PROP_TEST_FIXTURE:
|
||||||
g_value_take_object (value, g_weak_ref_get (&self->client_core));
|
g_value_set_pointer (value, self->test_fixture);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
@@ -132,8 +132,8 @@ wp_script_tester_class_init (WpScriptTesterClass *klass)
|
|||||||
object_class->get_property = wp_script_tester_get_property;
|
object_class->get_property = wp_script_tester_get_property;
|
||||||
object_class->set_property = wp_script_tester_set_property;
|
object_class->set_property = wp_script_tester_set_property;
|
||||||
|
|
||||||
g_object_class_install_property (object_class, PROP_EXPORT_CORE,
|
g_object_class_install_property (object_class, PROP_TEST_FIXTURE,
|
||||||
g_param_spec_object ("export-core", "export-core", "The Export WpCore", WP_TYPE_CORE,
|
g_param_spec_pointer ("test-fixture", "test-fixture", "The Test Fixture",
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
signals [ACTION_CREATE_STREAM_NODE] = g_signal_new_class_handler (
|
signals [ACTION_CREATE_STREAM_NODE] = g_signal_new_class_handler (
|
||||||
@@ -237,7 +237,6 @@ load_components (ScriptRunnerFixture *f, gconstpointer argv)
|
|||||||
|
|
||||||
g_assert_cmpint (pw_context_add_spa_lib (f->base.server.context,
|
g_assert_cmpint (pw_context_add_spa_lib (f->base.server.context,
|
||||||
"audiotestsrc", "audiotestsrc/libspa-audiotestsrc"), == , 0);
|
"audiotestsrc", "audiotestsrc/libspa-audiotestsrc"), == , 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,10 +255,11 @@ static void
|
|||||||
script_tests_setup (ScriptRunnerFixture *f, gconstpointer data)
|
script_tests_setup (ScriptRunnerFixture *f, gconstpointer data)
|
||||||
{
|
{
|
||||||
base_tests_setup (f, data);
|
base_tests_setup (f, data);
|
||||||
|
|
||||||
f->plugin = g_object_new (wp_script_tester_get_type (),
|
f->plugin = g_object_new (wp_script_tester_get_type (),
|
||||||
"name", "script-tester",
|
"name", "script-tester",
|
||||||
"core", f->base.core, /*to register plugin*/
|
"core", f->base.core, /*to register plugin*/
|
||||||
"export-core", f->base.client_core, /*to export the created node*/
|
"test-fixture", f,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
wp_plugin_register ((WpPlugin *)f->plugin);
|
wp_plugin_register ((WpPlugin *)f->plugin);
|
||||||
|
Reference in New Issue
Block a user