diff --git a/ChangeLog b/ChangeLog index f3f238a529..0bde24e4e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2005-08-24 Thomas Vander Stichele + + * check/Makefile.am: + * check/generic/states.c: (GST_START_TEST), (states_suite), (main): + add a test that does a bunch of state changes on elements + needs some fixing for valgrind + * check/states/sinks.c: (gst_object_suite): + whitespace + * gst/gstcaps.h: + add prototype for gst_caps_is_equal_fixed + * gst/gstplugin.c: + * gst/gstregistrypool.c: + doc fixes + 2005-08-24 Andy Wingo * gst/gstquery.c (gst_query_new_convert): Spew if we try to diff --git a/check/Makefile.am b/check/Makefile.am index 655d9f0b21..286f13f7e8 100644 --- a/check/Makefile.am +++ b/check/Makefile.am @@ -55,6 +55,7 @@ check_PROGRAMS = \ pipelines/simple_launch_lines \ pipelines/cleanup \ states/sinks \ + generic/states \ gst-libs/controller \ gst-libs/gdp @@ -82,6 +83,7 @@ gst_libs_controller_LDADD = $(GST_OBJ_LIBS) \ # valgrind testing # these just need valgrind fixing, period TESTS_TO_FIX = \ + generic/states \ gst-libs/controller \ pipelines/cleanup \ pipelines/simple_launch_lines diff --git a/check/generic/states.c b/check/generic/states.c new file mode 100644 index 0000000000..3b9b961c9f --- /dev/null +++ b/check/generic/states.c @@ -0,0 +1,85 @@ +/* GStreamer + * + * unit test for state changes on all elements + * + * Copyright (C) <2005> Thomas Vander Stichele + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include + +#include + +GST_START_TEST (test_state_changes) +{ + GstElement *element; + GList *features, *f; + + features = gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY); + + for (f = features; f; f = f->next) { + GstPluginFeature *feature = f->data; + const gchar *name = gst_plugin_feature_get_name (feature); + + GST_DEBUG ("testing element %s", name); + element = gst_element_factory_make (name, name); + + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_PLAYING); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_NULL); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_PLAYING); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (element)); + } +} + +GST_END_TEST; + +Suite * +states_suite (void) +{ + Suite *s = suite_create ("states"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_state_changes); + + return s; +} + +int +main (int argc, char **argv) +{ + int nf; + + Suite *s = states_suite (); + SRunner *sr = srunner_create (s); + + gst_check_init (&argc, &argv); + + srunner_run_all (sr, CK_NORMAL); + nf = srunner_ntests_failed (sr); + srunner_free (sr); + + return nf; +} diff --git a/check/states/sinks.c b/check/states/sinks.c index 84bd9fbecf..95b6b02ea8 100644 --- a/check/states/sinks.c +++ b/check/states/sinks.c @@ -180,16 +180,16 @@ GST_START_TEST (test_livesrc_sink) fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); } -GST_END_TEST +GST_END_TEST; + + /* test: try changing state of sinks */ - Suite * gst_object_suite (void) +Suite * +gst_object_suite (void) { Suite *s = suite_create ("Sinks"); TCase *tc_chain = tcase_create ("general"); - /* turn off timeout */ - tcase_set_timeout (tc_chain, 60); - suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_sink); tcase_add_test (tc_chain, test_src_sink); diff --git a/gst/gstcaps.h b/gst/gstcaps.h index 7a74c98d8e..dcd2616113 100644 --- a/gst/gstcaps.h +++ b/gst/gstcaps.h @@ -125,6 +125,9 @@ gboolean gst_caps_is_subset (const GstCaps *subset, const GstCaps *superset); gboolean gst_caps_is_equal (const GstCaps *caps1, const GstCaps *caps2); +gboolean gst_caps_is_equal_fixed (const GstCaps * caps1, + const GstCaps * caps2); + /* operations */ GstCaps * gst_caps_intersect (const GstCaps *caps1, diff --git a/gst/gstplugin.c b/gst/gstplugin.c index fd2798ff34..0cc06cbf7d 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -701,7 +701,7 @@ gst_plugin_is_loaded (GstPlugin * plugin) * @user_data: user data passed to the filter function * * Runs a filter against all plugin features and returns a GList with - * the results. If the first flag is set, only the first match is + * the results. If the first flag is set, only the first match is * returned (as a list with a single object). * * Returns: a GList of features, g_list_free after use. @@ -740,15 +740,15 @@ _feature_filter (GstPlugin * plugin, gpointer user_data) } /** - * gst_plugin_list_feature_list: - * @list: a list of plugins to query - * @filter: the filter to use + * gst_plugin_list_feature_filter: + * @list: a #GList of plugins to query + * @filter: the filter function to use * @first: only return first match * @user_data: user data passed to the filter function * * Runs a filter against all plugin features of the plugins in the given - * list and returns a GList with the results. - * If the first flag is set, only the first match is + * list and returns a GList with the results. + * If the first flag is set, only the first match is * returned (as a list with a single object). * * Returns: a GList of features, g_list_free after use. diff --git a/gst/gstregistrypool.c b/gst/gstregistrypool.c index 6d064db0b2..011bcec148 100644 --- a/gst/gstregistrypool.c +++ b/gst/gstregistrypool.c @@ -3,7 +3,7 @@ * 2000 Wim Taymans * * gstregistry.c: handle registry - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either @@ -130,8 +130,8 @@ gst_registry_pool_load_all (void) * gst_registry_pool_plugin_list: * * Get a list of all plugins in the pool. - * - * Returns: a GList of plugins, g_list_free after use. + * + * Returns: a newly allocated GList of #GstPlugin. */ GList * gst_registry_pool_plugin_list (void) @@ -146,10 +146,10 @@ gst_registry_pool_plugin_list (void) * @user_data: user data passed to the filter function * * Runs a filter against all plugins in all registries and returns a GList with - * the results. If the first flag is set, only the first match is + * the results. If the first flag is set, only the first match is * returned (as a list with a single object). * - * Returns: a GList of plugins, g_list_free after use. + * Returns: a newly allocated GList of #GstPlugin. */ GList * gst_registry_pool_plugin_filter (GstPluginFilter filter, gboolean first, @@ -190,8 +190,8 @@ gst_registry_pool_plugin_filter (GstPluginFilter filter, gboolean first, * @type: the type of the features to list. * * Get a list of all pluginfeatures of the given type in the pool. - * - * Returns: a GList of pluginfeatures, g_list_free after use. + * + * Returns: a newly allocated #GList of #GstPluginFeature. */ GList * gst_registry_pool_feature_list (GType type) diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 655d9f0b21..286f13f7e8 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -55,6 +55,7 @@ check_PROGRAMS = \ pipelines/simple_launch_lines \ pipelines/cleanup \ states/sinks \ + generic/states \ gst-libs/controller \ gst-libs/gdp @@ -82,6 +83,7 @@ gst_libs_controller_LDADD = $(GST_OBJ_LIBS) \ # valgrind testing # these just need valgrind fixing, period TESTS_TO_FIX = \ + generic/states \ gst-libs/controller \ pipelines/cleanup \ pipelines/simple_launch_lines diff --git a/tests/check/generic/sinks.c b/tests/check/generic/sinks.c index 84bd9fbecf..95b6b02ea8 100644 --- a/tests/check/generic/sinks.c +++ b/tests/check/generic/sinks.c @@ -180,16 +180,16 @@ GST_START_TEST (test_livesrc_sink) fail_unless (pending == GST_STATE_VOID_PENDING, "not playing"); } -GST_END_TEST +GST_END_TEST; + + /* test: try changing state of sinks */ - Suite * gst_object_suite (void) +Suite * +gst_object_suite (void) { Suite *s = suite_create ("Sinks"); TCase *tc_chain = tcase_create ("general"); - /* turn off timeout */ - tcase_set_timeout (tc_chain, 60); - suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_sink); tcase_add_test (tc_chain, test_src_sink); diff --git a/tests/check/generic/states.c b/tests/check/generic/states.c new file mode 100644 index 0000000000..3b9b961c9f --- /dev/null +++ b/tests/check/generic/states.c @@ -0,0 +1,85 @@ +/* GStreamer + * + * unit test for state changes on all elements + * + * Copyright (C) <2005> Thomas Vander Stichele + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include + +#include + +GST_START_TEST (test_state_changes) +{ + GstElement *element; + GList *features, *f; + + features = gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY); + + for (f = features; f; f = f->next) { + GstPluginFeature *feature = f->data; + const gchar *name = gst_plugin_feature_get_name (feature); + + GST_DEBUG ("testing element %s", name); + element = gst_element_factory_make (name, name); + + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_PLAYING); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_NULL); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_PLAYING); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (element)); + } +} + +GST_END_TEST; + +Suite * +states_suite (void) +{ + Suite *s = suite_create ("states"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_state_changes); + + return s; +} + +int +main (int argc, char **argv) +{ + int nf; + + Suite *s = states_suite (); + SRunner *sr = srunner_create (s); + + gst_check_init (&argc, &argv); + + srunner_run_all (sr, CK_NORMAL); + nf = srunner_ntests_failed (sr); + srunner_free (sr); + + return nf; +}