fix unit tests

This commit is contained in:
Wim Taymans 2019-12-06 17:12:07 +01:00
parent 05565b21b1
commit 7dc8a33e3e
4 changed files with 28 additions and 5 deletions

View file

@ -972,6 +972,7 @@ struct pw_filter * pw_filter_new(struct pw_core_proxy *core_proxy, const char *n
this = &impl->this;
this->core_proxy = core_proxy;
spa_list_append(&this->core_proxy->filter_list, &this->link);
pw_core_proxy_add_listener(core_proxy,
&this->core_listener, &core_events, this);
@ -1044,6 +1045,7 @@ void pw_filter_destroy(struct pw_filter *filter)
if (filter->core_proxy) {
spa_hook_remove(&filter->core_listener);
spa_list_remove(&filter->link);
filter->core_proxy = NULL;
}
@ -1159,6 +1161,7 @@ pw_filter_connect(struct pw_filter *filter,
res = -errno;
goto error_connect;
}
spa_list_append(&filter->core_proxy->filter_list, &filter->link);
pw_core_proxy_add_listener(filter->core_proxy,
&filter->core_listener, &core_events, filter);
}

View file

@ -1091,6 +1091,7 @@ struct pw_stream * pw_stream_new(struct pw_core_proxy *core_proxy, const char *n
this = &impl->this;
this->core_proxy = core_proxy;
spa_list_append(&core_proxy->stream_list, &this->link);
pw_core_proxy_add_listener(core_proxy,
&this->core_listener, &core_events, this);
@ -1163,6 +1164,7 @@ void pw_stream_destroy(struct pw_stream *stream)
if (stream->core_proxy) {
spa_hook_remove(&stream->core_listener);
spa_list_remove(&stream->link);
stream->core_proxy = NULL;
}
@ -1372,6 +1374,7 @@ pw_stream_connect(struct pw_stream *stream,
res = -errno;
goto error_connect;
}
spa_list_append(&stream->core_proxy->stream_list, &stream->link);
pw_core_proxy_add_listener(stream->core_proxy,
&stream->core_listener, &core_events, stream);
}

View file

@ -130,7 +130,10 @@ static void test_create(void)
loop = pw_main_loop_new(NULL);
spa_assert(loop != NULL);
core = pw_core_new(pw_main_loop_get_loop(loop), NULL, 12);
core = pw_core_new(pw_main_loop_get_loop(loop),
pw_properties_new(
PW_KEY_CORE_PROFILE_MODULES, "none",
NULL), 12);
spa_assert(core != NULL);
pw_core_add_listener(core, &listener, &core_events, core);

View file

@ -134,6 +134,7 @@ static void test_create(void)
{
struct pw_main_loop *loop;
struct pw_core *core;
struct pw_core_proxy *core_proxy;
struct pw_stream *stream;
struct pw_stream_events stream_events = stream_events_error;
struct spa_hook listener = { 0, };
@ -141,8 +142,14 @@ static void test_create(void)
struct pw_time tm;
loop = pw_main_loop_new(NULL);
core = pw_core_new(pw_main_loop_get_loop(loop), NULL, 12);
stream = pw_stream_new(NULL, "test", NULL);
core = pw_core_new(pw_main_loop_get_loop(loop),
pw_properties_new(
PW_KEY_CORE_DAEMON, "1",
NULL), 12);
spa_assert(core != NULL);
core_proxy = pw_core_connect_self(core, NULL, 0);
spa_assert(core_proxy != NULL);
stream = pw_stream_new(core_proxy, "test", NULL);
spa_assert(stream != NULL);
pw_stream_add_listener(stream, &listener, &stream_events, stream);
@ -179,6 +186,7 @@ static void test_properties(void)
{
struct pw_main_loop *loop;
struct pw_core *core;
struct pw_core_proxy *core_proxy;
const struct pw_properties *props;
struct pw_stream *stream;
struct pw_stream_events stream_events = stream_events_error;
@ -186,8 +194,14 @@ static void test_properties(void)
struct spa_dict_item items[3];
loop = pw_main_loop_new(NULL);
core = pw_core_new(pw_main_loop_get_loop(loop), NULL, 0);
stream = pw_stream_new(NULL, "test",
core = pw_core_new(pw_main_loop_get_loop(loop),
pw_properties_new(
PW_KEY_CORE_DAEMON, "1",
NULL), 12);
spa_assert(core != NULL);
core_proxy = pw_core_connect_self(core, NULL, 0);
spa_assert(core_proxy != NULL);
stream = pw_stream_new(core_proxy, "test",
pw_properties_new("foo", "bar",
"biz", "fuzz",
NULL));