diff --git a/tests/check/gst/gstvalue.c b/tests/check/gst/gstvalue.c index 7f47c97496..4615b391c4 100644 --- a/tests/check/gst/gstvalue.c +++ b/tests/check/gst/gstvalue.c @@ -66,6 +66,50 @@ GST_START_TEST (test_serialize_fourcc) GST_END_TEST; +GST_START_TEST (test_deserialize_fourcc) +{ + int i; + + guint32 fourccs[] = { + GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), + GST_MAKE_FOURCC ('Y', '8', '0', '0'), + GST_MAKE_FOURCC ('Y', '8', ' ', ' '), + GST_MAKE_FOURCC ('Y', '8', ' ', ' '), + GST_MAKE_FOURCC ('Y', '8', ' ', ' '), + GST_MAKE_FOURCC ('Y', '1', '6', ' '), + GST_MAKE_FOURCC ('Y', 'U', 'Y', '_'), + GST_MAKE_FOURCC ('Y', 'U', 'Y', '#'), + }; + gint fourccs_size = sizeof (fourccs) / sizeof (fourccs[0]); + const gchar *fourcc_strings[] = { + "YUY2", + "Y800", + "Y8 ", + "Y8 ", + "Y8", + "Y16 ", + "0x5f595559", /* Ascii values of YUY_ */ + "0x23595559", /* Ascii values of YUY# */ + }; + gint fourcc_strings_size = + sizeof (fourcc_strings) / sizeof (fourcc_strings[0]); + + fail_unless (fourccs_size == fourcc_strings_size); + + for (i = 0; i < fourccs_size; ++i) { + GValue value = { 0 }; + + g_value_init (&value, GST_TYPE_FOURCC); + + fail_unless (gst_value_deserialize (&value, fourcc_strings[i])); + fail_unless_equals_int (gst_value_get_fourcc (&value), fourccs[i]); + + g_value_unset (&value); + } +} + +GST_END_TEST; + GST_START_TEST (test_deserialize_buffer) { GValue value = { 0 }; @@ -1805,6 +1849,7 @@ gst_value_suite (void) suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_serialize_fourcc); + tcase_add_test (tc_chain, test_deserialize_fourcc); tcase_add_test (tc_chain, test_deserialize_buffer); tcase_add_test (tc_chain, test_serialize_buffer); tcase_add_test (tc_chain, test_deserialize_gint);