4 * Purple is the legal property of its developers, whose names are too
5 * numerous to list here. Please refer to the COPYRIGHT file distributed
6 * with this source distribution
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or (at
11 * your option) any later version.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
28 /******************************************************************************
30 *****************************************************************************/
32 test_purple_account_option_compare(PurpleAccountOption
*opt1
,
33 PurpleAccountOption
*opt2
)
35 g_assert_cmpint(purple_account_option_get_pref_type(opt1
),
37 purple_account_option_get_pref_type(opt2
));
38 g_assert_cmpstr(purple_account_option_get_text(opt1
),
40 purple_account_option_get_text(opt2
));
41 g_assert_cmpstr(purple_account_option_get_setting(opt1
),
43 purple_account_option_get_setting(opt2
));
47 test_purple_account_option_compare_string(PurpleAccountOption
*opt1
,
48 PurpleAccountOption
*opt2
)
50 test_purple_account_option_compare(opt1
, opt2
);
52 g_assert_cmpstr(purple_account_option_get_default_string(opt1
),
54 purple_account_option_get_default_string(opt2
));
55 g_assert_cmpint(purple_account_option_string_get_masked(opt1
),
57 purple_account_option_string_get_masked(opt2
));
60 /******************************************************************************
62 *****************************************************************************/
64 test_purple_account_option_copy_int(void) {
65 PurpleAccountOption
*opt1
, *opt2
;
67 opt1
= purple_account_option_new(PURPLE_PREF_INT
, "int", "test-int");
68 opt2
= purple_account_option_copy(opt1
);
70 test_purple_account_option_compare(opt1
, opt2
);
74 test_purple_account_option_copy_int_with_default(void) {
75 PurpleAccountOption
*opt1
, *opt2
;
77 opt1
= purple_account_option_new(PURPLE_PREF_INT
, "int", "test-int");
78 purple_account_option_set_default_int(opt1
, 42);
80 opt2
= purple_account_option_copy(opt1
);
82 test_purple_account_option_compare(opt1
, opt2
);
84 g_assert_cmpint(purple_account_option_get_default_int(opt1
),
86 purple_account_option_get_default_int(opt2
));
90 test_purple_account_option_copy_string(void) {
91 PurpleAccountOption
*opt1
, *opt2
;
93 opt1
= purple_account_option_new(PURPLE_PREF_STRING
, "string", "test-string");
95 opt2
= purple_account_option_copy(opt1
);
96 test_purple_account_option_compare_string(opt1
, opt2
);
100 test_purple_account_option_copy_string_with_default(void) {
101 PurpleAccountOption
*opt1
, *opt2
;
103 opt1
= purple_account_option_new(PURPLE_PREF_STRING
, "string", "test-string");
104 purple_account_option_set_default_string(opt1
, "default");
106 opt2
= purple_account_option_copy(opt1
);
107 test_purple_account_option_compare_string(opt1
, opt2
);
111 test_purple_account_option_copy_string_with_masked(void) {
112 PurpleAccountOption
*opt1
, *opt2
;
114 opt1
= purple_account_option_new(PURPLE_PREF_STRING
, "string", "test-string");
115 purple_account_option_string_set_masked(opt1
, TRUE
);
117 opt2
= purple_account_option_copy(opt1
);
118 test_purple_account_option_compare_string(opt1
, opt2
);
121 /******************************************************************************
123 *****************************************************************************/
125 main(gint argc
, gchar
**argv
) {
128 g_test_init(&argc
, &argv
, NULL
);
130 g_test_set_nonfatal_assertions();
133 "/account_option/copy/int",
134 test_purple_account_option_copy_int
138 "/account_option/copy/int_with_default",
139 test_purple_account_option_copy_int_with_default
143 "/account_option/copy/string",
144 test_purple_account_option_copy_string
148 "/account_option/copy/string_with_default",
149 test_purple_account_option_copy_string_with_default
153 "/account_option/copy/string_with_masked",
154 test_purple_account_option_copy_string_with_masked