2006-07-02 Thomas Vander Stichele <thomas at apestaart dot org>
+ * gst/gstcaps.c: (gst_caps_compare_structures):
+ whitespace fixes
+ * tests/check/gst/gstbuffer.c: (GST_START_TEST):
+ * tests/check/gst/gstcaps.c: (GST_START_TEST), (gst_caps_suite):
+ add more tests
+
+2006-07-02 Thomas Vander Stichele <thomas at apestaart dot org>
+
* libs/gst/dataprotocol/Makefile.am:
build dataprotocol test by linking to the lib, instead of
compiling the source, so we get coverage
* given pad can handle. They are also stored in the registry along with
* a description of the element.
*
- * Caps are exposed on the element pads using the gst_pad_get_caps() pad
- * function. This function describes the possible types that the pad can
+ * Caps are exposed on the element pads using the gst_pad_get_caps() pad
+ * function. This function describes the possible types that the pad can
* handle or produce at runtime.
*
* Caps are also attached to buffers to describe to content of the data
* "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
* "framerate", G_TYPE_DOUBLE, 25.0,
* "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
- * "width", G_TYPE_INT, 320,
- * "height", G_TYPE_INT, 240,
+ * "width", G_TYPE_INT, 320,
+ * "height", G_TYPE_INT, 240,
* NULL);
* </programlisting>
* </example>
* <note>This function does not work reliably if optional properties for caps
* are included on one caps and omitted on the other.</note>
*
- * This function deals correctly with passing NULL for any of the caps.
+ * This function deals correctly with passing NULL for any of the caps.
*
- * Returns: TRUE if both caps are equal.
+ * Returns: TRUE if both caps are equal.
*/
gboolean
gst_caps_is_equal (const GstCaps * caps1, const GstCaps * caps2)
const GstStructure *struct1 = *((const GstStructure **) one);
const GstStructure *struct2 = *((const GstStructure **) two);
- /* FIXME: this orders aphabetically, but ordering the quarks might be faster
+ /* FIXME: this orders alphabetically, but ordering the quarks might be faster
So what's the best way? */
ret = strcmp (gst_structure_get_name (struct1),
gst_structure_get_name (struct2));
fail_unless (GST_BUFFER_CAPS (buffer) == caps);
ASSERT_CAPS_REFCOUNT (caps, "caps", 2);
+ fail_unless (gst_buffer_get_caps (buffer) == caps);
+ gst_caps_unref (caps);
+ ASSERT_CAPS_REFCOUNT (caps, "caps", 2);
+
caps2 = gst_caps_from_string ("audio/x-raw-float");
ASSERT_CAPS_REFCOUNT (caps2, "caps2", 1);
#include <gst/check/gstcheck.h>
+#include <gst/gstcaps.h>
#include "capslist.h"
GST_START_TEST (test_from_string)
{
GstStructure *s1, *s2;
gboolean did_simplify;
- GstCaps *caps;
+ GstCaps *caps, *simplecaps;
caps = gst_caps_from_string (non_simple_caps_string);
fail_unless (caps != NULL,
"gst_caps_from_string (non_simple_caps_string) failed");
+ /* first get a new copy of simplified caps */
+ simplecaps = gst_caps_simplify (caps);
+ fail_unless (simplecaps != NULL, "simplifying caps failed");
+
did_simplify = gst_caps_do_simplify (caps);
fail_unless (did_simplify == TRUE,
"gst_caps_do_simplify() should have worked");
GST_END_TEST;
+GST_START_TEST (test_truncate)
+{
+ GstCaps *caps;
+
+ caps = gst_caps_from_string (non_simple_caps_string);
+ fail_unless (caps != NULL,
+ "gst_caps_from_string (non_simple_caps_string) failed");
+ fail_unless_equals_int (gst_caps_get_size (caps), 4);
+ gst_caps_truncate (caps);
+ fail_unless_equals_int (gst_caps_get_size (caps), 1);
+ gst_caps_unref (caps);
+}
+
+GST_END_TEST;
+
+
Suite *
gst_caps_suite (void)
{
tcase_add_test (tc_chain, test_buffer);
tcase_add_test (tc_chain, test_static_caps);
tcase_add_test (tc_chain, test_simplify);
+ tcase_add_test (tc_chain, test_truncate);
return s;
}