check/: add a test that does a bunch of state changes on elements needs some fixing...
authorThomas Vander Stichele <thomas@apestaart.org>
Wed, 24 Aug 2005 16:09:50 +0000 (16:09 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Wed, 24 Aug 2005 16:09:50 +0000 (16:09 +0000)
Original commit message from CVS:

* 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

ChangeLog
check/Makefile.am
check/generic/states.c [new file with mode: 0644]
check/states/sinks.c
gst/gstcaps.h
gst/gstplugin.c
gst/gstregistrypool.c
tests/check/Makefile.am
tests/check/generic/sinks.c
tests/check/generic/states.c [new file with mode: 0644]

index f3f238a..0bde24e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2005-08-24  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * 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  <wingo@pobox.com>
 
        * gst/gstquery.c (gst_query_new_convert): Spew if we try to
index 655d9f0..286f13f 100644 (file)
@@ -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 (file)
index 0000000..3b9b961
--- /dev/null
@@ -0,0 +1,85 @@
+/* GStreamer
+ *
+ * unit test for state changes on all elements
+ *
+ * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
+ *
+ * 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 <unistd.h>
+
+#include <gst/check/gstcheck.h>
+
+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;
+}
index 84bd9fb..95b6b02 100644 (file)
@@ -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);
index 7a74c98..dcd2616 100644 (file)
@@ -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,
index fd2798f..0cc06cb 100644 (file)
@@ -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.
index 6d064db..011bcec 100644 (file)
@@ -3,7 +3,7 @@
  *                    2000 Wim Taymans <wtay@chello.be>
  *
  * 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)
index 655d9f0..286f13f 100644 (file)
@@ -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
index 84bd9fb..95b6b02 100644 (file)
@@ -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 (file)
index 0000000..3b9b961
--- /dev/null
@@ -0,0 +1,85 @@
+/* GStreamer
+ *
+ * unit test for state changes on all elements
+ *
+ * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
+ *
+ * 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 <unistd.h>
+
+#include <gst/check/gstcheck.h>
+
+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;
+}