value: Add test for deserializing fourccs

This commit is contained in:
Sebastian Dröge 2010-06-12 08:04:47 +02:00
parent ab0763f0e8
commit 4a3dde96e7

View file

@ -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);