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:
Less tabs, more spaces.
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
{
*/
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 ())
/**
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");
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;
}