Browse Source

EmailTests: fix api change

Change-Id: I170478bb91d847ba9d42515c5d5c29a92f3765dc
replicant-6.0
Scott Mertz 5 years ago
committed by Steve Kondik
parent
commit
7f1a3b1f12
3 changed files with 13 additions and 13 deletions
  1. +1
    -1
      tests/src/com/android/email/LegacyConversionsTests.java
  2. +1
    -1
      tests/src/com/android/email/mail/store/ImapStoreUnitTests.java
  3. +11
    -11
      tests/src/com/android/emailcommon/internet/MimeUtilityTest.java

+ 1
- 1
tests/src/com/android/email/LegacyConversionsTests.java View File

@@ -388,7 +388,7 @@ public class LegacyConversionsTests extends ProviderTestCase2<EmailProvider> {
String get1Text = null;
String get1Html = null;
for (Part viewable : viewables) {
String text = MimeUtility.getTextFromPart(viewable);
String text = MimeUtility.getTextFromPart(viewable, true);
if (viewable.getMimeType().equalsIgnoreCase("text/html")) {
get1Html = text;
} else {


+ 1
- 1
tests/src/com/android/email/mail/store/ImapStoreUnitTests.java View File

@@ -1105,7 +1105,7 @@ public class ImapStoreUnitTests extends InstrumentationTestCase {
MimeUtility.collectParts(message1, viewables, attachments);
assertTrue(viewables.size() == 1);
emptyBodyPart = viewables.get(0);
String text = MimeUtility.getTextFromPart(emptyBodyPart);
String text = MimeUtility.getTextFromPart(emptyBodyPart, true);
assertNull(text);
}



+ 11
- 11
tests/src/com/android/emailcommon/internet/MimeUtilityTest.java View File

@@ -369,19 +369,19 @@ public class MimeUtilityTest extends TestCase {
// 1. test basic text/plain mode
p.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "text/plain");
p.setBody(tb);
String gotText = MimeUtility.getTextFromPart(p);
String gotText = MimeUtility.getTextFromPart(p, true);
assertEquals(theText, gotText);

// 2. mixed case is OK
p.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "TEXT/PLAIN");
p.setBody(tb);
gotText = MimeUtility.getTextFromPart(p);
gotText = MimeUtility.getTextFromPart(p, true);
assertEquals(theText, gotText);

// 3. wildcards OK
p.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "text/other");
p.setBody(tb);
gotText = MimeUtility.getTextFromPart(p);
gotText = MimeUtility.getTextFromPart(p, true);
assertEquals(theText, gotText);
}

@@ -411,13 +411,13 @@ public class MimeUtilityTest extends TestCase {
p.setBody(tb);
// We call setHeader after setBody, since setBody overwrites Content-Type
p.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "text/html; charset=utf-8");
gotText = MimeUtility.getTextFromPart(p);
gotText = MimeUtility.getTextFromPart(p, true);
assertTrue(MimeUtility.mimeTypeMatches(p.getMimeType(), "text/html"));
assertEquals(UNICODE_EXPECT, gotText);

p.setBody(tb);
p.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "text/html; charset=windows-1252");
gotText = MimeUtility.getTextFromPart(p);
gotText = MimeUtility.getTextFromPart(p, true);
assertTrue(MimeUtility.mimeTypeMatches(p.getMimeType(), "text/html"));
assertEquals(WINDOWS1252_EXPECT, gotText);

@@ -425,14 +425,14 @@ public class MimeUtilityTest extends TestCase {
p.setBody(tb);
p.setHeader(MimeHeader.HEADER_CONTENT_TYPE,
"text/html; prop1 = \"test\"; charset = \"utf-8\"; prop2 = \"test\"");
gotText = MimeUtility.getTextFromPart(p);
gotText = MimeUtility.getTextFromPart(p, true);
assertTrue(MimeUtility.mimeTypeMatches(p.getMimeType(), "text/html"));
assertEquals(UNICODE_EXPECT, gotText);

p.setBody(tb);
p.setHeader(MimeHeader.HEADER_CONTENT_TYPE,
"text/html; prop1 = \"test\"; charset = \"windows-1252\"; prop2 = \"test\"");
gotText = MimeUtility.getTextFromPart(p);
gotText = MimeUtility.getTextFromPart(p, true);
assertTrue(MimeUtility.mimeTypeMatches(p.getMimeType(), "text/html"));
assertEquals(WINDOWS1252_EXPECT, gotText);

@@ -442,13 +442,13 @@ public class MimeUtilityTest extends TestCase {

p.setBody(tb);
p.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "TEXT/HtmL ; CHARseT=utf-8");
gotText = MimeUtility.getTextFromPart(p);
gotText = MimeUtility.getTextFromPart(p, true);
assertTrue(MimeUtility.mimeTypeMatches(p.getMimeType(), "text/html"));
assertEquals(UNICODE_EXPECT, gotText);

p.setBody(tb);
p.setHeader(MimeHeader.HEADER_CONTENT_TYPE, "TEXT/HtmL ; CHARseT=windows-1252");
gotText = MimeUtility.getTextFromPart(p);
gotText = MimeUtility.getTextFromPart(p, true);
assertTrue(MimeUtility.mimeTypeMatches(p.getMimeType(), "text/html"));
assertEquals(WINDOWS1252_EXPECT, gotText);

@@ -459,7 +459,7 @@ public class MimeUtilityTest extends TestCase {
p.setBody(tb);
p.setHeader(MimeHeader.HEADER_CONTENT_TYPE,
"text/html; charset=utf-8 (Plain text)");
gotText = MimeUtility.getTextFromPart(p);
gotText = MimeUtility.getTextFromPart(p, true);
assertTrue(MimeUtility.mimeTypeMatches(p.getMimeType(), "text/html"));
// Note: This test does not pass.
//assertEquals(UNICODE_EXPECT, gotText);
@@ -467,7 +467,7 @@ public class MimeUtilityTest extends TestCase {
p.setBody(tb);
p.setHeader(MimeHeader.HEADER_CONTENT_TYPE,
"text/html; charset=windows-1252 (Plain text)");
gotText = MimeUtility.getTextFromPart(p);
gotText = MimeUtility.getTextFromPart(p, true);
assertTrue(MimeUtility.mimeTypeMatches(p.getMimeType(), "text/html"));
// Note: These tests does not pass.
//assertEquals(WINDOWS1252_EXPECT, gotText);


Loading…
Cancel
Save