mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
tests: rewrite test a little
Rewrite the tag check so that we don't need to deal with tag lists.
This commit is contained in:
parent
8e39d52bbb
commit
386ccc52e7
1 changed files with 31 additions and 17 deletions
|
@ -143,7 +143,7 @@ test_demux_tags (const gchar * tag_str, const gchar * demuxer,
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
GstTagList *sent_tags;
|
GstTagList *sent_tags;
|
||||||
gint i, j, n_recv, n_sent;
|
gint i, j, k, n_recv, n_sent;
|
||||||
const gchar *name_sent, *name_recv;
|
const gchar *name_sent, *name_recv;
|
||||||
const GValue *value_sent, *value_recv;
|
const GValue *value_sent, *value_recv;
|
||||||
gboolean found;
|
gboolean found;
|
||||||
|
@ -192,27 +192,41 @@ test_demux_tags (const gchar * tag_str, const gchar * demuxer,
|
||||||
/* FIXME: compare taglits values */
|
/* FIXME: compare taglits values */
|
||||||
for (i = 0; i < n_sent; i++) {
|
for (i = 0; i < n_sent; i++) {
|
||||||
name_sent = gst_tag_list_nth_tag_name (sent_tags, i);
|
name_sent = gst_tag_list_nth_tag_name (sent_tags, i);
|
||||||
value_sent = gst_tag_list_get_value (sent_tags, name_sent);
|
|
||||||
found = FALSE;
|
found = FALSE;
|
||||||
for (j = 0; j < n_recv; j++) {
|
for (j = 0; j < n_recv; j++) {
|
||||||
name_recv = gst_tag_list_nth_tag_name (received_tags, j);
|
name_recv = gst_tag_list_nth_tag_name (received_tags, j);
|
||||||
|
|
||||||
if (!strcmp (name_sent, name_recv)) {
|
if (!strcmp (name_sent, name_recv)) {
|
||||||
value_recv = gst_tag_list_get_value (received_tags, name_recv);
|
guint sent_len, recv_len;
|
||||||
comparison = gst_value_compare (value_sent, value_recv);
|
|
||||||
if (comparison != GST_VALUE_EQUAL) {
|
sent_len = gst_tag_list_get_tag_size (sent_tags, name_sent);
|
||||||
gchar *vs = g_strdup_value_contents (value_sent);
|
recv_len = gst_tag_list_get_tag_size (received_tags, name_recv);
|
||||||
gchar *vr = g_strdup_value_contents (value_recv);
|
|
||||||
GST_DEBUG ("sent = %s:'%s', recv = %s:'%s'",
|
fail_unless (sent_len == recv_len,
|
||||||
G_VALUE_TYPE_NAME (value_sent), vs,
|
"tag item %s has been received with different size", name_sent);
|
||||||
G_VALUE_TYPE_NAME (value_recv), vr);
|
|
||||||
g_free (vs);
|
for (k = 0; k < sent_len; k++) {
|
||||||
g_free (vr);
|
value_sent = gst_tag_list_get_value_index (sent_tags, name_sent, k);
|
||||||
|
value_recv =
|
||||||
|
gst_tag_list_get_value_index (received_tags, name_recv, k);
|
||||||
|
|
||||||
|
comparison = gst_value_compare (value_sent, value_recv);
|
||||||
|
if (comparison != GST_VALUE_EQUAL) {
|
||||||
|
gchar *vs = g_strdup_value_contents (value_sent);
|
||||||
|
gchar *vr = g_strdup_value_contents (value_recv);
|
||||||
|
GST_DEBUG ("sent = %s:'%s', recv = %s:'%s'",
|
||||||
|
G_VALUE_TYPE_NAME (value_sent), vs,
|
||||||
|
G_VALUE_TYPE_NAME (value_recv), vr);
|
||||||
|
g_free (vs);
|
||||||
|
g_free (vr);
|
||||||
|
}
|
||||||
|
fail_unless (comparison == GST_VALUE_EQUAL,
|
||||||
|
"tag item %s has been received with different type or value",
|
||||||
|
name_sent);
|
||||||
|
found = TRUE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
fail_unless (comparison == GST_VALUE_EQUAL,
|
|
||||||
"tag item %s has been received with different type or value",
|
|
||||||
name_sent);
|
|
||||||
found = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fail_unless (found, "tag item %s is lost", name_sent);
|
fail_unless (found, "tag item %s is lost", name_sent);
|
||||||
|
|
Loading…
Reference in a new issue