summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChiao Cheng <chiaocheng@google.com>2012-12-21 15:45:54 -0800
committerChiao Cheng <chiaocheng@google.com>2012-12-26 11:17:32 -0800
commitbd80fd64b9ff94c9ffbdb843beb4b363bb209463 (patch)
tree57f62c04aed26e114930c314187a4e129c0914bf /tests
parent05897c8e016942e10f0ef6f0da02d339480d4748 (diff)
downloadandroid_packages_apps_ContactsCommon-bd80fd64b9ff94c9ffbdb843beb4b363bb209463.tar.gz
android_packages_apps_ContactsCommon-bd80fd64b9ff94c9ffbdb843beb4b363bb209463.tar.bz2
android_packages_apps_ContactsCommon-bd80fd64b9ff94c9ffbdb843beb4b363bb209463.zip
Fixing missing punctuation for punctuation search case.
Previous CL I9cbdf10d21c79f53bc621bacb7eeeb95a6a2435f fixed missing punctuation at the start when searching without punctuation. (e.g. {hello}) This CL fixes the case where leading punctuation is missing if you searched with a leading punctuation. (e.g. {'hello}). The content provider uses a different code path when it detects multi-words and snippeting is actually done in sqlite using the FTS snippet method. The check for multi-word was treating {'hello} as two words. This means that multi-word searches will still have this issue as it still uses the sqlite snippet method. Leaving this to a separate CL since it's a riskier change. Bug: 5929143 Change-Id: I1883621bb64452726cd92035d30001c29b478574
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/contacts/common/format/FormatUtilsTests.java4
-rw-r--r--tests/src/com/android/contacts/common/list/ContactListItemViewTest.java6
2 files changed, 5 insertions, 5 deletions
diff --git a/tests/src/com/android/contacts/common/format/FormatUtilsTests.java b/tests/src/com/android/contacts/common/format/FormatUtilsTests.java
index b38019dc..8f4f7728 100644
--- a/tests/src/com/android/contacts/common/format/FormatUtilsTests.java
+++ b/tests/src/com/android/contacts/common/format/FormatUtilsTests.java
@@ -76,7 +76,7 @@ public class FormatUtilsTests extends AndroidTestCase {
}
public void testIndexOfWordPrefix_NullText() {
- assertEquals(-1, FormatUtils.indexOfWordPrefix(null, "TE".toCharArray()));
+ assertEquals(-1, FormatUtils.indexOfWordPrefix(null, "TE"));
}
public void testIndexOfWordPrefix_MatchingPrefix() {
@@ -109,6 +109,6 @@ public class FormatUtilsTests extends AndroidTestCase {
* @param expectedIndex the expected value to be returned by the function
*/
private void checkIndexOfWordPrefix(String text, String wordPrefix, int expectedIndex) {
- assertEquals(expectedIndex, FormatUtils.indexOfWordPrefix(text, wordPrefix.toCharArray()));
+ assertEquals(expectedIndex, FormatUtils.indexOfWordPrefix(text, wordPrefix));
}
}
diff --git a/tests/src/com/android/contacts/common/list/ContactListItemViewTest.java b/tests/src/com/android/contacts/common/list/ContactListItemViewTest.java
index 6eb74db3..a4524609 100644
--- a/tests/src/com/android/contacts/common/list/ContactListItemViewTest.java
+++ b/tests/src/com/android/contacts/common/list/ContactListItemViewTest.java
@@ -76,7 +76,7 @@ public class ContactListItemViewTest extends AndroidTestCase {
Cursor cursor = createCursor("John Doe", "Doe John");
ContactListItemView view = createView();
- view.setHighlightedPrefix("DOE".toCharArray());
+ view.setHighlightedPrefix("DOE");
view.showDisplayName(cursor, 0, ContactsContract.Preferences.DISPLAY_ORDER_PRIMARY);
CharSequence seq = view.getNameTextView().getText();
@@ -88,7 +88,7 @@ public class ContactListItemViewTest extends AndroidTestCase {
Cursor cursor = createCursor("John Doe", "Doe John");
ContactListItemView view = createView();
- view.setHighlightedPrefix("DOE".toCharArray());
+ view.setHighlightedPrefix("DOE");
view.showDisplayName(cursor, 0, ContactsContract.Preferences.DISPLAY_ORDER_ALTERNATIVE);
CharSequence seq = view.getNameTextView().getText();
@@ -98,7 +98,7 @@ public class ContactListItemViewTest extends AndroidTestCase {
public void testSetSnippet_Prefix() {
ContactListItemView view = createView();
- view.setHighlightedPrefix("TEST".toCharArray());
+ view.setHighlightedPrefix("TEST");
view.setSnippet("This is a test");
CharSequence seq = view.getSnippetView().getText();