tests: test fixed caps
authorStéphane Cerveau <scerveau@collabora.com>
Mon, 25 Apr 2022 09:03:35 +0000 (11:03 +0200)
committerStéphane Cerveau <scerveau@collabora.com>
Wed, 11 May 2022 06:59:55 +0000 (08:59 +0200)
Add a test entry to check wether a caps is fixed
or not.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2290>

subprojects/gstreamer/tests/check/gst/gstcaps.c

index d9931d6..b6c1541 100644 (file)
@@ -1404,16 +1404,15 @@ GST_START_TEST (test_special_caps)
 
   caps = gst_caps_new_any ();
   fail_unless (gst_caps_is_any (caps));
-  fail_unless (gst_caps_is_any (caps) == TRUE);
+  fail_unless (gst_caps_is_any (caps));
   fail_if (gst_caps_is_empty (caps));
   fail_unless (gst_caps_is_empty (caps) == FALSE);
   gst_caps_unref (caps);
 
   caps = gst_caps_new_empty ();
   fail_if (gst_caps_is_any (caps));
-  fail_unless (gst_caps_is_any (caps) == FALSE);
   fail_unless (gst_caps_is_empty (caps));
-  fail_unless (gst_caps_is_empty (caps) == TRUE);
+  fail_unless (gst_caps_is_empty (caps));
   gst_caps_unref (caps);
 }
 
@@ -1817,6 +1816,32 @@ GST_START_TEST (test_remains_any)
 
 GST_END_TEST;
 
+GST_START_TEST (test_fixed)
+{
+  GstCaps *caps;
+
+  caps =
+      gst_caps_from_string
+      ("video/x-raw, format=I420; video/x-raw(foo:bar); video/x-h264");
+  fail_if (gst_caps_is_fixed (caps));
+  gst_caps_unref (caps);
+
+  caps = gst_caps_new_any ();
+  fail_if (gst_caps_is_fixed (caps));
+  gst_caps_unref (caps);
+
+  caps = gst_caps_from_string ("ANY");
+  fail_unless (gst_caps_is_any (caps));
+  fail_if (gst_caps_is_fixed (caps));
+  gst_caps_unref (caps);
+
+  caps = gst_caps_from_string ("video/x-raw, format=I420");
+  fail_unless (gst_caps_is_fixed (caps));
+  gst_caps_unref (caps);
+}
+
+GST_END_TEST;
+
 static Suite *
 gst_caps_suite (void)
 {
@@ -1854,6 +1879,7 @@ gst_caps_suite (void)
   tcase_add_test (tc_chain, test_filter_and_map_in_place);
   tcase_add_test (tc_chain, test_equality);
   tcase_add_test (tc_chain, test_remains_any);
+  tcase_add_test (tc_chain, test_fixed);
 
   return s;
 }