tests: zbar: check for frame field on attach-frame=true

Also check for the sample to have a buffer and caps
associated with it.

Related to:

https://bugzilla.gnome.org/show_bug.cgi?id=747557
This commit is contained in:
Reynaldo H. Verdejo Pinochet 2015-06-01 11:12:22 -03:00
parent 4cca6efda8
commit 8f2b65c74d

View file

@ -25,6 +25,7 @@ GST_START_TEST (test_still_image)
GstMessage *zbar_msg = NULL;
const GstStructure *s;
GstElement *pipeline, *src, *dec, *csp, *zbar, *sink;
GstSample *sample;
const gchar *type, *symbol;
gchar *path;
int qual;
@ -37,6 +38,8 @@ GST_START_TEST (test_still_image)
zbar = gst_element_factory_make ("zbar", NULL);
sink = gst_element_factory_make ("fakesink", NULL);
g_object_set (zbar, "attach-frame", TRUE, NULL);
path = g_build_filename (GST_TEST_FILES_PATH, "barcode.png", NULL);
GST_LOG ("reading file '%s'", path);
g_object_set (src, "location", path, NULL);
@ -79,6 +82,7 @@ GST_START_TEST (test_still_image)
fail_unless (gst_structure_has_field (s, "type"));
fail_unless (gst_structure_has_field (s, "symbol"));
fail_unless (gst_structure_has_field (s, "quality"));
fail_unless (gst_structure_has_field (s, "frame"));
fail_unless (gst_structure_get_int (s, "quality", &qual));
fail_unless (qual >= 90);
type = gst_structure_get_string (s, "type");
@ -86,6 +90,11 @@ GST_START_TEST (test_still_image)
symbol = gst_structure_get_string (s, "symbol");
fail_unless_equals_string (symbol, "9876543210128");
fail_unless (gst_structure_get (s, "frame", GST_TYPE_SAMPLE, &sample, NULL));
fail_unless (gst_sample_get_buffer (sample));
fail_unless (gst_sample_get_caps (sample));
gst_sample_unref (sample);
fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_NULL),
GST_STATE_CHANGE_SUCCESS);