diff options
author | 2013-12-16 21:41:03 +0900 | |
---|---|---|
committer | 2013-12-16 23:16:02 +0900 | |
commit | 7cd7cf73f4ce6f0e577d6382eb0fc25f60dc63e1 (patch) | |
tree | 078bbfdfdd341a484777ef6dc9f9e97e16eaa002 /tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java | |
parent | b767715651a914ba2d89142d13e23eaf081d5b13 (diff) | |
download | latinime-7cd7cf73f4ce6f0e577d6382eb0fc25f60dc63e1.tar.gz latinime-7cd7cf73f4ce6f0e577d6382eb0fc25f60dc63e1.tar.xz latinime-7cd7cf73f4ce6f0e577d6382eb0fc25f60dc63e1.zip |
Fix a bug with languages without spaces and predictions
This is simpler and more correct.
Change-Id: I41806d2fc12b4ca25f76e32972b38f91f3d05c2b
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java index 2123e84e8..0c88f34f0 100644 --- a/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java +++ b/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java @@ -292,6 +292,20 @@ public class StringAndJsonUtilsTests extends AndroidTestCase { assertTrue(bytesStr.equals(bytesStr2)); } + public void testContainsOnlyWhitespace() { + assertTrue(StringUtils.containsOnlyWhitespace(" ")); + assertTrue(StringUtils.containsOnlyWhitespace("")); + assertTrue(StringUtils.containsOnlyWhitespace(" \n\t\t")); + // U+2002 : EN SPACE + // U+2003 : EM SPACE + // U+3000 : IDEOGRAPHIC SPACE (commonly "double-width space") + assertTrue(StringUtils.containsOnlyWhitespace("\u2002\u2003\u3000")); + assertFalse(StringUtils.containsOnlyWhitespace(" a ")); + assertFalse(StringUtils.containsOnlyWhitespace(". ")); + assertFalse(StringUtils.containsOnlyWhitespace(".")); + assertTrue(StringUtils.containsOnlyWhitespace("")); + } + public void testJsonUtils() { final Object[] objs = new Object[] { 1, "aaa", "bbb", 3 }; final List<Object> objArray = Arrays.asList(objs); |