[geary/wip/714317-hide-html-in-preview: 4/4] Add test case handling HTML entities when converting to text.



commit 5b97efa529e6c6c8e6c3857c9800654f8fc6f64f
Author: Michael James Gratton <mike vee net>
Date:   Tue Dec 20 12:19:01 2016 +1100

    Add test case handling HTML entities when converting to text.
    
    * test/engine/util-html-test.vala (UtilTest::remove_html_tags): Added
      test case for HTML entities.

 test/engine/util-html-test.vala |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/test/engine/util-html-test.vala b/test/engine/util-html-test.vala
index 8bf060f..7a1df40 100644
--- a/test/engine/util-html-test.vala
+++ b/test/engine/util-html-test.vala
@@ -31,12 +31,13 @@ px; }
         assert(Geary.HTML.html_to_text(HTML_BODY_COMPLETE) == HTML_BODY_COMPLETE_EXPECTED);
         assert(Geary.HTML.html_to_text(blockquote_body) == "hello\n there\n");
         assert(Geary.HTML.html_to_text(blockquote_body, false) == " there\n");
+        assert(Geary.HTML.html_to_text(HTML_ENTITIES_BODY) == HTML_ENTITIES_EXPECTED);
         assert(Geary.HTML.html_to_text(style_complete) == "");
         assert(Geary.HTML.html_to_text(style_complete) == "");
         assert(Geary.HTML.html_to_text(style_truncated) == "");
     }
 
-    public static string HTML_BODY_COMPLETE = """<html><head>
+    private static string HTML_BODY_COMPLETE = """<html><head>
 <meta http-equiv=Content-Type content="text/html; charset=utf-8">
 <style>
 .bodyblack { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
@@ -51,7 +52,7 @@ X XXXXXX<br /><br />You can reply directly to this message or click the followin
 </table></body></html>
 """;
 
-    public static string HTML_BODY_COMPLETE_EXPECTED = """
+    private static string HTML_BODY_COMPLETE_EXPECTED = """
 
 Hi Kenneth, 
 
@@ -73,4 +74,27 @@ https://app.foobar.com/xxxxxxxxxxx
  
 """;
 
+        private static string HTML_ENTITIES_BODY = """<html><head></head><body><div style="font-family: 
Verdana;font-size: 12.0px;"><div>
+<div style="font-family: Verdana;font-size: 12.0px;">
+<div>What if I said that I&#39;d like to go to the theater tomorrow night.</div>
+
+<div>&nbsp;</div>
+
+<div>I think we could do that!</div>
+""";
+
+        private static string HTML_ENTITIES_EXPECTED = """
+
+What if I said that I'd like to go to the theater tomorrow night.
+
+
+ 
+
+
+I think we could do that!
+
+
+
+""";
+
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]