Mercurial > pidgin
annotate libpurple/tests/test_yahoo_util.c @ 27769:301c966fa7af
Add testing for font size
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 31 Jul 2009 09:18:07 +0000 |
parents | 1b440a47dc04 |
children | 59d45eb5f9c9 |
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 */ |
27749
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
21 assert_string_equal_free("<b>bold", yahoo_codes_to_html("\x1B[1mbold")); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
22 assert_string_equal_free("<i>italic", yahoo_codes_to_html("\x1B[2mitalic")); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
23 assert_string_equal_free("<u>underline", yahoo_codes_to_html("\x1B[4munderline")); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
24 assert_string_equal_free("<b>bold</b> <i>italic</i> <u>underline", 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
|
25 |
301c966fa7af
Add testing for font size
Mark Doliner <mark@kingant.net>
parents:
27750
diff
changeset
|
26 /* font color and size */ |
27750
1b440a47dc04
Change Yahoo to send <span> tags with a color style attribute instead of <font>
Mark Doliner <mark@kingant.net>
parents:
27749
diff
changeset
|
27 assert_string_equal_free("<span style=\"color: #0000FF\">blue", yahoo_codes_to_html("\x1B[31mblue")); |
27769
301c966fa7af
Add testing for font size
Mark Doliner <mark@kingant.net>
parents:
27750
diff
changeset
|
28 assert_string_equal_free("<font size=\"4\" absz=\"15\">test", yahoo_codes_to_html("<font size=\"15\">test")); |
301c966fa7af
Add testing for font size
Mark Doliner <mark@kingant.net>
parents:
27750
diff
changeset
|
29 assert_string_equal_free("<span style=\"color: #FF0080\"><font size=\"4\" absz=\"15\">test", 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
|
30 } |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
31 END_TEST |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
32 |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
33 Suite * |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
34 yahoo_util_suite(void) |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
35 { |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
36 Suite *s = suite_create("Yahoo Utility Functions"); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
37 |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
38 TCase *tc = tcase_create("Convert to Numeric"); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
39 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
|
40 tcase_add_test(tc, test_codes_to_html); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
41 suite_add_tcase(s, tc); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
42 |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
43 return s; |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
44 } |