1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00
This commit is contained in:
Koji Arai 2014-05-02 13:18:36 +09:00
parent 4260dc75d3
commit 215ada2e77
2 changed files with 92 additions and 106 deletions

View File

@ -80,8 +80,7 @@ public class TextBodyBuilder {
if (mInsertSeparator) { if (mInsertSeparator) {
text = "<br clear=\"all\">" + text; text = "<br clear=\"all\">" + text;
} }
} } else {
else {
quotedHtmlContent.setInsertionLocation( quotedHtmlContent.setInsertionLocation(
InsertableHtmlContent.InsertionLocation.BEFORE_QUOTE); InsertableHtmlContent.InsertionLocation.BEFORE_QUOTE);
if (mInsertSeparator) { if (mInsertSeparator) {
@ -103,8 +102,7 @@ public class TextBodyBuilder {
composedMessageOffset = quotedHtmlContent.getInsertionPoint(); composedMessageOffset = quotedHtmlContent.getInsertionPoint();
text = quotedHtmlContent.toString(); text = quotedHtmlContent.toString();
} } else {
else {
// There is no text to quote so simply append the signature if available // There is no text to quote so simply append the signature if available
if (mAppendSignature) { if (mAppendSignature) {
text += getSignature(); text += getSignature();
@ -176,8 +174,7 @@ public class TextBodyBuilder {
text += getSignature(); text += getSignature();
} }
} }
} } else {
else {
// There is no text to quote so simply append the signature if available // There is no text to quote so simply append the signature if available
if (mAppendSignature) { if (mAppendSignature) {
// Append signature to the text/reply // Append signature to the text/reply

View File

@ -11,8 +11,7 @@ import com.fsck.k9.activity.InsertableHtmlContent;
class TestingTextBodyBuilder extends TextBodyBuilder { class TestingTextBodyBuilder extends TextBodyBuilder {
public TestingTextBodyBuilder( public TestingTextBodyBuilder(boolean includeQuotedText,
boolean includeQuotedText,
boolean isDraft, boolean isDraft,
QuoteStyle quoteStyle, QuoteStyle quoteStyle,
boolean replyAfterQuote, boolean replyAfterQuote,
@ -24,8 +23,7 @@ class TestingTextBodyBuilder extends TextBodyBuilder {
if (isDraft || includeQuotedText) { if (isDraft || includeQuotedText) {
this.setIncludeQuotedText(true); this.setIncludeQuotedText(true);
} } else {
else {
this.setIncludeQuotedText(false); this.setIncludeQuotedText(false);
} }
@ -36,8 +34,7 @@ class TestingTextBodyBuilder extends TextBodyBuilder {
if (quoteStyle == QuoteStyle.PREFIX && replyAfterQuote) { if (quoteStyle == QuoteStyle.PREFIX && replyAfterQuote) {
this.setReplyAfterQuote(true); this.setReplyAfterQuote(true);
} } else {
else {
this.setReplyAfterQuote(false); this.setReplyAfterQuote(false);
} }
@ -64,14 +61,12 @@ public class TextBodyBuilderTest {
public static QuoteStyle[] QUOTESTYLES = {QuoteStyle.PREFIX, QuoteStyle.HEADER}; public static QuoteStyle[] QUOTESTYLES = {QuoteStyle.PREFIX, QuoteStyle.HEADER};
@Theory @Theory
public void testBuildTextPlain( public void testBuildTextPlain(boolean includeQuotedText,
boolean includeQuotedText,
QuoteStyle quoteStyle, QuoteStyle quoteStyle,
boolean isReplyAfterQuote, boolean isReplyAfterQuote,
boolean isSignatureUse, boolean isSignatureUse,
boolean isSignatureBeforeQuotedText, boolean isSignatureBeforeQuotedText,
boolean isDraft boolean isDraft) {
) {
String expectedText; String expectedText;
int expectedMessageLength; int expectedMessageLength;
@ -184,14 +179,12 @@ public class TextBodyBuilderTest {
} }
@Theory @Theory
public void testBuildTextHtml( public void testBuildTextHtml(boolean includeQuotedText,
boolean includeQuotedText,
QuoteStyle quoteStyle, QuoteStyle quoteStyle,
boolean isReplyAfterQuote, boolean isReplyAfterQuote,
boolean isSignatureUse, boolean isSignatureUse,
boolean isSignatureBeforeQuotedText, boolean isSignatureBeforeQuotedText,
boolean isDraft boolean isDraft) {
) {
String expectedText; String expectedText;
int expectedMessageLength; int expectedMessageLength;
int expectedMessagePosition = 0; int expectedMessagePosition = 0;
@ -227,8 +220,7 @@ public class TextBodyBuilderTest {
expectedText, expectedText,
expectedText + quotedContent); expectedText + quotedContent);
expectedText += quotedContent; expectedText += quotedContent;
} } else {
else {
expectedHtmlContent = makeExpectedHtmlContent(expectedText, quotedContent, expectedHtmlContent = makeExpectedHtmlContent(expectedText, quotedContent,
0, 0,
true, true,
@ -259,8 +251,7 @@ public class TextBodyBuilderTest {
expectedText, expectedText,
expectedText + quotedContent); expectedText + quotedContent);
expectedText += quotedContent; expectedText += quotedContent;
} } else {
else {
expectedHtmlContent = makeExpectedHtmlContent(expectedText, quotedContent, expectedHtmlContent = makeExpectedHtmlContent(expectedText, quotedContent,
0, 0,
true, true,
@ -281,8 +272,7 @@ public class TextBodyBuilderTest {
if (!isDraft && isSignatureUse) { if (!isDraft && isSignatureUse) {
if (!includeQuotedText) { if (!includeQuotedText) {
expectedText += "\r\n" + "signature"; expectedText += "\r\n" + "signature";
} } else {
else {
expectedSignature = "<html>\r\nsignature</html>"; expectedSignature = "<html>\r\nsignature</html>";
} }
} }
@ -299,8 +289,7 @@ public class TextBodyBuilderTest {
expectedText, expectedText,
expectedText + expectedSignature + quotedContent); expectedText + expectedSignature + quotedContent);
expectedText += expectedSignature + quotedContent; expectedText += expectedSignature + quotedContent;
} } else {
else {
expectedHtmlContent = makeExpectedHtmlContent(expectedText, quotedContent, expectedHtmlContent = makeExpectedHtmlContent(expectedText, quotedContent,
0, 0,
true, true,