[pulseaudio-discuss] [PATCH v2 8/9] tests: Test pa_proplist_update_info functionality

Tanu Kaskinen tanuk at iki.fi
Wed Feb 20 10:24:03 PST 2013


---
 src/tests/proplist-test.c |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/tests/proplist-test.c b/src/tests/proplist-test.c
index 6aac03c..757bbc8 100644
--- a/src/tests/proplist-test.c
+++ b/src/tests/proplist-test.c
@@ -37,6 +37,8 @@ START_TEST (proplist_test) {
     char *s, *t, *u, *v;
     const char *text;
     const char *x[] = { "foo", NULL };
+    pa_proplist_update_info *info;
+    bool changed;
 
     a = pa_proplist_new();
     fail_unless(pa_proplist_sets(a, PA_PROP_MEDIA_TITLE, "Brandenburgische Konzerte") == 0);
@@ -95,6 +97,27 @@ START_TEST (proplist_test) {
 
     pa_proplist_free(a);
     pa_modargs_free(ma);
+
+    a = pa_proplist_new();
+    pa_proplist_sets(a, "foo", "1");
+    pa_proplist_sets(a, "bar", "2");
+    info = pa_proplist_update_info_new();
+    pa_proplist_update_info_add(info,
+                                PA_PROPLIST_OPERATION_UNSET, "foo",
+                                PA_PROPLIST_OPERATION_SETS, "bar", "42",
+                                PA_PROPLIST_OPERATION_INVALID);
+    changed = pa_proplist_apply_update_info(a, info);
+
+    fail_unless(changed);
+    fail_unless(!pa_proplist_gets(a, "foo"));
+    fail_unless(pa_streq(pa_proplist_gets(a, "bar"), "42"));
+
+    changed = pa_proplist_apply_update_info(a, info);
+
+    fail_unless(!changed);
+
+    pa_proplist_update_info_free(info);
+    pa_proplist_free(a);
 }
 END_TEST
 
-- 
1.7.10.4



More information about the pulseaudio-discuss mailing list