gst/gstcaps.c: whitespace fixes
authorThomas Vander Stichele <thomas@apestaart.org>
Sun, 2 Jul 2006 12:54:03 +0000 (12:54 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Sun, 2 Jul 2006 12:54:03 +0000 (12:54 +0000)
Original commit message from CVS:
* 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

ChangeLog
gst/gstcaps.c
tests/check/gst/gstbuffer.c
tests/check/gst/gstcaps.c

index ea0a715..e7bbb9d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 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
index 2298cd9..bebde26 100644 (file)
@@ -29,8 +29,8 @@
  * 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
@@ -47,8 +47,8 @@
  *       "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>
@@ -875,9 +875,9 @@ gst_caps_is_subset (const GstCaps * subset, const GstCaps * superset)
  * <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)
@@ -1309,7 +1309,7 @@ gst_caps_compare_structures (gconstpointer one, gconstpointer two)
   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));
index 20c0fb8..dcf321e 100644 (file)
@@ -39,6 +39,10 @@ GST_START_TEST (test_caps)
   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);
 
index 8bb73db..fa33d4b 100644 (file)
@@ -22,6 +22,7 @@
 
 
 #include <gst/check/gstcheck.h>
+#include <gst/gstcaps.h>
 #include "capslist.h"
 
 GST_START_TEST (test_from_string)
@@ -197,12 +198,16 @@ GST_START_TEST (test_simplify)
 {
   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");
@@ -332,6 +337,22 @@ GST_START_TEST (test_simplify)
 
 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)
 {
@@ -345,6 +366,7 @@ 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;
 }