]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/commitdiff
Add test for a bug in GstValueList
authorDavid Schleef <ds@schleef.org>
Mon, 22 Dec 2003 03:03:31 +0000 (03:03 +0000)
committerDavid Schleef <ds@schleef.org>
Mon, 22 Dec 2003 03:03:31 +0000 (03:03 +0000)
Original commit message from CVS:
Add test for a bug in GstValueList

tests/old/testsuite/caps/intersection.c
tests/old/testsuite/caps/value_intersect.c
testsuite/caps/intersection.c
testsuite/caps/value_intersect.c

index e77bce19a20bfe9844c66fc9d27ea51a9e4a7cc6..a67259144ad1a323da335a71eedbd89811d67f5f 100644 (file)
@@ -62,6 +62,14 @@ GstStaticCaps rawcaps6 = GST_STATIC_CAPS (
     "framerate=(double)30.0"
 );
 
+GstStaticCaps rawcaps7 = GST_STATIC_CAPS (
+    "video/x-raw-yuv, format=(fourcc)YUY2, width=(int)[1,2147483647], height=(int)[1,2147483647], framerate=(double)[0,1.79769e+308]"
+);
+
+GstStaticCaps rawcaps8 = GST_STATIC_CAPS (
+    "video/x-raw-yuv, format=(fourcc){ I420, YV12, YUY2 }, width=(int)[16,4096], height=(int)[16,4096], framerate=(double)[0,1.79769e+308]"
+);
+
 int 
 main (int argc, char *argv[]) 
 {
@@ -108,6 +116,10 @@ main (int argc, char *argv[])
   parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities5", NULL);
   gst_caps_save_thyself (caps, parent);
 
+  caps = gst_caps_intersect (gst_static_caps_get (&rawcaps7),
+      gst_static_caps_get (&rawcaps8));
+  g_print("intersection: %s\n", gst_caps_to_string (caps));
+
   xmlDocDump(stdout, doc);
 
   return 0;
index 352fbcc65fa1dc818cd080ef8df0df42214aff30..94ad6797ed3d47291e6b880650ec2981a3008cdf 100644 (file)
@@ -13,8 +13,33 @@ void test1(void)
   g_value_init(&src2, G_TYPE_INT);
   g_value_set_int(&src1, 20);
   ret = gst_value_intersect(&dest, &src1, &src2);
+  g_assert(ret == 0);
+  g_print("ret = %d\n",ret);
+}
+
+void test2(void)
+{
+  GValue dest = { 0 };
+  GValue src1 = { 0 };
+  GValue src2 = { 0 };
+  GValue item = { 0 };
+  gboolean ret;
+
+  g_value_init(&src1, GST_TYPE_FOURCC);
+  gst_value_set_fourcc(&src1, GST_MAKE_FOURCC('Y','U','Y','2'));
+  g_value_init(&src2, GST_TYPE_LIST);
+  g_value_init(&item, GST_TYPE_FOURCC);
+  gst_value_set_fourcc(&item, GST_MAKE_FOURCC('Y','U','Y','2'));
+  gst_value_list_append_value (&src2, &item);
+  gst_value_set_fourcc(&item, GST_MAKE_FOURCC('I','4','2','0'));
+  gst_value_list_append_value (&src2, &item);
+  gst_value_set_fourcc(&item, GST_MAKE_FOURCC('A','B','C','D'));
+  gst_value_list_append_value (&src2, &item);
+  ret = gst_value_intersect(&dest, &src1, &src2);
   g_print("ret = %d\n",ret);
 
+  g_print("type = %s\n", g_type_name(G_VALUE_TYPE(&dest)));
+  g_print("value = %s\n", g_strdup_value_contents(&dest));
 }
 
 int main(int argc, char *argv[])
@@ -23,6 +48,7 @@ int main(int argc, char *argv[])
   gst_init(&argc, &argv);
 
   test1();
+  test2();
 
   return 0;
 
index e77bce19a20bfe9844c66fc9d27ea51a9e4a7cc6..a67259144ad1a323da335a71eedbd89811d67f5f 100644 (file)
@@ -62,6 +62,14 @@ GstStaticCaps rawcaps6 = GST_STATIC_CAPS (
     "framerate=(double)30.0"
 );
 
+GstStaticCaps rawcaps7 = GST_STATIC_CAPS (
+    "video/x-raw-yuv, format=(fourcc)YUY2, width=(int)[1,2147483647], height=(int)[1,2147483647], framerate=(double)[0,1.79769e+308]"
+);
+
+GstStaticCaps rawcaps8 = GST_STATIC_CAPS (
+    "video/x-raw-yuv, format=(fourcc){ I420, YV12, YUY2 }, width=(int)[16,4096], height=(int)[16,4096], framerate=(double)[0,1.79769e+308]"
+);
+
 int 
 main (int argc, char *argv[]) 
 {
@@ -108,6 +116,10 @@ main (int argc, char *argv[])
   parent = xmlNewChild (doc->xmlRootNode, NULL, "Capabilities5", NULL);
   gst_caps_save_thyself (caps, parent);
 
+  caps = gst_caps_intersect (gst_static_caps_get (&rawcaps7),
+      gst_static_caps_get (&rawcaps8));
+  g_print("intersection: %s\n", gst_caps_to_string (caps));
+
   xmlDocDump(stdout, doc);
 
   return 0;
index 352fbcc65fa1dc818cd080ef8df0df42214aff30..94ad6797ed3d47291e6b880650ec2981a3008cdf 100644 (file)
@@ -13,8 +13,33 @@ void test1(void)
   g_value_init(&src2, G_TYPE_INT);
   g_value_set_int(&src1, 20);
   ret = gst_value_intersect(&dest, &src1, &src2);
+  g_assert(ret == 0);
+  g_print("ret = %d\n",ret);
+}
+
+void test2(void)
+{
+  GValue dest = { 0 };
+  GValue src1 = { 0 };
+  GValue src2 = { 0 };
+  GValue item = { 0 };
+  gboolean ret;
+
+  g_value_init(&src1, GST_TYPE_FOURCC);
+  gst_value_set_fourcc(&src1, GST_MAKE_FOURCC('Y','U','Y','2'));
+  g_value_init(&src2, GST_TYPE_LIST);
+  g_value_init(&item, GST_TYPE_FOURCC);
+  gst_value_set_fourcc(&item, GST_MAKE_FOURCC('Y','U','Y','2'));
+  gst_value_list_append_value (&src2, &item);
+  gst_value_set_fourcc(&item, GST_MAKE_FOURCC('I','4','2','0'));
+  gst_value_list_append_value (&src2, &item);
+  gst_value_set_fourcc(&item, GST_MAKE_FOURCC('A','B','C','D'));
+  gst_value_list_append_value (&src2, &item);
+  ret = gst_value_intersect(&dest, &src1, &src2);
   g_print("ret = %d\n",ret);
 
+  g_print("type = %s\n", g_type_name(G_VALUE_TYPE(&dest)));
+  g_print("value = %s\n", g_strdup_value_contents(&dest));
 }
 
 int main(int argc, char *argv[])
@@ -23,6 +48,7 @@ int main(int argc, char *argv[])
   gst_init(&argc, &argv);
 
   test1();
+  test2();
 
   return 0;