annotate libpurple/tests/test_yahoo_util.c @ 27750:1b440a47dc04

Change Yahoo to send <span> tags with a color style attribute instead of <font> tags, which are deprecated in recent versions of html
author Mark Doliner <mark@kingant.net>
date Fri, 31 Jul 2009 01:28:41 +0000
parents 1b5b24dc0310
children 301c966fa7af
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"));
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
19 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
20 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
21 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
22 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"));
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
23 assert_string_equal_free("<span style=\"color: #0000FF\">blue", yahoo_codes_to_html("\x1B[31mblue"));
27749
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
24 }
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
25 END_TEST
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
26
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
27 Suite *
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
28 yahoo_util_suite(void)
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
29 {
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30 Suite *s = suite_create("Yahoo Utility Functions");
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
31
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
32 TCase *tc = tcase_create("Convert to Numeric");
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
33 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
34 tcase_add_test(tc, test_codes_to_html);
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
35 suite_add_tcase(s, tc);
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
36
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37 return s;
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
38 }