tests: Check return value of byte write methods

This commit is contained in:
Edward Hervey 2012-03-30 12:06:09 +02:00
parent 32c617c867
commit 8d90932ad4

View file

@ -1314,26 +1314,29 @@ GST_START_TEST (test_exif_parsing)
GstTagList *taglist; GstTagList *taglist;
GstBuffer *buf; GstBuffer *buf;
GstByteWriter writer; GstByteWriter writer;
gboolean res = TRUE;
const gchar *str = NULL; const gchar *str = NULL;
gst_byte_writer_init (&writer); gst_byte_writer_init (&writer);
/* write the IFD */ /* write the IFD */
/* 1 entry */ /* 1 entry */
gst_byte_writer_put_uint16_le (&writer, 1); res &= gst_byte_writer_put_uint16_le (&writer, 1);
/* copyright tag */ /* copyright tag */
/* tag id */ /* tag id */
gst_byte_writer_put_uint16_le (&writer, 0x8298); res &= gst_byte_writer_put_uint16_le (&writer, 0x8298);
/* tag type */ /* tag type */
gst_byte_writer_put_uint16_le (&writer, 0x2); res &= gst_byte_writer_put_uint16_le (&writer, 0x2);
/* count */ /* count */
gst_byte_writer_put_uint32_le (&writer, strlen ("my copyright") + 1); res &= gst_byte_writer_put_uint32_le (&writer, strlen ("my copyright") + 1);
/* offset */ /* offset */
gst_byte_writer_put_uint32_le (&writer, 8 + 14); res &= gst_byte_writer_put_uint32_le (&writer, 8 + 14);
/* data */ /* data */
gst_byte_writer_put_string (&writer, "my copyright"); res &= gst_byte_writer_put_string (&writer, "my copyright");
fail_unless (res, "Failed to write tag");
buf = gst_byte_writer_reset_and_get_buffer (&writer); buf = gst_byte_writer_reset_and_get_buffer (&writer);