summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJin Cao <jinyan@google.com>2014-05-20 13:55:53 -0700
committerJin Cao <jinyan@google.com>2014-06-17 16:44:13 -0700
commit77b4c2c31d7601665c337ce5cbc9d84fb9332be8 (patch)
treebf6a22ae0826f968065d96c0117e4b8efc0053c0 /tests
parent0207378b9f41e900ae622a2afe32551eee5f14ef (diff)
downloadandroid_packages_apps_UnifiedEmail-77b4c2c31d7601665c337ce5cbc9d84fb9332be8.tar.gz
android_packages_apps_UnifiedEmail-77b4c2c31d7601665c337ce5cbc9d84fb9332be8.tar.bz2
android_packages_apps_UnifiedEmail-77b4c2c31d7601665c337ce5cbc9d84fb9332be8.zip
Minimum html support using Html class (no ol/ul)
Support basic html in ComposeActivity using Html and HtmlTree class. - Extended HtmlTree to take in any arbitrary html -> object converter so we can use it to convert html to spanned as well as plaintext. - Added custom SpannedConverter to feed into HtmlTree. - Added async task to load Utils.htmlToSpan in the background. - Moved ComposeActivity#sendOrSaveInternal to a handler thread in case Utils.spanToHtml takes a long time. Note that we only support a subset of the html tags. To see the full list of tags we currently support, refer to HtmlUtils#SpannedConverter. Performance: About 3x faster than using Html.fromHtml (yay!). Performance should not be an issue for >99% of the users. b/7406122 Change-Id: I484d7fc7d2f36c4724d9e4cb90fa1d65eadcb903
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/mail/utils/HtmlUtilsTest.java25
-rw-r--r--tests/src/com/android/mail/utils/NotificationUtilsTest.java8
2 files changed, 29 insertions, 4 deletions
diff --git a/tests/src/com/android/mail/utils/HtmlUtilsTest.java b/tests/src/com/android/mail/utils/HtmlUtilsTest.java
new file mode 100644
index 000000000..24b39076a
--- /dev/null
+++ b/tests/src/com/android/mail/utils/HtmlUtilsTest.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.mail.utils;
+
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+
+@SmallTest
+public class HtmlUtilsTest extends AndroidTestCase {
+ // TODO (jin) IMPLEMENT ME
+}
diff --git a/tests/src/com/android/mail/utils/NotificationUtilsTest.java b/tests/src/com/android/mail/utils/NotificationUtilsTest.java
index 1f8c01fef..925438f69 100644
--- a/tests/src/com/android/mail/utils/NotificationUtilsTest.java
+++ b/tests/src/com/android/mail/utils/NotificationUtilsTest.java
@@ -38,9 +38,9 @@ public class NotificationUtilsTest extends AndroidTestCase {
// Get the html "tree" for this message body
final HtmlTree htmlTree = Utils.getHtmlTree(html);
- htmlTree.setPlainTextConverterFactory(new HtmlTree.PlainTextConverterFactory() {
+ htmlTree.setConverterFactory(new HtmlTree.ConverterFactory() {
@Override
- public HtmlTree.PlainTextConverter createInstance() {
+ public HtmlTree.Converter<String> createInstance() {
return new MailMessagePlainTextConverter();
}
});
@@ -65,9 +65,9 @@ public class NotificationUtilsTest extends AndroidTestCase {
// Get the html "tree" for this message body
final HtmlTree htmlTree = Utils.getHtmlTree(html);
- htmlTree.setPlainTextConverterFactory(new HtmlTree.PlainTextConverterFactory() {
+ htmlTree.setConverterFactory(new HtmlTree.ConverterFactory() {
@Override
- public HtmlTree.PlainTextConverter createInstance() {
+ public HtmlTree.Converter<String> createInstance() {
return new MailMessagePlainTextConverter();
}
});