| 45 PurpleAccount *account = NULL; |
45 PurpleAccount *account = NULL; |
| 46 PurpleAccount *account1 = NULL; |
46 PurpleAccount *account1 = NULL; |
| 47 PurpleContact *contact = NULL; |
47 PurpleContact *contact = NULL; |
| 48 PurplePerson *person = NULL; |
48 PurplePerson *person = NULL; |
| 49 PurplePerson *person1 = NULL; |
49 PurplePerson *person1 = NULL; |
| 50 PurplePresence *presence = NULL; |
|
| 51 PurplePresence *presence1 = NULL; |
50 PurplePresence *presence1 = NULL; |
| 52 PurpleTags *tags = NULL; |
51 PurpleTags *tags = NULL; |
| 53 GdkPixbuf *avatar = NULL; |
52 GdkPixbuf *avatar = NULL; |
| 54 GdkPixbuf *avatar1 = NULL; |
53 GdkPixbuf *avatar1 = NULL; |
| 55 gchar *id = NULL; |
54 gchar *id = NULL; |
| 57 gchar *display_name = NULL; |
56 gchar *display_name = NULL; |
| 58 gchar *alias = NULL; |
57 gchar *alias = NULL; |
| 59 |
58 |
| 60 account = purple_account_new("test", "test"); |
59 account = purple_account_new("test", "test"); |
| 61 avatar = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, 1, 1); |
60 avatar = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, 1, 1); |
| 62 presence = g_object_new(PURPLE_TYPE_PRESENCE, NULL); |
|
| 63 person = purple_person_new(); |
61 person = purple_person_new(); |
| 64 |
62 |
| 65 /* Use g_object_new so we can test setting properties by name. All of them |
63 /* Use g_object_new so we can test setting properties by name. All of them |
| 66 * call the setter methods, so by doing it this way we exercise more of the |
64 * call the setter methods, so by doing it this way we exercise more of the |
| 67 * code. |
65 * code. |
| 72 "id", "id1", |
70 "id", "id1", |
| 73 "username", "username", |
71 "username", "username", |
| 74 "display-name", "display-name", |
72 "display-name", "display-name", |
| 75 "alias", "alias", |
73 "alias", "alias", |
| 76 "avatar", avatar, |
74 "avatar", avatar, |
| 77 "presence", presence, |
|
| 78 "person", person, |
75 "person", person, |
| 79 NULL); |
76 NULL); |
| 80 |
77 |
| 81 /* Now use g_object_get to read all of the properties. */ |
78 /* Now use g_object_get to read all of the properties. */ |
| 82 g_object_get(contact, |
79 g_object_get(contact, |
| 96 g_assert_true(account1 == account); |
93 g_assert_true(account1 == account); |
| 97 g_assert_cmpstr(username, ==, "username"); |
94 g_assert_cmpstr(username, ==, "username"); |
| 98 g_assert_cmpstr(display_name, ==, "display-name"); |
95 g_assert_cmpstr(display_name, ==, "display-name"); |
| 99 g_assert_cmpstr(alias, ==, "alias"); |
96 g_assert_cmpstr(alias, ==, "alias"); |
| 100 g_assert_true(avatar1 == avatar); |
97 g_assert_true(avatar1 == avatar); |
| 101 g_assert_true(presence1 == presence); |
98 g_assert_nonnull(presence1); |
| 102 g_assert_nonnull(tags); |
99 g_assert_nonnull(tags); |
| 103 g_assert_true(person1 == person); |
100 g_assert_true(person1 == person); |
| 104 |
101 |
| 105 /* Free/unref all the things. */ |
102 /* Free/unref all the things. */ |
| 106 g_clear_pointer(&id, g_free); |
103 g_clear_pointer(&id, g_free); |
| 112 g_clear_object(&presence1); |
109 g_clear_object(&presence1); |
| 113 g_clear_object(&tags); |
110 g_clear_object(&tags); |
| 114 g_clear_object(&person); |
111 g_clear_object(&person); |
| 115 g_clear_object(&person1); |
112 g_clear_object(&person1); |
| 116 |
113 |
| 117 g_clear_object(&presence); |
|
| 118 g_clear_object(&avatar); |
114 g_clear_object(&avatar); |
| 119 g_clear_object(&contact); |
115 g_clear_object(&contact); |
| 120 g_clear_object(&account); |
116 g_clear_object(&account); |
| 121 } |
117 } |
| 122 |
118 |