diff options
author | Tang@Motorola.com <Tang@Motorola.com> | 2009-08-03 18:06:04 -0500 |
---|---|---|
committer | Wink Saville <wink@google.com> | 2009-08-12 15:41:33 -0700 |
commit | 18e7b98c1c7e3cf340e39e93be67b777e7036cc4 (patch) | |
tree | 6e19b743c6b3a0c15a506a4b54876ef02663b430 /tests/CoreTests | |
parent | b5a72b0e14aefb658695bed8d2b598b701abaf3d (diff) | |
download | frameworks_base-18e7b98c1c7e3cf340e39e93be67b777e7036cc4.zip frameworks_base-18e7b98c1c7e3cf340e39e93be67b777e7036cc4.tar.gz frameworks_base-18e7b98c1c7e3cf340e39e93be67b777e7036cc4.tar.bz2 |
Fix the issue of incorrect conversion of the plus sign in a dial string.
The issue is that the plus sign in a dial string is always converted
to the IDP (International Dial Prefix).
This fix implements a plus sign conversion mechanism based on the default
telephone numbering system that the phone is activated and the current telephone
number system that the phone is camped on. Currently, we only support the cases
where the default and current telephone numbering system are NANP.
Diffstat (limited to 'tests/CoreTests')
-rw-r--r-- | tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java b/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java index ff73b32..466b555 100644 --- a/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java +++ b/tests/CoreTests/com/android/internal/telephony/PhoneNumberUtilsTest.java @@ -335,4 +335,73 @@ public class PhoneNumberUtilsTest extends TestCase { assertEquals("(800) 222-3334", PhoneNumberUtils.convertKeypadLettersToDigits("(800) ABC-DEFG")); } + + @SmallTest + public void testCheckAndProcessPlusCode() { + assertEquals("8475797000", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("+8475797000")); + assertEquals("18475797000", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("+18475797000")); + assertEquals("0111234567", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("+1234567")); + assertEquals("01123456700000", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("+23456700000")); + assertEquals("01111875767800", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("+11875767800")); + assertEquals("8475797000,18475231753", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000,+18475231753")); + assertEquals("8475797000,18475231753", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("+8475797000,+18475231753")); + assertEquals("8475797000;8475231753", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000;+8475231753")); + assertEquals("8475797000,0111234567", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000,+1234567")); + assertEquals("847597000;01111875767000", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("847597000;+11875767000")); + assertEquals("8475797000,,8475231753", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000,,+8475231753")); + assertEquals("8475797000;,8475231753", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000;,+8475231753")); + assertEquals("8475797000,;18475231753", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000,;+18475231753")); + assertEquals("8475797000;,01111875767000", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000;,+11875767000")); + assertEquals("8475797000,;01111875767000", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000,;+11875767000")); + assertEquals("8475797000,,,01111875767000", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000,,,+11875767000")); + assertEquals("8475797000;,,01111875767000", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000;,,+11875767000")); + assertEquals("+;,8475797000", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("+;,8475797000")); + assertEquals("8475797000,", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("8475797000,")); + assertEquals("847+579-7000", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("847+579-7000")); + assertEquals(",8475797000", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode(",8475797000")); + assertEquals(";;8475797000,,", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode(";;8475797000,,")); + assertEquals("+this+is$weird;,+", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("+this+is$weird;,+")); + assertEquals("", + PhoneNumberUtils.cdmaCheckAndProcessPlusCode("")); + assertNull(PhoneNumberUtils.cdmaCheckAndProcessPlusCode(null)); + } + + @SmallTest + public void testCheckAndProcessPlusCodeByNumberFormat() { + assertEquals("+8475797000", + PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("+8475797000", + PhoneNumberUtils.FORMAT_JAPAN)); + assertEquals("+0384756700", + PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("+0384756700", + PhoneNumberUtils.FORMAT_JAPAN)); + assertEquals("+1234567", + PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("+1234567", + PhoneNumberUtils.FORMAT_UNKNOWN)); + assertEquals("+23456700000", + PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("+23456700000", + PhoneNumberUtils.FORMAT_UNKNOWN)); + } } |