Mercurial > pidgin
annotate libpurple/tests/test_yahoo_util.c @ 28442:e0223ad82ca1
account: Don't leak the account->privacy / account->deny lists.
Multiple similar to:
==21150== 412 (32 direct, 380 indirect) bytes in 2 blocks are definitely lost in loss record 12,416 of 13,348
==21150== at 0x4C221A7: malloc (vg_replace_malloc.c:195)
==21150== by 0x90AA552: g_malloc (gmem.c:131)
==21150== by 0x90C03C7: g_slice_alloc (gslice.c:824)
==21150== by 0x90C0E05: g_slist_append (gslist.c:117)
==21150== by 0x93AE56F: purple_privacy_permit_add (privacy.c:58)
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Mon, 26 Oct 2009 04:21:28 +0000 |
parents | 43200ff042ad |
children | f4a95b3424d1 |
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 { |
27779
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
18 assert_string_equal_free("plain", |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
19 yahoo_codes_to_html("plain")); |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
20 assert_string_equal_free("unknown ansi code", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
21 yahoo_codes_to_html("unknown \x1B[12345m ansi code")); |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
22 assert_string_equal_free("plain <peanut>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
23 yahoo_codes_to_html("plain <peanut>")); |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
24 assert_string_equal_free("plain <peanut", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
25 yahoo_codes_to_html("plain <peanut")); |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
26 assert_string_equal_free("plain> peanut", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
27 yahoo_codes_to_html("plain> peanut")); |
27997
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
28 assert_string_equal_free("<font face='inva>lid'>test</font>", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
29 yahoo_codes_to_html("<font face='inva>lid'>test")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
30 assert_string_equal_free("<font face='inva>lid", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
31 yahoo_codes_to_html("<font face='inva>lid")); |
27769
301c966fa7af
Add testing for font size
Mark Doliner <mark@kingant.net>
parents:
27750
diff
changeset
|
32 |
301c966fa7af
Add testing for font size
Mark Doliner <mark@kingant.net>
parents:
27750
diff
changeset
|
33 /* bold/italic/underline */ |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
34 assert_string_equal_free("<b>bold</b>", |
27773
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
35 yahoo_codes_to_html("\x1B[1mbold")); |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
36 assert_string_equal_free("<i>italic</i>", |
27773
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
37 yahoo_codes_to_html("\x1B[2mitalic")); |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
38 assert_string_equal_free("<u>underline</u>", |
27773
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
39 yahoo_codes_to_html("\x1B[4munderline")); |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
40 assert_string_equal_free("no markup", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
41 yahoo_codes_to_html("no\x1B[x4m markup")); |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
42 assert_string_equal_free("<b>bold</b> <i>italic</i> <u>underline</u>", |
27773
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
43 yahoo_codes_to_html("\x1B[1mbold\x1B[x1m \x1B[2mitalic\x1B[x2m \x1B[4munderline")); |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
44 assert_string_equal_free("<b>bold <i>bolditalic</i></b><i> italic</i>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
45 yahoo_codes_to_html("\x1B[1mbold \x1B[2mbolditalic\x1B[x1m italic")); |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
46 assert_string_equal_free("<b>bold <i>bolditalic</i></b><i> <u>italicunderline</u></i>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
47 yahoo_codes_to_html("\x1B[1mbold \x1B[2mbolditalic\x1B[x1m \x1B[4mitalicunderline")); |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
48 assert_string_equal_free("<b>bold <i>bolditalic <u>bolditalicunderline</u></i><u> boldunderline</u></b>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
49 yahoo_codes_to_html("\x1B[1mbold \x1B[2mbolditalic \x1B[4mbolditalicunderline\x1B[x2m boldunderline")); |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
50 assert_string_equal_free("<b>bold <i>bolditalic <u>bolditalicunderline</u></i></b><i><u> italicunderline</u></i>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
51 yahoo_codes_to_html("\x1B[1mbold \x1B[2mbolditalic \x1B[4mbolditalicunderline\x1B[x1m italicunderline")); |
27769
301c966fa7af
Add testing for font size
Mark Doliner <mark@kingant.net>
parents:
27750
diff
changeset
|
52 |
27998
617e7a90b69c
Fix a possible crash when receiving URLs in yahoo. It doesn't crash for me
Mark Doliner <mark@kingant.net>
parents:
27997
diff
changeset
|
53 /* link */ |
617e7a90b69c
Fix a possible crash when receiving URLs in yahoo. It doesn't crash for me
Mark Doliner <mark@kingant.net>
parents:
27997
diff
changeset
|
54 assert_string_equal_free("http://pidgin.im/", |
617e7a90b69c
Fix a possible crash when receiving URLs in yahoo. It doesn't crash for me
Mark Doliner <mark@kingant.net>
parents:
27997
diff
changeset
|
55 yahoo_codes_to_html("\x1B[lmhttp://pidgin.im/\x1B[xlm")); |
617e7a90b69c
Fix a possible crash when receiving URLs in yahoo. It doesn't crash for me
Mark Doliner <mark@kingant.net>
parents:
27997
diff
changeset
|
56 |
27779
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
57 #ifdef USE_CSS_FORMATTING |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
58 /* font color */ |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
59 assert_string_equal_free("<span style='color: #0000FF'>blue</span>", |
27773
59d45eb5f9c9
Add a test with a custom color
Mark Doliner <mark@kingant.net>
parents:
27769
diff
changeset
|
60 yahoo_codes_to_html("\x1B[31mblue")); |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
61 assert_string_equal_free("<span style='color: #70ea15'>custom color</span>", |
27779
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
62 yahoo_codes_to_html("\x1B[#70ea15mcustom color")); |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
63 |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
64 /* font face */ |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
65 assert_string_equal_free("<font face='Georgia'>test</font>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
66 yahoo_codes_to_html("<font face='Georgia'>test</font>")); |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
67 |
27779
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
68 /* font size */ |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
69 assert_string_equal_free("<font><span style='font-size: 15pt'>test</span></font>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
70 yahoo_codes_to_html("<font size='15'>test")); |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
71 assert_string_equal_free("<font><span style='font-size: 32pt'>size 32</span></font>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
72 yahoo_codes_to_html("<font size='32'>size 32")); |
27779
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
73 |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
74 /* combinations */ |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
75 assert_string_equal_free("<font face='Georgia'><span style='font-size: 32pt'>test</span></font>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
76 yahoo_codes_to_html("<font face='Georgia' size='32'>test")); |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
77 assert_string_equal_free("<span style='color: #FF0080'><font><span style='font-size: 15pt'>test</span></font></span>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
78 yahoo_codes_to_html("\x1B[35m<font size='15'>test")); |
27779
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
79 #else |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
80 /* font color */ |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
81 assert_string_equal_free("<font color='#0000FF'>blue</font>", |
27779
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
82 yahoo_codes_to_html("\x1B[31mblue")); |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
83 assert_string_equal_free("<font color='#70ea15'>custom color</font>", |
27779
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
84 yahoo_codes_to_html("\x1B[#70ea15mcustom color")); |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
85 assert_string_equal_free("test", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
86 yahoo_codes_to_html("<ALT #ff0000,#00ff00,#0000ff>test</ALT>")); |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
87 |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
88 /* font face */ |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
89 assert_string_equal_free("<font face='Georgia'>test</font>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
90 yahoo_codes_to_html("<font face='Georgia'>test")); |
27779
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
91 |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
92 /* font size */ |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
93 assert_string_equal_free("<font size='4' absz='15'>test</font>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
94 yahoo_codes_to_html("<font size='15'>test")); |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
95 assert_string_equal_free("<font size='6' absz='32'>size 32</font>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
96 yahoo_codes_to_html("<font size='32'>size 32")); |
27779
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
97 |
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
98 /* combinations */ |
27815
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
99 assert_string_equal_free("<font face='Georgia' size='6' absz='32'>test</font>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
100 yahoo_codes_to_html("<font face='Georgia' size='32'>test")); |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
101 assert_string_equal_free("<font color='#FF0080'><font size='4' absz='15'>test</font></font>", |
1e02e65ce301
Changes to the way we translate raw yahoo messages to HTML. The HTML
Mark Doliner <mark@kingant.net>
parents:
27779
diff
changeset
|
102 yahoo_codes_to_html("\x1B[35m<font size='15'>test")); |
28059
1d2425f2e4ff
Woah, this was wrong. MY BAD! We should not be setting this to true
Mark Doliner <mark@kingant.net>
parents:
28034
diff
changeset
|
103 assert_string_equal_free(":<", |
1d2425f2e4ff
Woah, this was wrong. MY BAD! We should not be setting this to true
Mark Doliner <mark@kingant.net>
parents:
28034
diff
changeset
|
104 yahoo_codes_to_html("<FADE #ff0000,#00ff00,#0000ff>:<</FADE>")); |
27779
07de864fc024
Change yahoo_codes_to_html() to use the same USE_CSS_FORMATTING #define
Mark Doliner <mark@kingant.net>
parents:
27773
diff
changeset
|
105 #endif /* !USE_CSS_FORMATTING */ |
27749
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
106 } |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
107 END_TEST |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
108 |
27997
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
109 START_TEST(test_html_to_codes) |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
110 { |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
111 assert_string_equal_free("plain", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
112 yahoo_html_to_codes("plain")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
113 assert_string_equal_free("plain <peanut>", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
114 yahoo_html_to_codes("plain <peanut>")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
115 assert_string_equal_free("plain <peanut", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
116 yahoo_html_to_codes("plain <peanut")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
117 assert_string_equal_free("plain> peanut", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
118 yahoo_html_to_codes("plain> peanut")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
119 assert_string_equal_free("plain >", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
120 yahoo_html_to_codes("plain >")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
121 assert_string_equal_free("plain > ", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
122 yahoo_html_to_codes("plain > ")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
123 assert_string_equal_free("plain <", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
124 yahoo_html_to_codes("plain <")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
125 assert_string_equal_free("plain < ", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
126 yahoo_html_to_codes("plain < ")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
127 assert_string_equal_free("plain <", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
128 yahoo_html_to_codes("plain <")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
129 assert_string_equal_free("plain &", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
130 yahoo_html_to_codes("plain &")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
131 |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
132 /* bold/italic/underline */ |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
133 assert_string_equal_free("\x1B[1mbold\x1B[x1m", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
134 yahoo_html_to_codes("<b>bold</b>")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
135 assert_string_equal_free("\x1B[2mitalic\x1B[x2m", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
136 yahoo_html_to_codes("<i>italic</i>")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
137 assert_string_equal_free("\x1B[4munderline\x1B[x4m", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
138 yahoo_html_to_codes("<u>underline</u>")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
139 assert_string_equal_free("no markup", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
140 yahoo_html_to_codes("no</u> markup")); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
141 assert_string_equal_free("\x1B[1mbold\x1B[x1m \x1B[2mitalic\x1B[x2m \x1B[4munderline\x1B[x4m", |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
142 yahoo_html_to_codes("<b>bold</b> <i>italic</i> <u>underline</u>")); |
28012
c06114f3d58d
* Change yahoo_html_to_codes() a little to hopefully be more straight forward
Mark Doliner <mark@kingant.net>
parents:
27998
diff
changeset
|
143 assert_string_equal_free("\x1B[1mbold \x1B[2mbolditalic\x1B[x2m\x1B[x1m\x1B[2m italic\x1B[x2m", |
27997
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
144 yahoo_html_to_codes("<b>bold <i>bolditalic</i></b><i> italic</i>")); |
28012
c06114f3d58d
* Change yahoo_html_to_codes() a little to hopefully be more straight forward
Mark Doliner <mark@kingant.net>
parents:
27998
diff
changeset
|
145 assert_string_equal_free("\x1B[1mbold \x1B[2mbolditalic\x1B[x2m\x1B[x1m\x1B[2m \x1B[4mitalicunderline\x1B[x4m\x1B[x2m", |
27997
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
146 yahoo_html_to_codes("<b>bold <i>bolditalic</i></b><i> <u>italicunderline</u></i>")); |
28013
b289449f3e9f
Make outgoing yahoo messages with links, font color, font face or font size
Mark Doliner <mark@kingant.net>
parents:
28012
diff
changeset
|
147 |
28019
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
148 /* link */ |
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
149 assert_string_equal_free("http://pidgin.im/", |
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
150 yahoo_html_to_codes("<A HREF=\"http://pidgin.im/\">http://pidgin.im/</A>")); |
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
151 assert_string_equal_free("mark@example.com", |
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
152 yahoo_html_to_codes("<A HREF=\"mailto:mark@example.com\">mark@example.com</A>")); |
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
153 #if 0 |
28033
2a6f0c2460ae
Fix a bug in our outgoing yahoo message formatting where messages
Mark Doliner <mark@kingant.net>
parents:
28019
diff
changeset
|
154 assert_string_equal_free("Pidgin (http://pidgin.im/)", |
28019
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
155 yahoo_html_to_codes("<A HREF=\"http://pidgin.im/\">Pidgin</A>")); |
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
156 #endif |
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
157 |
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
158 /* font nothing */ |
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
159 assert_string_equal_free("nothing", |
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
160 yahoo_html_to_codes("<font>nothing</font>")); |
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
161 |
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
162 /* font color */ |
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
163 assert_string_equal_free("\x1B[#E71414mred\x1B[#000000m", |
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
164 yahoo_html_to_codes("<font color=\"#E71414\">red</font>")); |
28033
2a6f0c2460ae
Fix a bug in our outgoing yahoo message formatting where messages
Mark Doliner <mark@kingant.net>
parents:
28019
diff
changeset
|
165 assert_string_equal_free("\x1B[#FF0000mred\x1B[#000000m \x1B[#0000FFmblue\x1B[#000000m black", |
2a6f0c2460ae
Fix a bug in our outgoing yahoo message formatting where messages
Mark Doliner <mark@kingant.net>
parents:
28019
diff
changeset
|
166 yahoo_html_to_codes("<font color=\"#FF0000\">red</font> <font color=\"#0000FF\">blue</font> black")); |
28019
5ff49aa05439
Don't put stuff into a linked list only to iterate through the linked list
Mark Doliner <mark@kingant.net>
parents:
28013
diff
changeset
|
167 |
28013
b289449f3e9f
Make outgoing yahoo messages with links, font color, font face or font size
Mark Doliner <mark@kingant.net>
parents:
28012
diff
changeset
|
168 /* font size */ |
b289449f3e9f
Make outgoing yahoo messages with links, font color, font face or font size
Mark Doliner <mark@kingant.net>
parents:
28012
diff
changeset
|
169 assert_string_equal_free("<font size=\"10\">test</font>", |
b289449f3e9f
Make outgoing yahoo messages with links, font color, font face or font size
Mark Doliner <mark@kingant.net>
parents:
28012
diff
changeset
|
170 yahoo_html_to_codes("<font size=\"2\">test</font>")); |
b289449f3e9f
Make outgoing yahoo messages with links, font color, font face or font size
Mark Doliner <mark@kingant.net>
parents:
28012
diff
changeset
|
171 assert_string_equal_free("<font size=\"30\">test</font>", |
b289449f3e9f
Make outgoing yahoo messages with links, font color, font face or font size
Mark Doliner <mark@kingant.net>
parents:
28012
diff
changeset
|
172 yahoo_html_to_codes("<font size=\"6\">test</font>")); |
28033
2a6f0c2460ae
Fix a bug in our outgoing yahoo message formatting where messages
Mark Doliner <mark@kingant.net>
parents:
28019
diff
changeset
|
173 |
2a6f0c2460ae
Fix a bug in our outgoing yahoo message formatting where messages
Mark Doliner <mark@kingant.net>
parents:
28019
diff
changeset
|
174 /* combinations */ |
2a6f0c2460ae
Fix a bug in our outgoing yahoo message formatting where messages
Mark Doliner <mark@kingant.net>
parents:
28019
diff
changeset
|
175 assert_string_equal_free("\x1B[#FF0000m<font size=\"8\">redsmall</font> rednormal\x1B[#000000m", |
2a6f0c2460ae
Fix a bug in our outgoing yahoo message formatting where messages
Mark Doliner <mark@kingant.net>
parents:
28019
diff
changeset
|
176 yahoo_html_to_codes("<font color=\"#FF0000\"><font size=\"1\">redsmall</font> rednormal</font>")); |
2a6f0c2460ae
Fix a bug in our outgoing yahoo message formatting where messages
Mark Doliner <mark@kingant.net>
parents:
28019
diff
changeset
|
177 |
2a6f0c2460ae
Fix a bug in our outgoing yahoo message formatting where messages
Mark Doliner <mark@kingant.net>
parents:
28019
diff
changeset
|
178 assert_string_equal_free("\x1B[#FF0000m<font size=\"8\">redsmall</font> \x1B[#00FF00mgreennormal\x1B[#FF0000m rednormal\x1B[#000000m", |
2a6f0c2460ae
Fix a bug in our outgoing yahoo message formatting where messages
Mark Doliner <mark@kingant.net>
parents:
28019
diff
changeset
|
179 yahoo_html_to_codes("<font color=\"#FF0000\"><font size=\"1\">redsmall</font> <font color=\"#00FF00\">greennormal</font> rednormal</font>")); |
2a6f0c2460ae
Fix a bug in our outgoing yahoo message formatting where messages
Mark Doliner <mark@kingant.net>
parents:
28019
diff
changeset
|
180 |
2a6f0c2460ae
Fix a bug in our outgoing yahoo message formatting where messages
Mark Doliner <mark@kingant.net>
parents:
28019
diff
changeset
|
181 assert_string_equal_free("\x1B[1mbold \x1B[#FF0000mred <font face=\"Comic Sans MS\" size=\"20\">larger \x1B[#000000mbacktoblack <font size=\"12\">normalsize</font>\x1B[#FF0000m</font>\x1B[#000000m\x1B[x1m", |
2a6f0c2460ae
Fix a bug in our outgoing yahoo message formatting where messages
Mark Doliner <mark@kingant.net>
parents:
28019
diff
changeset
|
182 yahoo_html_to_codes("<b>bold <font color=\"#FF0000\">red <font face=\"Comic Sans MS\" size=\"5\">larger <font color=\"#000000\">backtoblack <font size=\"3\">normalsize</font></font></font></font></b>")); |
28332
43200ff042ad
Fix sending /buzz on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28059
diff
changeset
|
183 |
43200ff042ad
Fix sending /buzz on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28059
diff
changeset
|
184 /* buzz/unknown tags */ |
43200ff042ad
Fix sending /buzz on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28059
diff
changeset
|
185 assert_string_equal_free("<ding>", |
43200ff042ad
Fix sending /buzz on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28059
diff
changeset
|
186 yahoo_html_to_codes("<ding>")); |
43200ff042ad
Fix sending /buzz on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28059
diff
changeset
|
187 assert_string_equal_free("Unknown <tags>", |
43200ff042ad
Fix sending /buzz on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28059
diff
changeset
|
188 yahoo_html_to_codes("Unknown <tags>")); |
27997
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
189 } |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
190 END_TEST |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
191 |
27749
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
192 Suite * |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
193 yahoo_util_suite(void) |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
194 { |
27997
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
195 Suite *s; |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
196 TCase *tc; |
27749
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
197 |
27997
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
198 s = suite_create("Yahoo Utility Functions"); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
199 |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
200 tc = tcase_create("Convert IM from network format to HTML"); |
27749
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
201 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
|
202 tcase_add_test(tc, test_codes_to_html); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
203 suite_add_tcase(s, tc); |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
204 |
27997
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
205 tc = tcase_create("Convert IM from HTML to network format"); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
206 tcase_add_test(tc, test_html_to_codes); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
207 suite_add_tcase(s, tc); |
c69c79921f93
Check in some more tests, most of which are not compiled yet. I think
Mark Doliner <mark@kingant.net>
parents:
27815
diff
changeset
|
208 |
27749
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
209 return s; |
1b5b24dc0310
Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff
changeset
|
210 } |