From 5203ce837930ce3618d74c7b4e8e8fc449ff8fec Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Tue, 31 Jan 2017 17:25:06 +0100 Subject: tests: Assert the content-type of various GDataParsable types This is a good way to exercise the newly added gdata_parsable_get_content_type API. https://bugzilla.gnome.org/show_bug.cgi?id=777980 --- gdata/tests/general.c | 204 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 203 insertions(+), 1 deletion(-) diff --git a/gdata/tests/general.c b/gdata/tests/general.c index 24206291..f1ab7cb0 100644 --- a/gdata/tests/general.c +++ b/gdata/tests/general.c @@ -1471,6 +1471,7 @@ static void test_access_rule_get_xml (void) { GDataAccessRule *rule, *rule2; + const gchar *content_type; gchar *xml, *role, *scope_type3, *scope_value3, *key; gint64 edited, edited2; const gchar *scope_type, *scope_value, *scope_type2, *scope_value2; @@ -1497,6 +1498,9 @@ test_access_rule_get_xml (void) gdata_access_rule_set_role (rule, GDATA_ACCESS_ROLE_NONE); gdata_access_rule_set_scope (rule, GDATA_ACCESS_SCOPE_USER, "foo@example.com"); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (rule)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the generated XML's OK */ gdata_test_assert_xml (rule, "" @@ -1518,6 +1522,9 @@ test_access_rule_get_xml (void) g_clear_error (&error); g_free (xml); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (rule2)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + g_assert_cmpstr (gdata_access_rule_get_role (rule), ==, gdata_access_rule_get_role (rule2)); gdata_access_rule_get_scope (rule, &scope_type, &scope_value); gdata_access_rule_get_scope (rule2, &scope_type2, &scope_value2); @@ -1561,6 +1568,9 @@ test_access_rule_get_xml (void) gdata_access_rule_set_role (rule, GDATA_ACCESS_ROLE_NONE); gdata_access_rule_set_scope (rule, GDATA_ACCESS_SCOPE_DEFAULT, NULL); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (rule)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the generated XML's OK */ gdata_test_assert_xml (rule, "" @@ -1582,6 +1592,9 @@ test_access_rule_get_xml (void) g_clear_error (&error); g_free (xml); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (rule2)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + g_assert_cmpstr (gdata_access_rule_get_role (rule), ==, gdata_access_rule_get_role (rule2)); gdata_access_rule_get_scope (rule, &scope_type, &scope_value); gdata_access_rule_get_scope (rule2, &scope_type2, &scope_value2); @@ -1599,7 +1612,7 @@ test_access_rule_get_xml_with_key (void) { GDataAccessRule *rule; gint64 edited; - const gchar *scope_type, *scope_value; + const gchar *content_type, *scope_type, *scope_value; GError *error = NULL; rule = GDATA_ACCESS_RULE (gdata_parsable_new_from_xml (GDATA_TYPE_ACCESS_RULE, @@ -1625,6 +1638,9 @@ test_access_rule_get_xml_with_key (void) g_assert_cmpuint (edited, >, 0); /* current time */ g_assert_cmpstr (gdata_access_rule_get_key (rule), ==, "asdasd"); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (rule)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is the same. */ gdata_test_assert_xml (rule, "" @@ -1780,6 +1796,7 @@ static void test_atom_author (void) { GDataAuthor *author, *author2; + const gchar *content_type; gchar *name, *uri, *email_address; GError *error = NULL; @@ -1808,6 +1825,9 @@ test_atom_author (void) g_assert_cmpint (gdata_comparable_compare (GDATA_COMPARABLE (author), GDATA_COMPARABLE (author2)), !=, 0); g_object_unref (author2); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (author)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is the same */ gdata_test_assert_xml (author, "" @@ -1842,6 +1862,9 @@ test_atom_author (void) g_assert (GDATA_IS_AUTHOR (author)); g_clear_error (&error); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (author)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the properties */ g_assert_cmpstr (gdata_author_get_name (author), ==, "James Johnson"); g_assert (gdata_author_get_uri (author) == NULL); @@ -1900,6 +1923,7 @@ static void test_atom_category (void) { GDataCategory *category, *category2; + const gchar *content_type; gchar *term, *scheme, *label; GError *error = NULL; @@ -1924,6 +1948,9 @@ test_atom_category (void) g_assert_cmpint (gdata_comparable_compare (GDATA_COMPARABLE (category), GDATA_COMPARABLE (category2)), !=, 0); g_object_unref (category2); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (category)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is the same */ gdata_test_assert_xml (category, "" @@ -1953,6 +1980,9 @@ test_atom_category (void) g_assert (GDATA_IS_CATEGORY (category)); g_clear_error (&error); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (category)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the properties */ g_assert_cmpstr (gdata_category_get_term (category), ==, "sports"); g_assert (gdata_category_get_scheme (category) == NULL); @@ -1969,6 +1999,9 @@ test_atom_category (void) g_assert (GDATA_IS_CATEGORY (category)); g_clear_error (&error); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (category)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML contains the unknown XML */ gdata_test_assert_xml (category, "" @@ -2011,6 +2044,7 @@ static void test_atom_generator (void) { GDataGenerator *generator, *generator2; + const gchar *content_type; gchar *name, *uri, *version; GError *error = NULL; @@ -2020,6 +2054,9 @@ test_atom_generator (void) g_assert (GDATA_IS_GENERATOR (generator)); g_clear_error (&error); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (generator)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Compare it against another identical generator */ generator2 = GDATA_GENERATOR (gdata_parsable_new_from_xml (GDATA_TYPE_GENERATOR, "Bach & Son's Generator", -1, NULL)); @@ -2062,6 +2099,9 @@ test_atom_generator (void) g_assert (GDATA_IS_GENERATOR (generator)); g_clear_error (&error); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (generator)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the properties */ g_assert (gdata_generator_get_name (generator) == NULL); g_assert (gdata_generator_get_uri (generator) == NULL); @@ -2119,6 +2159,8 @@ test_atom_link (void) g_assert_cmpint (gdata_comparable_compare (GDATA_COMPARABLE (link1), GDATA_COMPARABLE (link2)), !=, 0); g_object_unref (link2); + g_assert_cmpstr (gdata_parsable_get_content_type (GDATA_PARSABLE (link1)), ==, "application/atom+xml"); + /* Check the outputted XML is the same */ gdata_test_assert_xml (link1, "" @@ -2174,6 +2216,8 @@ test_atom_link (void) g_assert (gdata_link_get_title (link1) == NULL); g_assert (gdata_link_get_length (link1) == -1); + g_assert_cmpstr (gdata_parsable_get_content_type (GDATA_PARSABLE (link1)), ==, "application/atom+xml"); + /* Check the outputted XML contains the unknown XML */ gdata_test_assert_xml (link1, "" @@ -2235,6 +2279,7 @@ test_app_categories (void) GDataAPPCategories *categories; GList *_categories; gboolean fixed; + const gchar *content_type; GError *error = NULL; categories = GDATA_APP_CATEGORIES (gdata_parsable_new_from_json (GDATA_TYPE_APP_CATEGORIES, @@ -2268,6 +2313,9 @@ test_app_categories (void) g_assert (GDATA_IS_APP_CATEGORIES (categories)); g_clear_error (&error); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (categories)); + g_assert_cmpstr (content_type, ==, "application/json"); + /* Check the properties */ g_assert (gdata_app_categories_is_fixed (categories) == FALSE); @@ -2299,6 +2347,9 @@ test_app_categories (void) g_assert (GDATA_IS_APP_CATEGORIES (categories)); g_clear_error (&error); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (categories)); + g_assert_cmpstr (content_type, ==, "application/json"); + /* Check the properties */ g_assert (gdata_app_categories_is_fixed (categories) == FALSE); g_object_unref (categories); @@ -2309,6 +2360,7 @@ test_gd_email_address (void) { GDataGDEmailAddress *email, *email2; GError *error = NULL; + const gchar *content_type; email = GDATA_GD_EMAIL_ADDRESS (gdata_parsable_new_from_xml (GDATA_TYPE_GD_EMAIL_ADDRESS, "" @@ -2356,6 +2411,9 @@ test_gd_email_address (void) g_assert (gdata_gd_email_address_get_display_name (email) == NULL); g_assert (gdata_gd_email_address_is_primary (email) == FALSE); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (email)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML contains the unknown XML */ gdata_test_assert_xml (email, "" @@ -2405,6 +2463,7 @@ test_gd_im_address (void) { GDataGDIMAddress *im, *im2; GError *error = NULL; + const gchar *content_type; im = GDATA_GD_IM_ADDRESS (gdata_parsable_new_from_xml (GDATA_TYPE_GD_IM_ADDRESS, "" @@ -2451,6 +2513,9 @@ test_gd_im_address (void) g_assert_cmpstr (gdata_gd_im_address_get_label (im), ==, "Other & Miscellaneous"); g_assert (gdata_gd_im_address_is_primary (im) == FALSE); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (im)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML contains the unknown XML */ gdata_test_assert_xml (im, "" @@ -2504,6 +2569,7 @@ test_gd_name (void) { GDataGDName *name, *name2; GError *error = NULL; + const gchar *content_type; name = GDATA_GD_NAME (gdata_parsable_new_from_xml (GDATA_TYPE_GD_NAME, "" @@ -2538,6 +2604,9 @@ test_gd_name (void) g_assert_cmpint (gdata_comparable_compare (GDATA_COMPARABLE (name), GDATA_COMPARABLE (name2)), !=, 0); g_object_unref (name2); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (name)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is the same */ gdata_test_assert_xml (name, "" @@ -2566,6 +2635,9 @@ test_gd_name (void) g_assert (gdata_gd_name_get_suffix (name) == NULL); g_assert (gdata_gd_name_get_full_name (name) == NULL); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (name)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is still correct */ gdata_test_assert_xml (name, "" @@ -2663,6 +2735,7 @@ test_gd_organization (void) GDataGDOrganization *org, *org2; GDataGDWhere *location; GError *error = NULL; + const gchar *content_type; org = GDATA_GD_ORGANIZATION (gdata_parsable_new_from_xml (GDATA_TYPE_GD_ORGANIZATION, "" @@ -2733,6 +2809,9 @@ test_gd_organization (void) g_assert (gdata_gd_organization_get_symbol (org) == NULL); g_assert (gdata_gd_organization_get_location (org) == NULL); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (org)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML contains the unknown XML */ gdata_test_assert_xml (org, "" @@ -2800,6 +2879,7 @@ test_gd_phone_number (void) { GDataGDPhoneNumber *phone, *phone2; GError *error = NULL; + const gchar *content_type; phone = GDATA_GD_PHONE_NUMBER (gdata_parsable_new_from_xml (GDATA_TYPE_GD_PHONE_NUMBER, "" @@ -2852,6 +2935,9 @@ test_gd_phone_number (void) g_assert (gdata_gd_phone_number_get_label (phone) == NULL); g_assert (gdata_gd_phone_number_is_primary (phone) == FALSE); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (phone)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML contains the unknown XML */ gdata_test_assert_xml (phone, "" @@ -2919,6 +3005,7 @@ test_gd_postal_address (void) { GDataGDPostalAddress *postal, *postal2; GError *error = NULL; + const gchar *content_type; postal = GDATA_GD_POSTAL_ADDRESS (gdata_parsable_new_from_xml (GDATA_TYPE_GD_POSTAL_ADDRESS, "" @@ -2985,6 +3075,9 @@ test_gd_postal_address (void) g_assert (gdata_gd_postal_address_get_label (postal) == NULL); g_assert (gdata_gd_postal_address_is_primary (postal) == FALSE); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (postal)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML contains the unknown XML */ gdata_test_assert_xml (postal, "" @@ -3083,6 +3176,7 @@ test_gd_reminder (void) GDataGDReminder *reminder, *reminder2; gint64 _time; GError *error = NULL; + const gchar *content_type; reminder = GDATA_GD_REMINDER (gdata_parsable_new_from_xml (GDATA_TYPE_GD_REMINDER, "", -1, &error)); @@ -3095,6 +3189,9 @@ test_gd_reminder (void) g_assert (gdata_gd_reminder_is_absolute_time (reminder) == FALSE); g_assert_cmpint (gdata_gd_reminder_get_relative_time (reminder), ==, 15 * 24 * 60); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (reminder)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML */ gdata_test_assert_xml (reminder, "" @@ -3150,6 +3247,9 @@ test_gd_reminder (void) g_assert_cmpint (gdata_comparable_compare (GDATA_COMPARABLE (reminder), GDATA_COMPARABLE (reminder2)), ==, 0); g_object_unref (reminder2); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (reminder)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML */ gdata_test_assert_xml (reminder, "" @@ -3215,6 +3315,7 @@ test_gd_when (void) GList *reminders; gint64 _time, _time2; GError *error = NULL; + const gchar *content_type; when = GDATA_GD_WHEN (gdata_parsable_new_from_xml (GDATA_TYPE_GD_WHEN, "", @@ -3242,6 +3343,9 @@ test_gd_when (void) g_assert_cmpint (gdata_comparable_compare (GDATA_COMPARABLE (when), GDATA_COMPARABLE (when2)), !=, 0); g_object_unref (when2); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (when)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is the same */ gdata_test_assert_xml (when, "" @@ -3279,6 +3383,9 @@ test_gd_when (void) gdata_gd_when_add_reminder (when, reminder); g_object_unref (reminder); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (when)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is correct */ gdata_test_assert_xml (when, "" @@ -3343,6 +3450,7 @@ test_gd_where (void) { GDataGDWhere *where, *where2; GError *error = NULL; + const gchar *content_type; where = GDATA_GD_WHERE (gdata_parsable_new_from_xml (GDATA_TYPE_GD_WHERE, "" @@ -3385,6 +3496,9 @@ test_gd_where (void) g_assert (gdata_gd_where_get_relation_type (where) == NULL); g_assert (gdata_gd_where_get_label (where) == NULL); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (where)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML contains the unknown XML */ gdata_test_assert_xml (where, "" @@ -3437,6 +3551,7 @@ test_gd_who (void) { GDataGDWho *who, *who2; GError *error = NULL; + const gchar *content_type; who = GDATA_GD_WHO (gdata_parsable_new_from_xml (GDATA_TYPE_GD_WHO, "" @@ -3478,6 +3596,9 @@ test_gd_who (void) g_assert (gdata_gd_who_get_relation_type (who) == NULL); g_assert (gdata_gd_who_get_email_address (who) == NULL); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (who)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML contains the unknown XML */ gdata_test_assert_xml (who, "" @@ -3529,6 +3650,7 @@ test_media_category (void) { GDataMediaCategory *category; GError *error = NULL; + const gchar *content_type; category = GDATA_MEDIA_CATEGORY (gdata_parsable_new_from_xml (GDATA_TYPE_MEDIA_CATEGORY, "" @@ -3564,6 +3689,9 @@ test_media_category (void) g_assert_cmpstr (gdata_media_category_get_scheme (category), ==, "http://video.search.yahoo.com/mrss/category_schema"); g_assert (gdata_media_category_get_label (category) == NULL); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (category)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is the same */ gdata_test_assert_xml (category, "" @@ -3592,6 +3720,7 @@ test_media_content (void) { GDataMediaContent *content; GError *error = NULL; + const gchar *content_type; content = GDATA_MEDIA_CONTENT (gdata_parsable_new_from_xml (GDATA_TYPE_MEDIA_CONTENT, "entity name", @@ -3649,6 +3785,9 @@ test_media_credit (void) g_assert (GDATA_IS_MEDIA_CREDIT (credit)); g_clear_error (&error); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (credit)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the properties */ g_assert_cmpstr (gdata_media_credit_get_credit (credit), ==, "entity name"); g_assert_cmpstr (gdata_media_credit_get_scheme (credit), ==, "urn:foobar"); @@ -3664,6 +3803,9 @@ test_media_credit (void) g_assert (GDATA_IS_MEDIA_CREDIT (credit)); g_clear_error (&error); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (credit)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the properties */ g_assert_cmpstr (gdata_media_credit_get_credit (credit), ==, "John Smith"); g_assert_cmpstr (gdata_media_credit_get_scheme (credit), ==, "urn:ebu"); @@ -3680,6 +3822,7 @@ test_media_group (void) GDataMediaGroup *group; GList *contents, *thumbnails; GError *error = NULL; + const gchar *content_type; group = GDATA_MEDIA_GROUP (gdata_parsable_new_from_xml (GDATA_TYPE_MEDIA_GROUP, "" @@ -3726,6 +3869,9 @@ test_media_group (void) g_assert (GDATA_IS_MEDIA_THUMBNAIL (thumbnails->data)); g_assert (GDATA_IS_MEDIA_THUMBNAIL (thumbnails->next->data)); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (group)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is the same */ gdata_test_assert_xml (group, "" @@ -3789,6 +3935,9 @@ test_media_group (void) g_assert (gdata_media_group_is_restricted_in_country (group, "us") == FALSE); g_assert (gdata_media_group_get_thumbnails (group) == NULL); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (group)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is the same */ gdata_test_assert_xml (group, "" @@ -3840,6 +3989,7 @@ test_gcontact_calendar (void) { GDataGContactCalendar *calendar, *calendar2; GError *error = NULL; + const gchar *content_type; calendar = GDATA_GCONTACT_CALENDAR (gdata_parsable_new_from_xml (GDATA_TYPE_GCONTACT_CALENDAR, "" @@ -3884,6 +4037,9 @@ test_gcontact_calendar (void) g_assert_cmpstr (gdata_gcontact_calendar_get_label (calendar), ==, ""); g_assert (gdata_gcontact_calendar_is_primary (calendar) == FALSE); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (calendar)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is still OK */ gdata_test_assert_xml (calendar, "" @@ -3949,6 +4105,7 @@ test_gcontact_event (void) GDataGContactEvent *event, *event2; GDate date; GError *error = NULL; + const gchar *content_type; event = GDATA_GCONTACT_EVENT (gdata_parsable_new_from_xml (GDATA_TYPE_GCONTACT_EVENT, "" @@ -3972,6 +4129,9 @@ test_gcontact_event (void) g_assert (GDATA_IS_GCONTACT_EVENT (event2)); g_object_unref (event2); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (event)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is the same */ gdata_test_assert_xml (event, "" @@ -4000,6 +4160,9 @@ test_gcontact_event (void) g_assert (gdata_gcontact_event_get_relation_type (event) == NULL); g_assert_cmpstr (gdata_gcontact_event_get_label (event), ==, ""); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (event)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is still OK */ gdata_test_assert_xml (event, "" @@ -4076,6 +4239,7 @@ test_gcontact_external_id (void) { GDataGContactExternalID *id, *id2; GError *error = NULL; + const gchar *content_type; id = GDATA_GCONTACT_EXTERNAL_ID (gdata_parsable_new_from_xml (GDATA_TYPE_GCONTACT_EXTERNAL_ID, "", -1, &error)); @@ -4097,6 +4261,9 @@ test_gcontact_external_id (void) g_assert_cmpint (gdata_comparable_compare (GDATA_COMPARABLE (id), GDATA_COMPARABLE (id2)), !=, 0); g_object_unref (id2); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (id)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is the same */ gdata_test_assert_xml (id, "" @@ -4116,6 +4283,9 @@ test_gcontact_external_id (void) g_assert (gdata_gcontact_external_id_get_relation_type (id) == NULL); g_assert_cmpstr (gdata_gcontact_external_id_get_label (id), ==, ""); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (id)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is still OK */ gdata_test_assert_xml (id, "" @@ -4178,6 +4348,7 @@ test_gcontact_jot (void) { GDataGContactJot *jot, *jot2; GError *error = NULL; + const gchar *content_type; jot = GDATA_GCONTACT_JOT (gdata_parsable_new_from_xml (GDATA_TYPE_GCONTACT_JOT, "They like <angles>.", @@ -4195,6 +4366,9 @@ test_gcontact_jot (void) g_assert (GDATA_IS_GCONTACT_JOT (jot2)); g_object_unref (jot2); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (jot)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is the same */ gdata_test_assert_xml (jot, "" @@ -4213,6 +4387,9 @@ test_gcontact_jot (void) g_assert_cmpstr (gdata_gcontact_jot_get_relation_type (jot), ==, GDATA_GCONTACT_JOT_OTHER); g_assert (gdata_gcontact_jot_get_content (jot) == NULL); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (jot)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is still OK */ gdata_test_assert_xml (jot, "" @@ -4260,6 +4437,7 @@ test_gcontact_language (void) { GDataGContactLanguage *language, *language2; GError *error = NULL; + const gchar *content_type; language = GDATA_GCONTACT_LANGUAGE (gdata_parsable_new_from_xml (GDATA_TYPE_GCONTACT_LANGUAGE, "", -1, &error)); @@ -4280,6 +4458,9 @@ test_gcontact_language (void) g_assert_cmpint (gdata_comparable_compare (GDATA_COMPARABLE (language), GDATA_COMPARABLE (language2)), !=, 0); g_object_unref (language2); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (language)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is the same */ gdata_test_assert_xml (language, "" @@ -4299,6 +4480,9 @@ test_gcontact_language (void) g_assert (gdata_gcontact_language_get_code (language) == NULL); g_assert_cmpstr (gdata_gcontact_language_get_label (language), ==, "Gobbledegook"); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (language)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is still OK */ gdata_test_assert_xml (language, "" @@ -4360,6 +4544,7 @@ test_gcontact_relation (void) { GDataGContactRelation *relation, *relation2; GError *error = NULL; + const gchar *content_type; relation = GDATA_GCONTACT_RELATION (gdata_parsable_new_from_xml (GDATA_TYPE_GCONTACT_RELATION, "Fred", -1, &error)); @@ -4377,6 +4562,9 @@ test_gcontact_relation (void) g_assert (GDATA_IS_GCONTACT_RELATION (relation2)); g_object_unref (relation2); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (relation)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is the same */ gdata_test_assert_xml (relation, "" @@ -4396,6 +4584,9 @@ test_gcontact_relation (void) g_assert (gdata_gcontact_relation_get_relation_type (relation) == NULL); g_assert_cmpstr (gdata_gcontact_relation_get_label (relation), ==, ""); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (relation)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is still OK */ gdata_test_assert_xml (relation, "" @@ -4458,6 +4649,7 @@ test_gcontact_website (void) { GDataGContactWebsite *website, *website2; GError *error = NULL; + const gchar *content_type; website = GDATA_GCONTACT_WEBSITE (gdata_parsable_new_from_xml (GDATA_TYPE_GCONTACT_WEBSITE, "" @@ -4501,6 +4696,9 @@ test_gcontact_website (void) g_assert (gdata_gcontact_website_get_label (website) == NULL); g_assert (gdata_gcontact_website_is_primary (website) == FALSE); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (website)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is still OK */ gdata_test_assert_xml (website, "" @@ -4514,6 +4712,7 @@ test_gcontact_website_label (void) { GDataGContactWebsite *website; GError *error = NULL; + const gchar *content_type; g_test_bug ("659016"); @@ -4530,6 +4729,9 @@ test_gcontact_website_label (void) g_assert_cmpstr (gdata_gcontact_website_get_label (website), ==, "Custom"); g_assert (gdata_gcontact_website_is_primary (website) == FALSE); + content_type = gdata_parsable_get_content_type (GDATA_PARSABLE (website)); + g_assert_cmpstr (content_type, ==, "application/atom+xml"); + /* Check the outputted XML is still OK */ gdata_test_assert_xml (website, "" -- cgit v1.2.1