libpurple/tests/test_yahoo_util.c

Wed, 19 Aug 2009 22:01:10 +0000

author
Mark Doliner <markdoliner@pidgin.im>
date
Wed, 19 Aug 2009 22:01:10 +0000
changeset 28292
e1f21cbb9b4d
parent 28240
2022259114fc
child 28293
8f160f6f9980
permissions
-rw-r--r--

* Change yahoo_html_to_codes() a little to hopefully be more straight forward
and more similar to yahoo_codes_to_html()
* Add documentation to yahoo_html_to_codes() that explains the differences
between the encoded text that we send and the encoded text sent by yahoo
* Enable the test caes for yahoo_html_to_codes()

28015
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
1 #include <string.h>
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
2
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
3 #include "tests.h"
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
4 #include "../protocols/yahoo/libymsg.h"
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
5
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
6 static void setup_codes_to_html(void)
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
7 {
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
8 yahoo_init_colorht();
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
9 }
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
10
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
11 static void teardown_codes_to_html(void)
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
12 {
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
13 yahoo_dest_colorht();
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
14 }
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
15
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
16 START_TEST(test_codes_to_html)
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
17 {
28045
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
18 assert_string_equal_free("plain",
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
19 yahoo_codes_to_html("plain"));
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
20 assert_string_equal_free("unknown ansi code",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
21 yahoo_codes_to_html("unknown \x1B[12345m ansi code"));
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
22 assert_string_equal_free("plain &lt;peanut&gt;",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
23 yahoo_codes_to_html("plain <peanut>"));
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
24 assert_string_equal_free("plain &lt;peanut",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
25 yahoo_codes_to_html("plain <peanut"));
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
26 assert_string_equal_free("plain&gt; peanut",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
27 yahoo_codes_to_html("plain> peanut"));
28239
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
28 assert_string_equal_free("<font face='inva&gt;lid'>test</font>",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
29 yahoo_codes_to_html("<font face='inva>lid'>test"));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
30 assert_string_equal_free("&lt;font face=&apos;inva&gt;lid",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
31 yahoo_codes_to_html("<font face='inva>lid"));
28039
cc21081104cc Add testing for font size
Mark Doliner <markdoliner@pidgin.im>
parents: 28016
diff changeset
32
cc21081104cc Add testing for font size
Mark Doliner <markdoliner@pidgin.im>
parents: 28016
diff changeset
33 /* bold/italic/underline */
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
34 assert_string_equal_free("<b>bold</b>",
28042
fdfd28802533 Add a test with a custom color
Mark Doliner <markdoliner@pidgin.im>
parents: 28039
diff changeset
35 yahoo_codes_to_html("\x1B[1mbold"));
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
36 assert_string_equal_free("<i>italic</i>",
28042
fdfd28802533 Add a test with a custom color
Mark Doliner <markdoliner@pidgin.im>
parents: 28039
diff changeset
37 yahoo_codes_to_html("\x1B[2mitalic"));
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
38 assert_string_equal_free("<u>underline</u>",
28042
fdfd28802533 Add a test with a custom color
Mark Doliner <markdoliner@pidgin.im>
parents: 28039
diff changeset
39 yahoo_codes_to_html("\x1B[4munderline"));
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
40 assert_string_equal_free("no markup",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
41 yahoo_codes_to_html("no\x1B[x4m markup"));
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
42 assert_string_equal_free("<b>bold</b> <i>italic</i> <u>underline</u>",
28042
fdfd28802533 Add a test with a custom color
Mark Doliner <markdoliner@pidgin.im>
parents: 28039
diff changeset
43 yahoo_codes_to_html("\x1B[1mbold\x1B[x1m \x1B[2mitalic\x1B[x2m \x1B[4munderline"));
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
44 assert_string_equal_free("<b>bold <i>bolditalic</i></b><i> italic</i>",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
45 yahoo_codes_to_html("\x1B[1mbold \x1B[2mbolditalic\x1B[x1m italic"));
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
46 assert_string_equal_free("<b>bold <i>bolditalic</i></b><i> <u>italicunderline</u></i>",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
47 yahoo_codes_to_html("\x1B[1mbold \x1B[2mbolditalic\x1B[x1m \x1B[4mitalicunderline"));
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
48 assert_string_equal_free("<b>bold <i>bolditalic <u>bolditalicunderline</u></i><u> boldunderline</u></b>",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
49 yahoo_codes_to_html("\x1B[1mbold \x1B[2mbolditalic \x1B[4mbolditalicunderline\x1B[x2m boldunderline"));
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
50 assert_string_equal_free("<b>bold <i>bolditalic <u>bolditalicunderline</u></i></b><i><u> italicunderline</u></i>",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
51 yahoo_codes_to_html("\x1B[1mbold \x1B[2mbolditalic \x1B[4mbolditalicunderline\x1B[x1m italicunderline"));
28039
cc21081104cc Add testing for font size
Mark Doliner <markdoliner@pidgin.im>
parents: 28016
diff changeset
52
28240
2022259114fc Fix a possible crash when receiving URLs in yahoo. It doesn't crash for me
Mark Doliner <markdoliner@pidgin.im>
parents: 28239
diff changeset
53 /* link */
2022259114fc Fix a possible crash when receiving URLs in yahoo. It doesn't crash for me
Mark Doliner <markdoliner@pidgin.im>
parents: 28239
diff changeset
54 assert_string_equal_free("http://pidgin.im/",
2022259114fc Fix a possible crash when receiving URLs in yahoo. It doesn't crash for me
Mark Doliner <markdoliner@pidgin.im>
parents: 28239
diff changeset
55 yahoo_codes_to_html("\x1B[lmhttp://pidgin.im/\x1B[xlm"));
2022259114fc Fix a possible crash when receiving URLs in yahoo. It doesn't crash for me
Mark Doliner <markdoliner@pidgin.im>
parents: 28239
diff changeset
56
28045
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
57 #ifdef USE_CSS_FORMATTING
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
58 /* font color */
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
59 assert_string_equal_free("<span style='color: #0000FF'>blue</span>",
28042
fdfd28802533 Add a test with a custom color
Mark Doliner <markdoliner@pidgin.im>
parents: 28039
diff changeset
60 yahoo_codes_to_html("\x1B[31mblue"));
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
61 assert_string_equal_free("<span style='color: #70ea15'>custom color</span>",
28045
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
62 yahoo_codes_to_html("\x1B[#70ea15mcustom color"));
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
63
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
64 /* font face */
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
65 assert_string_equal_free("<font face='Georgia'>test</font>",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
66 yahoo_codes_to_html("<font face='Georgia'>test</font>"));
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
67
28045
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
68 /* font size */
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
69 assert_string_equal_free("<font><span style='font-size: 15pt'>test</span></font>",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
70 yahoo_codes_to_html("<font size='15'>test"));
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
71 assert_string_equal_free("<font><span style='font-size: 32pt'>size 32</span></font>",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
72 yahoo_codes_to_html("<font size='32'>size 32"));
28045
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
73
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
74 /* combinations */
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
75 assert_string_equal_free("<font face='Georgia'><span style='font-size: 32pt'>test</span></font>",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
76 yahoo_codes_to_html("<font face='Georgia' size='32'>test"));
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
77 assert_string_equal_free("<span style='color: #FF0080'><font><span style='font-size: 15pt'>test</span></font></span>",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
78 yahoo_codes_to_html("\x1B[35m<font size='15'>test"));
28045
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
79 #else
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
80 /* font color */
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
81 assert_string_equal_free("<font color='#0000FF'>blue</font>",
28045
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
82 yahoo_codes_to_html("\x1B[31mblue"));
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
83 assert_string_equal_free("<font color='#70ea15'>custom color</font>",
28045
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
84 yahoo_codes_to_html("\x1B[#70ea15mcustom color"));
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
85 assert_string_equal_free("test",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
86 yahoo_codes_to_html("<ALT #ff0000,#00ff00,#0000ff>test</ALT>"));
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
87
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
88 /* font face */
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
89 assert_string_equal_free("<font face='Georgia'>test</font>",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
90 yahoo_codes_to_html("<font face='Georgia'>test"));
28045
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
91
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
92 /* font size */
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
93 assert_string_equal_free("<font size='4' absz='15'>test</font>",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
94 yahoo_codes_to_html("<font size='15'>test"));
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
95 assert_string_equal_free("<font size='6' absz='32'>size 32</font>",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
96 yahoo_codes_to_html("<font size='32'>size 32"));
28045
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
97
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
98 /* combinations */
28093
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
99 assert_string_equal_free("<font face='Georgia' size='6' absz='32'>test</font>",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
100 yahoo_codes_to_html("<font face='Georgia' size='32'>test"));
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
101 assert_string_equal_free("<font color='#FF0080'><font size='4' absz='15'>test</font></font>",
e21ce2c8991d Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <markdoliner@pidgin.im>
parents: 28045
diff changeset
102 yahoo_codes_to_html("\x1B[35m<font size='15'>test"));
28045
dca626985d99 Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <markdoliner@pidgin.im>
parents: 28042
diff changeset
103 #endif /* !USE_CSS_FORMATTING */
28015
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
104 }
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
105 END_TEST
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
106
28239
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
107 START_TEST(test_html_to_codes)
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
108 {
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
109 assert_string_equal_free("plain",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
110 yahoo_html_to_codes("plain"));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
111 assert_string_equal_free("plain <peanut>",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
112 yahoo_html_to_codes("plain &lt;peanut&gt;"));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
113 assert_string_equal_free("plain <peanut",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
114 yahoo_html_to_codes("plain &lt;peanut"));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
115 assert_string_equal_free("plain> peanut",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
116 yahoo_html_to_codes("plain&gt; peanut"));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
117 assert_string_equal_free("plain >",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
118 yahoo_html_to_codes("plain &gt;"));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
119 assert_string_equal_free("plain > ",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
120 yahoo_html_to_codes("plain &gt; "));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
121 assert_string_equal_free("plain <",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
122 yahoo_html_to_codes("plain &lt;"));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
123 assert_string_equal_free("plain < ",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
124 yahoo_html_to_codes("plain &lt; "));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
125 assert_string_equal_free("plain &lt",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
126 yahoo_html_to_codes("plain &lt"));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
127 assert_string_equal_free("plain &",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
128 yahoo_html_to_codes("plain &amp;"));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
129
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
130 /* bold/italic/underline */
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
131 assert_string_equal_free("\x1B[1mbold\x1B[x1m",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
132 yahoo_html_to_codes("<b>bold</b>"));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
133 assert_string_equal_free("\x1B[2mitalic\x1B[x2m",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
134 yahoo_html_to_codes("<i>italic</i>"));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
135 assert_string_equal_free("\x1B[4munderline\x1B[x4m",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
136 yahoo_html_to_codes("<u>underline</u>"));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
137 assert_string_equal_free("no markup",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
138 yahoo_html_to_codes("no</u> markup"));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
139 assert_string_equal_free("\x1B[1mbold\x1B[x1m \x1B[2mitalic\x1B[x2m \x1B[4munderline\x1B[x4m",
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
140 yahoo_html_to_codes("<b>bold</b> <i>italic</i> <u>underline</u>"));
28292
e1f21cbb9b4d * Change yahoo_html_to_codes() a little to hopefully be more straight forward
Mark Doliner <markdoliner@pidgin.im>
parents: 28240
diff changeset
141 assert_string_equal_free("\x1B[1mbold \x1B[2mbolditalic\x1B[x2m\x1B[x1m\x1B[2m italic\x1B[x2m",
28239
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
142 yahoo_html_to_codes("<b>bold <i>bolditalic</i></b><i> italic</i>"));
28292
e1f21cbb9b4d * Change yahoo_html_to_codes() a little to hopefully be more straight forward
Mark Doliner <markdoliner@pidgin.im>
parents: 28240
diff changeset
143 assert_string_equal_free("\x1B[1mbold \x1B[2mbolditalic\x1B[x2m\x1B[x1m\x1B[2m \x1B[4mitalicunderline\x1B[x4m\x1B[x2m",
28239
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
144 yahoo_html_to_codes("<b>bold <i>bolditalic</i></b><i> <u>italicunderline</u></i>"));
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
145 }
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
146 END_TEST
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
147
28015
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
148 Suite *
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
149 yahoo_util_suite(void)
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
150 {
28239
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
151 Suite *s;
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
152 TCase *tc;
28015
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
153
28239
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
154 s = suite_create("Yahoo Utility Functions");
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
155
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
156 tc = tcase_create("Convert IM from network format to HTML");
28015
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
157 tcase_add_unchecked_fixture(tc, setup_codes_to_html, teardown_codes_to_html);
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
158 tcase_add_test(tc, test_codes_to_html);
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
159 suite_add_tcase(s, tc);
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
160
28239
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
161 tc = tcase_create("Convert IM from HTML to network format");
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
162 tcase_add_test(tc, test_html_to_codes);
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
163 suite_add_tcase(s, tc);
2315ae670917 Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <markdoliner@pidgin.im>
parents: 28093
diff changeset
164
28015
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
165 return s;
c09be470c8ec Whoops, I forgot to add the test!
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
166 }

mercurial