Merge branch 'wip/29-ms-breaks-plain-sigs' into 'master'
Fix plain text signatures losing their formatting when rendered by MS products See merge request GNOME/geary!33
This commit is contained in:
commit
f3ad1fe00d
5 changed files with 98 additions and 44 deletions
|
|
@ -9,6 +9,7 @@ class Geary.HTML.UtilTest : TestCase {
|
|||
|
||||
public UtilTest() {
|
||||
base("Geary.HTML.Util");
|
||||
add_test("preserve_whitespace", preserve_whitespace);
|
||||
add_test("smart_escape_div", smart_escape_div);
|
||||
add_test("smart_escape_no_closing_tag", smart_escape_no_closing_tag);
|
||||
add_test("smart_escape_img", smart_escape_img);
|
||||
|
|
@ -19,39 +20,62 @@ class Geary.HTML.UtilTest : TestCase {
|
|||
add_test("remove_html_tags", remove_html_tags);
|
||||
}
|
||||
|
||||
public void preserve_whitespace() throws GLib.Error {
|
||||
assert_string("some text", Geary.HTML.smart_escape("some text"));
|
||||
assert_string("some text", Geary.HTML.smart_escape("some text"));
|
||||
assert_string("some text", Geary.HTML.smart_escape("some text"));
|
||||
assert_string("some text", Geary.HTML.smart_escape("some\ttext"));
|
||||
|
||||
assert_string("some<br>text", Geary.HTML.smart_escape("some\ntext"));
|
||||
assert_string("some<br>text", Geary.HTML.smart_escape("some\rtext"));
|
||||
assert_string("some<br>text", Geary.HTML.smart_escape("some\r\ntext"));
|
||||
|
||||
assert_string("some<br><br>text", Geary.HTML.smart_escape("some\n\ntext"));
|
||||
assert_string("some<br><br>text", Geary.HTML.smart_escape("some\r\rtext"));
|
||||
assert_string("some<br><br>text", Geary.HTML.smart_escape("some\n\rtext"));
|
||||
assert_string("some<br><br>text", Geary.HTML.smart_escape("some\r\n\r\ntext"));
|
||||
}
|
||||
|
||||
public void smart_escape_div() throws Error {
|
||||
string html = "<div>ohhai</div>";
|
||||
assert(Geary.HTML.smart_escape(html, false) == html);
|
||||
assert(Geary.HTML.smart_escape(html) == html);
|
||||
}
|
||||
|
||||
public void smart_escape_no_closing_tag() throws Error {
|
||||
string html = "<div>ohhai";
|
||||
assert(Geary.HTML.smart_escape(html, false) == html);
|
||||
assert(Geary.HTML.smart_escape(html) == html);
|
||||
}
|
||||
|
||||
public void smart_escape_img() throws Error {
|
||||
string html = "<img src=\"http://example.com/lol.gif\">";
|
||||
assert(Geary.HTML.smart_escape(html, false) == html);
|
||||
assert(Geary.HTML.smart_escape(html) == html);
|
||||
}
|
||||
|
||||
public void smart_escape_xhtml_img() throws Error {
|
||||
string html = "<img src=\"http://example.com/lol.gif\"/>";
|
||||
assert(Geary.HTML.smart_escape(html, false) == html);
|
||||
assert(Geary.HTML.smart_escape(html) == html);
|
||||
}
|
||||
|
||||
public void smart_escape_mixed() throws Error {
|
||||
string html = "mixed <div>ohhai</div> text";
|
||||
assert(Geary.HTML.smart_escape(html, false) == html);
|
||||
assert(Geary.HTML.smart_escape(html) == html);
|
||||
}
|
||||
|
||||
public void smart_escape_text() throws Error {
|
||||
string text = "some text";
|
||||
assert(Geary.HTML.smart_escape(text, false) == "<div style='white-space: pre-wrap;'>some text</div>");
|
||||
public void smart_escape_text() throws GLib.Error {
|
||||
assert_string("some text", Geary.HTML.smart_escape("some text"));
|
||||
assert_string("<some text", Geary.HTML.smart_escape("<some text"));
|
||||
assert_string("some text>", Geary.HTML.smart_escape("some text>"));
|
||||
}
|
||||
|
||||
public void smart_escape_text_url() throws Error {
|
||||
string text = "<http://example.com>";
|
||||
assert(Geary.HTML.smart_escape(text, false) == "<div style='white-space: pre-wrap;'><http://example.com></div>");
|
||||
public void smart_escape_text_url() throws GLib.Error {
|
||||
assert_string(
|
||||
"<http://example.com>",
|
||||
Geary.HTML.smart_escape("<http://example.com>")
|
||||
);
|
||||
assert_string(
|
||||
"<http://example.com>",
|
||||
Geary.HTML.smart_escape("<http://example.com>")
|
||||
);
|
||||
}
|
||||
|
||||
public void remove_html_tags() throws Error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue