1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Fix unit tests.

This commit is contained in:
Joe Steele 2013-03-01 12:30:25 -05:00
parent 548b8e07a6
commit c21ea14af1
2 changed files with 7 additions and 15 deletions

View File

@ -23,7 +23,7 @@ public class HtmlConverterTest extends TestCase {
"\n" + "\n" +
"Nice job :)\n" + "Nice job :)\n" +
">> Guess!"; ">> Guess!";
String result = HtmlConverter.textToHtml(message, false); String result = HtmlConverter.textToHtml(message);
writeToFile(result); writeToFile(result);
assertEquals("<pre style=\"white-space: pre-wrap; word-wrap:break-word; font-family: sans-serif; margin-top: 0px\">Panama!<br /><br />Bob Barker &lt;bob@aol.com&gt; wrote:<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;\">a canal<br /><br />Dorothy Jo Gideon &lt;dorothy@aol.com&gt; espoused:<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;\">A man, a plan...<br /></blockquote>Too easy!</blockquote><br />Nice job :)<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;\"><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;\">Guess!</blockquote></blockquote></pre>", result); assertEquals("<pre style=\"white-space: pre-wrap; word-wrap:break-word; font-family: sans-serif; margin-top: 0px\">Panama!<br /><br />Bob Barker &lt;bob@aol.com&gt; wrote:<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;\">a canal<br /><br />Dorothy Jo Gideon &lt;dorothy@aol.com&gt; espoused:<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;\">A man, a plan...<br /></blockquote>Too easy!</blockquote><br />Nice job :)<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;\"><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;\">Guess!</blockquote></blockquote></pre>", result);
} }
@ -37,7 +37,7 @@ public class HtmlConverterTest extends TestCase {
"> LOL F1RST!!!!!\n" + "> LOL F1RST!!!!!\n" +
">\n" + ">\n" +
"> :)"; "> :)";
String result = HtmlConverter.textToHtml(message, false); String result = HtmlConverter.textToHtml(message);
writeToFile(result); writeToFile(result);
assertEquals("<pre style=\"white-space: pre-wrap; word-wrap:break-word; font-family: sans-serif; margin-top: 0px\">*facepalm*<br /><br />Bob Barker &lt;bob@aol.com&gt; wrote:<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;\">A wise man once said...<br /><br />LOL F1RST!!!!!<br /><br />:)</blockquote></pre>", result); assertEquals("<pre style=\"white-space: pre-wrap; word-wrap:break-word; font-family: sans-serif; margin-top: 0px\">*facepalm*<br /><br />Bob Barker &lt;bob@aol.com&gt; wrote:<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;\">A wise man once said...<br /><br />LOL F1RST!!!!!<br /><br />:)</blockquote></pre>", result);
} }
@ -60,7 +60,7 @@ public class HtmlConverterTest extends TestCase {
">>>> four\n" + ">>>> four\n" +
">>>>> five\n" + ">>>>> five\n" +
">>>>>> six"; ">>>>>> six";
String result = HtmlConverter.textToHtml(message, false); String result = HtmlConverter.textToHtml(message);
writeToFile(result); writeToFile(result);
assertEquals("<pre style=\"white-space: pre-wrap; word-wrap:break-word; font-family: sans-serif; margin-top: 0px\">zero<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;\">one<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;\">two<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;\">three<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #fcaf3e; padding-left: 1ex;\">four<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #e9b96e; padding-left: 1ex;\">five<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ccc; padding-left: 1ex;\">six</blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></pre>", result); assertEquals("<pre style=\"white-space: pre-wrap; word-wrap:break-word; font-family: sans-serif; margin-top: 0px\">zero<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;\">one<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;\">two<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;\">three<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #fcaf3e; padding-left: 1ex;\">four<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #e9b96e; padding-left: 1ex;\">five<br /><blockquote class=\"gmail_quote\" style=\"margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ccc; padding-left: 1ex;\">six</blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></pre>", result);
} }

View File

@ -29,12 +29,10 @@ public class ViewablesTest extends AndroidTestCase {
String expectedText = bodyText; String expectedText = bodyText;
String expectedHtml = String expectedHtml =
"<html><head/><body>" +
"<pre style=\"white-space: pre-wrap; word-wrap:break-word; " + "<pre style=\"white-space: pre-wrap; word-wrap:break-word; " +
"font-family: sans-serif; margin-top: 0px\">" + "font-family: sans-serif; margin-top: 0px\">" +
"K-9 Mail rocks :&gt;" + "K-9 Mail rocks :&gt;" +
"</pre>" + "</pre>";
"</body></html>";
assertEquals(expectedText, container.text); assertEquals(expectedText, container.text);
assertEquals(expectedHtml, container.html); assertEquals(expectedHtml, container.html);
@ -56,9 +54,7 @@ public class ViewablesTest extends AndroidTestCase {
String expectedText = "K-9 Mail rocks :>"; String expectedText = "K-9 Mail rocks :>";
String expectedHtml = String expectedHtml =
"<html><head/><body>" + bodyText;
bodyText +
"</body></html>";
assertEquals(expectedText, container.text); assertEquals(expectedText, container.text);
assertEquals(expectedHtml, container.html); assertEquals(expectedHtml, container.html);
@ -91,7 +87,6 @@ public class ViewablesTest extends AndroidTestCase {
"------------------------------------------------------------------------\n\n" + "------------------------------------------------------------------------\n\n" +
bodyText2; bodyText2;
String expectedHtml = String expectedHtml =
"<html><head/><body>" +
"<pre style=\"white-space: pre-wrap; word-wrap:break-word; " + "<pre style=\"white-space: pre-wrap; word-wrap:break-word; " +
"font-family: sans-serif; margin-top: 0px\">" + "font-family: sans-serif; margin-top: 0px\">" +
bodyText1 + bodyText1 +
@ -101,8 +96,7 @@ public class ViewablesTest extends AndroidTestCase {
"<pre style=\"white-space: pre-wrap; word-wrap:break-word; " + "<pre style=\"white-space: pre-wrap; word-wrap:break-word; " +
"font-family: sans-serif; margin-top: 0px\">" + "font-family: sans-serif; margin-top: 0px\">" +
bodyText2 + bodyText2 +
"</pre>" + "</pre>";
"</body></html>";
assertEquals(expectedText, container.text); assertEquals(expectedText, container.text);
@ -158,7 +152,6 @@ public class ViewablesTest extends AndroidTestCase {
"\n" + "\n" +
innerBodyText; innerBodyText;
String expectedHtml = String expectedHtml =
"<html><head/><body>" +
"<pre style=\"white-space: pre-wrap; word-wrap:break-word; " + "<pre style=\"white-space: pre-wrap; word-wrap:break-word; " +
"font-family: sans-serif; margin-top: 0px\">" + "font-family: sans-serif; margin-top: 0px\">" +
bodyText + bodyText +
@ -183,8 +176,7 @@ public class ViewablesTest extends AndroidTestCase {
"<pre style=\"white-space: pre-wrap; word-wrap:break-word; " + "<pre style=\"white-space: pre-wrap; word-wrap:break-word; " +
"font-family: sans-serif; margin-top: 0px\">" + "font-family: sans-serif; margin-top: 0px\">" +
innerBodyText + innerBodyText +
"</pre>" + "</pre>";
"</body></html>";
assertEquals(expectedText, container.text); assertEquals(expectedText, container.text);
assertEquals(expectedHtml, container.html); assertEquals(expectedHtml, container.html);