Implement mm_filter_unserialize (), and write some tests for the
[mmediamanager.git] / test / clients / test-serialize.c
blob88d26eefbadba60c01a148ec0c42550ebf638fe7
1 #include <libmmanager/mm.h>
3 int main (int argc, char ** argv)
5 MMFilter *filter, *unserialized;
6 MMFilterParam *fp;
7 MMAttribute *attr;
8 GValue *val;
9 MMAttributeManager *am;
10 char * serialized;
12 g_type_init ();
14 am = mm_attribute_base_manager_get ();
15 filter = mm_filter_new ();
17 attr = mm_attribute_manager_lookup_attribute (am, "base::uri");
18 val = mm_create_gvalue_for_attribute (attr);
19 g_value_set_string (val, "file:///foo");
20 fp = mm_filter_param_new (attr, val, MM_COMP_EQUAL);
21 mm_filter_add_filtering_param (filter, fp);
22 g_object_unref (fp);
23 g_free (val);
25 attr = mm_attribute_manager_lookup_attribute (am, "base::name");
26 val = mm_create_gvalue_for_attribute (attr);
27 g_value_set_string (val, "Pippo");
28 fp = mm_filter_param_new (attr, val, MM_COMP_GREATER);
29 mm_filter_add_filtering_param (filter, fp);
30 g_object_unref (fp);
31 g_free (val);
33 serialized = mm_filter_serialize (filter);
34 g_print ("serialized filter \n%s\n", serialized);
36 unserialized = mm_filter_unserialize (serialized);
38 g_free (serialized);
39 g_object_unref (filter);
41 return 0;