From: Sebastian Dröge Date: Mon, 9 Nov 2009 17:11:42 +0000 (+0100) Subject: cddabasesrc: Add unit test for property settings X-Git-Tag: RELEASE-0.10.26~218 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d086c05c1f08ac37c01fb18189c8d8930ee9ce4a;p=platform%2Fupstream%2Fgst-plugins-base.git cddabasesrc: Add unit test for property settings Also includes a regression test for bug #601104. --- diff --git a/tests/check/libs/cddabasesrc.c b/tests/check/libs/cddabasesrc.c index b93ee38..33685d8 100644 --- a/tests/check/libs/cddabasesrc.c +++ b/tests/check/libs/cddabasesrc.c @@ -460,6 +460,46 @@ GST_START_TEST (test_uri_parsing) GST_END_TEST; +GST_START_TEST (test_properties) +{ + GstElement *foosrc; + gchar *device; + guint track; + + fail_unless (gst_element_register (NULL, "cdfoosrc", GST_RANK_SECONDARY, + GST_TYPE_CD_FOO_SRC)); + + foosrc = gst_element_factory_make ("cdfoosrc", "cdfoosrc"); + + g_object_set (foosrc, "device", "/dev/cdrom", NULL); + g_object_get (foosrc, "device", &device, "track", &track, NULL); + fail_unless (g_str_equal (device, "/dev/cdrom")); + fail_unless_equals_int (track, 1); + g_free (device); + + g_object_set (foosrc, "device", "/dev/cdrom1", "track", 17, NULL); + g_object_get (foosrc, "device", &device, "track", &track, NULL); + fail_unless (g_str_equal (device, "/dev/cdrom1")); + fail_unless_equals_int (track, 17); + g_free (device); + + g_object_set (foosrc, "track", 17, "device", "/dev/cdrom1", NULL); + g_object_get (foosrc, "device", &device, "track", &track, NULL); + fail_unless (g_str_equal (device, "/dev/cdrom1")); + fail_unless_equals_int (track, 17); + g_free (device); + + g_object_set (foosrc, "track", 12, NULL); + g_object_get (foosrc, "device", &device, "track", &track, NULL); + fail_unless (g_str_equal (device, "/dev/cdrom1")); + fail_unless_equals_int (track, 12); + g_free (device); + + gst_object_unref (foosrc); +} + +GST_END_TEST; + static Suite * cddabasesrc_suite (void) { @@ -470,6 +510,7 @@ cddabasesrc_suite (void) tcase_add_test (tc_chain, test_discid_calculations); tcase_add_test (tc_chain, test_buffer_timestamps); tcase_add_test (tc_chain, test_uri_parsing); + tcase_add_test (tc_chain, test_properties); return s; }