From d100e0b489fcd92d2e786b4c593b8ea40fc1d79e Mon Sep 17 00:00:00 2001 From: David Schleef Date: Mon, 22 Dec 2003 03:03:31 +0000 Subject: [PATCH] Add test for a bug in GstValueList Original commit message from CVS: Add test for a bug in GstValueList --- tests/old/testsuite/caps/intersection.c | 12 ++++++++++++ tests/old/testsuite/caps/value_intersect.c | 26 ++++++++++++++++++++++++++ testsuite/caps/intersection.c | 12 ++++++++++++ testsuite/caps/value_intersect.c | 26 ++++++++++++++++++++++++++ 4 files changed, 76 insertions(+) diff --git a/tests/old/testsuite/caps/intersection.c b/tests/old/testsuite/caps/intersection.c index e77bce1..a672591 100644 --- a/tests/old/testsuite/caps/intersection.c +++ b/tests/old/testsuite/caps/intersection.c @@ -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; diff --git a/tests/old/testsuite/caps/value_intersect.c b/tests/old/testsuite/caps/value_intersect.c index 352fbcc..94ad679 100644 --- a/tests/old/testsuite/caps/value_intersect.c +++ b/tests/old/testsuite/caps/value_intersect.c @@ -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; diff --git a/testsuite/caps/intersection.c b/testsuite/caps/intersection.c index e77bce1..a672591 100644 --- a/testsuite/caps/intersection.c +++ b/testsuite/caps/intersection.c @@ -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; diff --git a/testsuite/caps/value_intersect.c b/testsuite/caps/value_intersect.c index 352fbcc..94ad679 100644 --- a/testsuite/caps/value_intersect.c +++ b/testsuite/caps/value_intersect.c @@ -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; -- 2.7.4