summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/AndroidManifest.xml4
-rw-r--r--tests/src/com/android/dialer/dialpad/DialpadFragmentTest.java26
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 73febff64..40c5502da 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -18,6 +18,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.dialer.tests">
+ <uses-sdk
+ android:minSdkVersion="23"
+ android:targetSdkVersion="23" />
+
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
diff --git a/tests/src/com/android/dialer/dialpad/DialpadFragmentTest.java b/tests/src/com/android/dialer/dialpad/DialpadFragmentTest.java
index 6f18fe69a..3015e87ff 100644
--- a/tests/src/com/android/dialer/dialpad/DialpadFragmentTest.java
+++ b/tests/src/com/android/dialer/dialpad/DialpadFragmentTest.java
@@ -82,4 +82,30 @@ public class DialpadFragmentTest extends TestCase {
assertTrue(DialpadFragment.canAddDigit("55;55", 3, 3, ',')); // WAIT & PAUSE
assertTrue(DialpadFragment.canAddDigit("55,55", 3, 4, ';'));
}
+
+ public void testGetFormattedDigits_NoPostDialString() {
+ assertEquals("(510) 333-7596",
+ DialpadFragment.getFormattedDigits("5103337596", null, "US"));
+ assertEquals("(510) 333-7596",
+ DialpadFragment.getFormattedDigits("5103337596", "+15103337596", "US"));
+ }
+
+ public void testGetFormattedDigits_WithPostDialString() {
+ assertEquals("(510) 333-7596,1234",
+ DialpadFragment.getFormattedDigits("5103337596,1234", null, "US"));
+ assertEquals("(510) 333-7596;;1234",
+ DialpadFragment.getFormattedDigits("5103337596;;1234", null, "US"));
+ assertEquals("(510) 333-7596;123,,4",
+ DialpadFragment.getFormattedDigits("(510)3337596;123,,4", "+15103337596", "US"));
+ }
+
+ public void testGetFormattedDigits_PostDialStringOnly() {
+ assertEquals(",1234567", DialpadFragment.getFormattedDigits(",1234567", null, "US"));
+ assertEquals(";4321", DialpadFragment.getFormattedDigits(";4321", null, "US"));
+ }
+
+ public void testGetFormattedDigits_Invalid() {
+ assertEquals(null, DialpadFragment.getFormattedDigits(null, null, "US"));
+ assertEquals("", DialpadFragment.getFormattedDigits("", "+15104233335", "US"));
+ }
}