From 6570aadc78d403f27aeb8f13d819628ade443860 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Fri, 23 Sep 2005 11:41:30 +0000 Subject: [PATCH] put back source in registry. add checks for find_plugin. Original commit message from CVS: * check/gst/.cvsignore: * check/gst/gstplugin.c: (GST_START_TEST), (gst_plugin_suite): * gst/gstregistryxml.c: (load_plugin), (gst_registry_xml_save_plugin): put back source in registry. add checks for find_plugin. * testsuite/states/bin.c: (assert_state), (empty_bin), (test_adding_one_element), (main): * testsuite/states/locked.c: (main): some compile/run fixes --- ChangeLog | 12 ++++++++++++ check/gst/.gitignore | 1 + check/gst/gstplugin.c | 25 +++++++++++++++++++++++-- gst/gstregistryxml.c | 5 +++++ tests/check/gst/.gitignore | 1 + tests/check/gst/gstplugin.c | 25 +++++++++++++++++++++++-- tests/old/testsuite/states/bin.c | 24 ++++++++++++++---------- tests/old/testsuite/states/locked.c | 3 ++- testsuite/states/bin.c | 24 ++++++++++++++---------- testsuite/states/locked.c | 3 ++- 10 files changed, 97 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 80c7179..d98a90b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-09-23 Thomas Vander Stichele + + * check/gst/.cvsignore: + * check/gst/gstplugin.c: (GST_START_TEST), (gst_plugin_suite): + * gst/gstregistryxml.c: (load_plugin), + (gst_registry_xml_save_plugin): + put back source in registry. add checks for find_plugin. + * testsuite/states/bin.c: (assert_state), (empty_bin), + (test_adding_one_element), (main): + * testsuite/states/locked.c: (main): + some compile/run fixes + 2005-09-22 Thomas Vander Stichele * check/gst/gstvalue.c: (GST_START_TEST): diff --git a/check/gst/.gitignore b/check/gst/.gitignore index e95d4f1..7f95b94 100644 --- a/check/gst/.gitignore +++ b/check/gst/.gitignore @@ -18,4 +18,5 @@ gstplugin gststructure gstsystemclock gsttag +gstutils gstvalue diff --git a/check/gst/gstplugin.c b/check/gst/gstplugin.c index 366c572..979bdc4 100644 --- a/check/gst/gstplugin.c +++ b/check/gst/gstplugin.c @@ -69,8 +69,7 @@ GST_START_TEST (test_registry) for (g = registry->plugins; g; g = g->next) { GstPlugin *plugin = GST_PLUGIN (g->data); - fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 1, - "Plugin in registry should have refcount of 1"); + ASSERT_OBJECT_REFCOUNT (plugin, "plugin in registry", 1); GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (plugin), plugin->desc.name); } @@ -139,6 +138,27 @@ GST_START_TEST (test_registry_get_plugin_list) GST_END_TEST; +GST_START_TEST (test_find_plugin) +{ + GstPlugin *plugin; + + plugin = gst_registry_find_plugin (gst_registry_get_default (), + "gstelements"); + fail_if (plugin == NULL, "Failed to find gstelements plugin"); + ASSERT_OBJECT_REFCOUNT (plugin, "plugin", 2); + + fail_unless_equals_string (plugin->desc.version, VERSION); + fail_unless_equals_string (plugin->desc.license, "LGPL"); + fail_unless_equals_string (plugin->desc.source, "gstreamer"); + fail_unless_equals_string (plugin->desc.package, GST_PACKAGE); + fail_unless_equals_string (plugin->desc.origin, GST_ORIGIN); + + gst_object_unref (plugin); +} + +GST_END_TEST; + + GST_START_TEST (test_find_feature) { GstPluginFeature *feature; @@ -241,6 +261,7 @@ gst_plugin_suite (void) tcase_add_test (tc_chain, test_registry); tcase_add_test (tc_chain, test_load_gstelements); tcase_add_test (tc_chain, test_registry_get_plugin_list); + tcase_add_test (tc_chain, test_find_plugin); tcase_add_test (tc_chain, test_find_feature); tcase_add_test (tc_chain, test_find_element); //tcase_add_test (tc_chain, test_typefind); diff --git a/gst/gstregistryxml.c b/gst/gstregistryxml.c index 852dfd2..a53cb64 100644 --- a/gst/gstregistryxml.c +++ b/gst/gstregistryxml.c @@ -662,6 +662,10 @@ load_plugin (xmlTextReaderPtr reader, GList ** feature_list) if (!read_string (reader, &plugin->desc.license)) break; GST_DEBUG ("license %s", plugin->desc.license); + } else if (g_str_equal (tag, "source")) { + if (!read_string (reader, &plugin->desc.source)) + break; + GST_DEBUG ("source %s", plugin->desc.source); } else if (g_str_equal (tag, "package")) { if (!read_string (reader, &plugin->desc.package)) break; @@ -960,6 +964,7 @@ gst_registry_xml_save_plugin (GstRegistry * registry, GstPlugin * plugin) PUT_ESCAPED (" ", "m32p", s); PUT_ESCAPED (" ", "version", plugin->desc.version); PUT_ESCAPED (" ", "license", plugin->desc.license); + PUT_ESCAPED (" ", "source", plugin->desc.source); PUT_ESCAPED (" ", "package", plugin->desc.package); PUT_ESCAPED (" ", "origin", plugin->desc.origin); diff --git a/tests/check/gst/.gitignore b/tests/check/gst/.gitignore index e95d4f1..7f95b94 100644 --- a/tests/check/gst/.gitignore +++ b/tests/check/gst/.gitignore @@ -18,4 +18,5 @@ gstplugin gststructure gstsystemclock gsttag +gstutils gstvalue diff --git a/tests/check/gst/gstplugin.c b/tests/check/gst/gstplugin.c index 366c572..979bdc4 100644 --- a/tests/check/gst/gstplugin.c +++ b/tests/check/gst/gstplugin.c @@ -69,8 +69,7 @@ GST_START_TEST (test_registry) for (g = registry->plugins; g; g = g->next) { GstPlugin *plugin = GST_PLUGIN (g->data); - fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 1, - "Plugin in registry should have refcount of 1"); + ASSERT_OBJECT_REFCOUNT (plugin, "plugin in registry", 1); GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (plugin), plugin->desc.name); } @@ -139,6 +138,27 @@ GST_START_TEST (test_registry_get_plugin_list) GST_END_TEST; +GST_START_TEST (test_find_plugin) +{ + GstPlugin *plugin; + + plugin = gst_registry_find_plugin (gst_registry_get_default (), + "gstelements"); + fail_if (plugin == NULL, "Failed to find gstelements plugin"); + ASSERT_OBJECT_REFCOUNT (plugin, "plugin", 2); + + fail_unless_equals_string (plugin->desc.version, VERSION); + fail_unless_equals_string (plugin->desc.license, "LGPL"); + fail_unless_equals_string (plugin->desc.source, "gstreamer"); + fail_unless_equals_string (plugin->desc.package, GST_PACKAGE); + fail_unless_equals_string (plugin->desc.origin, GST_ORIGIN); + + gst_object_unref (plugin); +} + +GST_END_TEST; + + GST_START_TEST (test_find_feature) { GstPluginFeature *feature; @@ -241,6 +261,7 @@ gst_plugin_suite (void) tcase_add_test (tc_chain, test_registry); tcase_add_test (tc_chain, test_load_gstelements); tcase_add_test (tc_chain, test_registry_get_plugin_list); + tcase_add_test (tc_chain, test_find_plugin); tcase_add_test (tc_chain, test_find_feature); tcase_add_test (tc_chain, test_find_element); //tcase_add_test (tc_chain, test_typefind); diff --git a/tests/old/testsuite/states/bin.c b/tests/old/testsuite/states/bin.c index efcc727..44af618 100644 --- a/tests/old/testsuite/states/bin.c +++ b/tests/old/testsuite/states/bin.c @@ -26,7 +26,10 @@ static void assert_state (GstElement * element, GstState state) { - if (gst_element_get_state (element) != state) { + GstState current, pending; + + gst_element_get_state (element, ¤t, &pending, NULL); + if (current != state) { g_printerr ("%s: state is %s instead of %s", GST_OBJECT_NAME (element), gst_element_state_get_name (GST_STATE (element)), @@ -59,15 +62,16 @@ empty_bin (gchar * bin_name) * GST_STATE_CHANGE_ASYNC */ GstElement *bin = gst_element_factory_make (bin_name, NULL); + g_assert (bin); /* obvious */ assert_state (bin, GST_STATE_NULL); /* see above */ - assert_state_change (bin, GST_STATE_READY, GST_STATE_CHANGE_ASYNC, - GST_STATE_NULL); - assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_CHANGE_ASYNC, - GST_STATE_NULL); - assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC, - GST_STATE_NULL); + assert_state_change (bin, GST_STATE_READY, GST_STATE_CHANGE_SUCCESS, + GST_STATE_READY); + assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_CHANGE_SUCCESS, + GST_STATE_PAUSED); + assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_CHANGE_SUCCESS, + GST_STATE_PLAYING); } static void @@ -79,9 +83,10 @@ test_adding_one_element (GstElement * bin) GST_STATE_PLAYING, GST_STATE_PAUSED, GST_STATE_READY, GST_STATE_NULL }; GstElement *test = gst_element_factory_make ("identity", NULL); - GstState bin_state = gst_element_get_state (bin); + GstState bin_state; gint i; + gst_element_get_state (bin, &bin_state, NULL, NULL); g_assert (test); gst_object_ref (test); assert_state (test, GST_STATE_NULL); @@ -142,12 +147,11 @@ main (gint argc, gchar * argv[]) /* test behaviour of empty bins */ empty_bin ("bin"); - empty_bin ("thread"); empty_bin ("pipeline"); + g_print ("how far\n"); /* test behaviour of adding/removing elements to/from all core bin types */ test_element_in_bin ("bin"); - test_element_in_bin ("thread"); test_element_in_bin ("pipeline"); return 0; diff --git a/tests/old/testsuite/states/locked.c b/tests/old/testsuite/states/locked.c index 94ee30c..899ce63 100644 --- a/tests/old/testsuite/states/locked.c +++ b/tests/old/testsuite/states/locked.c @@ -52,7 +52,8 @@ main (gint argc, gchar * argv[]) loop = g_main_loop_new (NULL, FALSE); bus = gst_element_get_bus (pipeline); - gst_bus_add_watch (bus, (GstBusHandler) message_received, pipeline); + gst_bus_add_watch (bus, GST_MESSAGE_EOS, (GstBusFunc) message_received, + (gpointer) pipeline); gst_object_unref (bus); fakesrc1 = gst_element_factory_make ("fakesrc", "fakesrc1"); diff --git a/testsuite/states/bin.c b/testsuite/states/bin.c index efcc727..44af618 100644 --- a/testsuite/states/bin.c +++ b/testsuite/states/bin.c @@ -26,7 +26,10 @@ static void assert_state (GstElement * element, GstState state) { - if (gst_element_get_state (element) != state) { + GstState current, pending; + + gst_element_get_state (element, ¤t, &pending, NULL); + if (current != state) { g_printerr ("%s: state is %s instead of %s", GST_OBJECT_NAME (element), gst_element_state_get_name (GST_STATE (element)), @@ -59,15 +62,16 @@ empty_bin (gchar * bin_name) * GST_STATE_CHANGE_ASYNC */ GstElement *bin = gst_element_factory_make (bin_name, NULL); + g_assert (bin); /* obvious */ assert_state (bin, GST_STATE_NULL); /* see above */ - assert_state_change (bin, GST_STATE_READY, GST_STATE_CHANGE_ASYNC, - GST_STATE_NULL); - assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_CHANGE_ASYNC, - GST_STATE_NULL); - assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC, - GST_STATE_NULL); + assert_state_change (bin, GST_STATE_READY, GST_STATE_CHANGE_SUCCESS, + GST_STATE_READY); + assert_state_change (bin, GST_STATE_PAUSED, GST_STATE_CHANGE_SUCCESS, + GST_STATE_PAUSED); + assert_state_change (bin, GST_STATE_PLAYING, GST_STATE_CHANGE_SUCCESS, + GST_STATE_PLAYING); } static void @@ -79,9 +83,10 @@ test_adding_one_element (GstElement * bin) GST_STATE_PLAYING, GST_STATE_PAUSED, GST_STATE_READY, GST_STATE_NULL }; GstElement *test = gst_element_factory_make ("identity", NULL); - GstState bin_state = gst_element_get_state (bin); + GstState bin_state; gint i; + gst_element_get_state (bin, &bin_state, NULL, NULL); g_assert (test); gst_object_ref (test); assert_state (test, GST_STATE_NULL); @@ -142,12 +147,11 @@ main (gint argc, gchar * argv[]) /* test behaviour of empty bins */ empty_bin ("bin"); - empty_bin ("thread"); empty_bin ("pipeline"); + g_print ("how far\n"); /* test behaviour of adding/removing elements to/from all core bin types */ test_element_in_bin ("bin"); - test_element_in_bin ("thread"); test_element_in_bin ("pipeline"); return 0; diff --git a/testsuite/states/locked.c b/testsuite/states/locked.c index 94ee30c..899ce63 100644 --- a/testsuite/states/locked.c +++ b/testsuite/states/locked.c @@ -52,7 +52,8 @@ main (gint argc, gchar * argv[]) loop = g_main_loop_new (NULL, FALSE); bus = gst_element_get_bus (pipeline); - gst_bus_add_watch (bus, (GstBusHandler) message_received, pipeline); + gst_bus_add_watch (bus, GST_MESSAGE_EOS, (GstBusFunc) message_received, + (gpointer) pipeline); gst_object_unref (bus); fakesrc1 = gst_element_factory_make ("fakesrc", "fakesrc1"); -- 2.7.4