summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenjamin Otte <otte@gnome.org>2004-05-25 19:52:02 +0000
committerBenjamin Otte <otte@gnome.org>2004-05-25 19:52:02 +0000
commit7193393c18827036c3083b91165ec0c5adb5456e (patch)
treefe264cfcb90ed76500f930c6f79f1c377e311764 /tests
parentaf9e417b2cf23276b883d298511274d0dd872a3e (diff)
gst/gstcaps.c: don't print error messages when there is no error
Original commit message from CVS: * gst/gstcaps.c: (gst_caps_structure_simplify): don't print error messages when there is no error * gst/gstvalue.c: (gst_value_compare_int_range): compare the second value, too * testsuite/caps/Makefile.am: * testsuite/caps/random.c: (assert_on_error), (main): add tests to make sure the two things above are checked for
Diffstat (limited to 'tests')
-rw-r--r--tests/old/testsuite/caps/Makefile.am5
-rw-r--r--tests/old/testsuite/caps/random.c69
2 files changed, 73 insertions, 1 deletions
diff --git a/tests/old/testsuite/caps/Makefile.am b/tests/old/testsuite/caps/Makefile.am
index a934d86b8..f9bf98978 100644
--- a/tests/old/testsuite/caps/Makefile.am
+++ b/tests/old/testsuite/caps/Makefile.am
@@ -21,7 +21,8 @@ tests_pass = \
renegotiate \
subtract \
sets \
- simplify
+ simplify \
+ random
EXTRA_DIST = caps_strings
@@ -61,3 +62,5 @@ simplify_LDADD = $(GST_OBJ_LIBS)
simplify_CFLAGS = $(GST_OBJ_CFLAGS) $(XML_CFLAGS)
renegotiate_LDADD = $(GST_OBJ_LIBS)
renegotiate_CFLAGS = $(GST_OBJ_CFLAGS) $(XML_CFLAGS)
+random_LDADD = $(GST_OBJ_LIBS)
+random_CFLAGS = $(GST_OBJ_CFLAGS) $(XML_CFLAGS)
diff --git a/tests/old/testsuite/caps/random.c b/tests/old/testsuite/caps/random.c
new file mode 100644
index 000000000..6b10abc90
--- /dev/null
+++ b/tests/old/testsuite/caps/random.c
@@ -0,0 +1,69 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ *
+ * 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 <gst/gst.h>
+
+void
+assert_on_error (GstDebugCategory * category, GstDebugLevel level,
+ const gchar * file, const gchar * function, gint line, GObject * object,
+ GstDebugMessage * message, gpointer data)
+{
+ g_assert (level != GST_LEVEL_ERROR);
+}
+
+gint
+main (gint argc, gchar * argv[])
+{
+ /* this file contains random tests for stuff that went wrong in some version
+ * and should be tested so we're sure it works right now
+ * Please add what exactly the code tests for in your test */
+
+ gst_init (&argc, &argv);
+
+ /* TEST 1:
+ * gstcaps.c 1.120 used a code path that caused a GST_ERROR for the tested
+ * caps when simplifying even though that is absolutely valid */
+ {
+ GstCaps *caps =
+ gst_caps_from_string
+ ("some/type, a=(int)2, b=(int)3, c=bla; some/type, a=(int)2, c=bla");
+ gst_debug_add_log_function (assert_on_error, NULL);
+ gst_caps_do_simplify (caps);
+ gst_debug_remove_log_function (assert_on_error);
+ gst_caps_free (caps);
+ }
+
+ /* TEST 2:
+ * gstvalue.c 1.34 had a broken comparison function for int ranges that
+ * returned GST_VALUE_EQUAL even though the range end was different */
+ {
+ GValue v1 = { 0, };
+ GValue v2 = { 0, };
+
+ g_value_init (&v1, GST_TYPE_INT_RANGE);
+ g_value_init (&v2, GST_TYPE_INT_RANGE);
+ gst_value_set_int_range (&v1, 1, 2);
+ gst_value_set_int_range (&v2, 1, 3);
+ g_assert (gst_value_compare (&v1, &v2) != GST_VALUE_EQUAL);
+ g_value_unset (&v1);
+ g_value_unset (&v2);
+ }
+
+ return 0;
+}