Mercurial > pidgin
annotate libpurple/tests/test_yahoo_util.c @ 32076:9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
done. Now, I still get a crash while changing the variant.
author | tdrhq@soc.pidgin.im |
---|---|
date | Mon, 10 Aug 2009 03:25:35 +0000 |
parents | 59d45eb5f9c9 |
children | 07de864fc024 |
rev | line source |
---|---|
27749
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
1 #include <string.h> |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
2 |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
3 #include "tests.h" |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
4 #include "../protocols/yahoo/libymsg.h" |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
5 |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
6 static void setup_codes_to_html(void) |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
7 { |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
8 yahoo_init_colorht(); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
9 } |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
10 |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
11 static void teardown_codes_to_html(void) |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
12 { |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
13 yahoo_dest_colorht(); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
14 } |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
15 |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
16 START_TEST(test_codes_to_html) |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
17 { |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
18 assert_string_equal_free("plain", yahoo_codes_to_html("plain")); |
27769
301c966fa7af
Add testing for font size
Mark Doliner <mark@kingant.net>
parents:
27750
diff
changeset
|
19 |
301c966fa7af
Add testing for font size
Mark Doliner <mark@kingant.net>
parents:
27750
diff
changeset
|
20 /* bold/italic/underline */ |
27773
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
21 assert_string_equal_free("<b>bold", |
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
22 yahoo_codes_to_html("\x1B[1mbold")); |
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
23 assert_string_equal_free("<i>italic", |
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
24 yahoo_codes_to_html("\x1B[2mitalic")); |
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
25 assert_string_equal_free("<u>underline", |
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
26 yahoo_codes_to_html("\x1B[4munderline")); |
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
27 assert_string_equal_free("<b>bold</b> <i>italic</i> <u>underline", |
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
28 yahoo_codes_to_html("\x1B[1mbold\x1B[x1m \x1B[2mitalic\x1B[x2m \x1B[4munderline")); |
27769
301c966fa7af
Add testing for font size
Mark Doliner <mark@kingant.net>
parents:
27750
diff
changeset
|
29 |
301c966fa7af
Add testing for font size
Mark Doliner <mark@kingant.net>
parents:
27750
diff
changeset
|
30 /* font color and size */ |
27773
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
31 assert_string_equal_free("<span style=\"color: #0000FF\">blue", |
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
32 yahoo_codes_to_html("\x1B[31mblue")); |
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
33 assert_string_equal_free("<span style=\"color: #70ea15\">test", |
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
34 yahoo_codes_to_html("\x1B[#70ea15mtest")); |
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
35 assert_string_equal_free("<font size=\"4\" absz=\"15\">test", |
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
36 yahoo_codes_to_html("<font size=\"15\">test")); |
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
37 assert_string_equal_free("<span style=\"color: #FF0080\"><font size=\"4\" absz=\"15\">test", |
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
38 yahoo_codes_to_html("\x1B[35m<font size=\"15\">test")); |
27749
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
39 } |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
40 END_TEST |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
41 |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
42 Suite * |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
43 yahoo_util_suite(void) |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
44 { |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
45 Suite *s = suite_create("Yahoo Utility Functions"); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
46 |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
47 TCase *tc = tcase_create("Convert to Numeric"); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
48 tcase_add_unchecked_fixture(tc, setup_codes_to_html, teardown_codes_to_html); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
49 tcase_add_test(tc, test_codes_to_html); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
50 suite_add_tcase(s, tc); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
51 |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
52 return s; |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
53 } |