gst/gsttaglist.*: Minor fixes to GST_IS_TAG_LIST and gst_is_tag_list().

Original commit message from CVS:
* gst/gsttaglist.c: (gst_is_tag_list):
* gst/gsttaglist.h:
Minor fixes to GST_IS_TAG_LIST and gst_is_tag_list().
* tests/check/gst/gsttag.c: (GST_START_TEST), (gst_tag_suite):
Small test for the above.
This commit is contained in:
Tim-Philipp Müller 2006-10-07 18:41:19 +00:00
parent f8571bd952
commit 35ae6c7472
4 changed files with 33 additions and 3 deletions

View file

@ -1,3 +1,12 @@
2006-10-07 Tim-Philipp Müller <tim at centricular dot net>
* gst/gsttaglist.c: (gst_is_tag_list):
* gst/gsttaglist.h:
Minor fixes to GST_IS_TAG_LIST and gst_is_tag_list().
* tests/check/gst/gsttag.c: (GST_START_TEST), (gst_tag_suite):
Small test for the above.
2006-10-07 Tim-Philipp Müller <tim at centricular dot net>
* gst/gsttaglist.h:

View file

@ -479,9 +479,11 @@ gst_tag_list_new (void)
gboolean
gst_is_tag_list (gconstpointer p)
{
GstStructure *s = (GstStructure *) p;
g_return_val_if_fail (p != NULL, FALSE);
return ((GstStructure *) p)->name == gst_tag_list_quark;
return (GST_IS_STRUCTURE (s) && s->name == gst_tag_list_quark);
}
typedef struct
{

View file

@ -82,7 +82,7 @@ typedef enum {
*/
typedef GstStructure GstTagList;
#define GST_TAG_LIST(x) ((GstTagList *) (x))
#define GST_IS_TAG_LIST(x) (gst_is_tag_list (GST_TAG_LIST (x)))
#define GST_IS_TAG_LIST(x) ((x) != NULL && gst_is_tag_list (GST_TAG_LIST (x)))
#define GST_TYPE_TAG_LIST (gst_tag_list_get_type ())
/**

View file

@ -215,7 +215,25 @@ GST_START_TEST (test_date_tags)
GST_END_TEST;
Suite *
GST_START_TEST (test_type)
{
GstTagList *taglist;
taglist = gst_tag_list_new ();
fail_unless (GST_IS_TAG_LIST (taglist));
fail_unless (gst_is_tag_list (taglist));
gst_tag_list_free (taglist);
/* this isn't okay */
ASSERT_CRITICAL (fail_if (gst_is_tag_list (NULL)));
/* this however should be fine */
fail_if (GST_IS_TAG_LIST (NULL));
}
GST_END_TEST;
static Suite *
gst_tag_suite (void)
{
Suite *s = suite_create ("GstTag");
@ -224,6 +242,7 @@ gst_tag_suite (void)
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_merge);
tcase_add_test (tc_chain, test_date_tags);
tcase_add_test (tc_chain, test_type);
return s;
}