Loading core/tests/coretests/src/android/text/format/DateFormatTest.java +13 −6 Original line number Diff line number Diff line Loading @@ -16,14 +16,21 @@ package android.text.format; import android.support.test.filters.SmallTest; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import junit.framework.TestCase; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; public class DateFormatTest extends TestCase { import org.junit.Test; import org.junit.runner.RunWith; @SmallTest public void testHasDesignator() throws Exception { @RunWith(AndroidJUnit4.class) public class DateFormatTest { @Test public void testHasDesignator() { assertTrue(DateFormat.hasDesignator("hh:mm:ss", DateFormat.MINUTE)); assertTrue(DateFormat.hasDesignator("myyyy", DateFormat.MINUTE)); assertTrue(DateFormat.hasDesignator("mmm", DateFormat.MINUTE)); Loading @@ -31,8 +38,8 @@ public class DateFormatTest extends TestCase { assertFalse(DateFormat.hasDesignator("hh:MM:ss", DateFormat.MINUTE)); } @SmallTest public void testHasDesignatorEscaped() throws Exception { @Test public void testHasDesignatorEscaped() { assertTrue(DateFormat.hasDesignator("hh:mm 'LOL'", DateFormat.MINUTE)); assertFalse(DateFormat.hasDesignator("hh:mm 'yyyy'", DateFormat.YEAR)); Loading core/tests/coretests/src/android/text/format/DateUtilsTest.java +31 −25 Original line number Diff line number Diff line Loading @@ -16,45 +16,40 @@ package android.text.format; import static org.junit.Assert.assertEquals; import android.content.res.Configuration; import android.content.res.Resources; import android.os.LocaleList; import android.support.test.filters.SmallTest; import junit.framework.TestCase; import android.support.test.runner.AndroidJUnit4; import java.util.Locale; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; public class DateUtilsTest extends TestCase { @SmallTest @RunWith(AndroidJUnit4.class) public class DateUtilsTest { private static final LocaleList LOCALE_LIST_US = new LocaleList(Locale.US); private LocaleList mOriginalLocales; @Override protected void setUp() throws Exception { super.setUp(); @Before public void setup() { mOriginalLocales = Resources.getSystem().getConfiguration().getLocales(); setLocales(LOCALE_LIST_US); } @Override protected void tearDown() throws Exception { @After public void teardown() { setLocales(mOriginalLocales); super.tearDown(); } private void setLocales(LocaleList locales) { final Resources systemResources = Resources.getSystem(); final Configuration config = new Configuration(systemResources.getConfiguration()); config.setLocales(locales); // This is not very safe to call, but since DateUtils.formatDuration() is a static method // (it gets its format strings from the system resources), we can't pass a modified Context // to it. systemResources.updateConfiguration(config, null); } @SmallTest public void test_formatDuration_seconds() throws Exception { @Test public void test_formatDuration_seconds() { assertEquals("0 seconds", DateUtils.formatDuration(0)); assertEquals("0 seconds", DateUtils.formatDuration(1)); assertEquals("0 seconds", DateUtils.formatDuration(499)); Loading @@ -75,8 +70,8 @@ public class DateUtilsTest extends TestCase { assertEquals("2s", DateUtils.formatDuration(1500, DateUtils.LENGTH_SHORTEST)); } @SmallTest public void test_formatDuration_Minutes() throws Exception { @Test public void test_formatDuration_Minutes() { assertEquals("59 seconds", DateUtils.formatDuration(59000)); assertEquals("60 seconds", DateUtils.formatDuration(59500)); assertEquals("1 minute", DateUtils.formatDuration(60000)); Loading @@ -92,8 +87,8 @@ public class DateUtilsTest extends TestCase { assertEquals("2m", DateUtils.formatDuration(120000, DateUtils.LENGTH_SHORTEST)); } @SmallTest public void test_formatDuration_Hours() throws Exception { @Test public void test_formatDuration_Hours() { assertEquals("59 minutes", DateUtils.formatDuration(3540000)); assertEquals("1 hour", DateUtils.formatDuration(3600000)); assertEquals("48 hours", DateUtils.formatDuration(172800000)); Loading @@ -107,4 +102,15 @@ public class DateUtilsTest extends TestCase { assertEquals("1h", DateUtils.formatDuration(3600000, DateUtils.LENGTH_SHORTEST)); assertEquals("48h", DateUtils.formatDuration(172800000, DateUtils.LENGTH_SHORTEST)); } private void setLocales(LocaleList locales) { final Resources systemResources = Resources.getSystem(); final Configuration config = new Configuration(systemResources.getConfiguration()); config.setLocales(locales); // This is not very safe to call, but since DateUtils.formatDuration() is a static method // (it gets its format strings from the system resources), we can't pass a modified Context // to it. systemResources.updateConfiguration(config, null); } } core/tests/coretests/src/android/text/format/FormatterTest.java +33 −24 Original line number Diff line number Diff line Loading @@ -16,43 +16,43 @@ package android.text.format; import static org.junit.Assert.assertEquals; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.support.test.InstrumentationRegistry; import android.support.test.filters.SmallTest; import android.test.AndroidTestCase; import android.support.test.runner.AndroidJUnit4; import android.text.format.Formatter.BytesResult; import java.util.Locale; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; public class FormatterTest extends AndroidTestCase { @SmallTest @RunWith(AndroidJUnit4.class) public class FormatterTest { private Locale mOriginalLocale; private Context mContext; @Override protected void setUp() throws Exception { super.setUp(); mOriginalLocale = mContext.getResources().getConfiguration().locale; @Before public void setup() { mContext = InstrumentationRegistry.getContext(); mOriginalLocale = mContext.getResources() .getConfiguration().locale; } @Override protected void tearDown() throws Exception { @After public void tearDown() { if (mOriginalLocale != null) { setLocale(mOriginalLocale); } super.tearDown(); } private void setLocale(Locale locale) { Resources res = getContext().getResources(); Configuration config = res.getConfiguration(); config.locale = locale; res.updateConfiguration(config, res.getDisplayMetrics()); Locale.setDefault(locale); } @SmallTest @Test public void testFormatBytes() { setLocale(Locale.ENGLISH); Loading Loading @@ -90,7 +90,7 @@ public class FormatterTest extends AndroidTestCase { checkFormatBytes(-914, false, "-0.91", -910); // Missing FLAG_CALCULATE_ROUNDED case. BytesResult r = Formatter.formatBytes(getContext().getResources(), 1, 0); BytesResult r = Formatter.formatBytes(mContext.getResources(), 1, 0); assertEquals("1", r.value); assertEquals(0, r.roundedBytes); // Didn't pass FLAG_CALCULATE_ROUNDED Loading @@ -101,9 +101,18 @@ public class FormatterTest extends AndroidTestCase { private void checkFormatBytes(long bytes, boolean useShort, String expectedString, long expectedRounded) { BytesResult r = Formatter.formatBytes(getContext().getResources(), bytes, BytesResult r = Formatter.formatBytes(mContext.getResources(), bytes, Formatter.FLAG_CALCULATE_ROUNDED | (useShort ? Formatter.FLAG_SHORTER : 0)); assertEquals(expectedString, r.value); assertEquals(expectedRounded, r.roundedBytes); } private void setLocale(Locale locale) { Resources res = mContext.getResources(); Configuration config = res.getConfiguration(); config.locale = locale; res.updateConfiguration(config, res.getDisplayMetrics()); Locale.setDefault(locale); } } core/tests/coretests/src/android/text/format/TimeTest.java +51 −43 Original line number Diff line number Diff line Loading @@ -16,17 +16,25 @@ package android.text.format; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import android.support.test.filters.SmallTest; import android.support.test.filters.Suppress; import android.support.test.runner.AndroidJUnit4; import android.util.Log; import android.util.TimeFormatException; import junit.framework.TestCase; public class TimeTest extends TestCase { import org.junit.Test; import org.junit.runner.RunWith; @SmallTest public void testNormalize0() throws Exception { @RunWith(AndroidJUnit4.class) public class TimeTest { @Test public void testNormalize0() { Time t = new Time(Time.TIMEZONE_UTC); t.parse("20060432T010203"); t.normalize(false /* use isDst */); Loading Loading @@ -174,8 +182,8 @@ public class TimeTest extends TestCase { new DateTest(2007, 10, 5, 2, 0, 60, 2007, 10, 5, 3, 0), }; @SmallTest public void testNormalize1() throws Exception { @Test public void testNormalize1() { Time local = new Time("America/Los_Angeles"); int len = dayTests.length; Loading Loading @@ -265,70 +273,70 @@ public class TimeTest extends TestCase { } } @SmallTest public void testSwitchTimezone0() throws Exception { @Test public void testSwitchTimezone0() { Time t = new Time(Time.TIMEZONE_UTC); t.parse("20061005T120000"); t.switchTimezone("America/Los_Angeles"); // System.out.println("got: " + t); } @SmallTest public void testCtor0() throws Exception { @Test public void testCtor0() { Time t = new Time(Time.TIMEZONE_UTC); assertEquals(Time.TIMEZONE_UTC, t.timezone); } @SmallTest public void testGetActualMaximum0() throws Exception { @Test public void testGetActualMaximum0() { Time t = new Time(Time.TIMEZONE_UTC); int r = t.getActualMaximum(Time.SECOND); t.getActualMaximum(Time.SECOND); // System.out.println("r=" + r); } @SmallTest public void testClear0() throws Exception { @Test public void testClear0() { Time t = new Time(Time.TIMEZONE_UTC); t.clear(Time.TIMEZONE_UTC); } @SmallTest public void testCompare0() throws Exception { @Test public void testCompare0() { Time a = new Time(Time.TIMEZONE_UTC); Time b = new Time("America/Los_Angeles"); int r = Time.compare(a, b); // System.out.println("r=" + r); } @SmallTest public void testFormat0() throws Exception { @Test public void testFormat0() { Time t = new Time(Time.TIMEZONE_UTC); String r = t.format("%Y%m%dT%H%M%S"); // System.out.println("r='" + r + "'"); } @SmallTest public void testToString0() throws Exception { @Test public void testToString0() { Time t = new Time(Time.TIMEZONE_UTC); String r = t.toString(); // System.out.println("r='" + r + "'"); } @SmallTest public void testGetCurrentTimezone0() throws Exception { @Test public void testGetCurrentTimezone0() { String r = Time.getCurrentTimezone(); // System.out.println("r='" + r + "'"); } @SmallTest public void testSetToNow0() throws Exception { @Test public void testSetToNow0() { Time t = new Time(Time.TIMEZONE_UTC); t.setToNow(); // System.out.println("t=" + t); } @SmallTest public void testMillis0() throws Exception { @Test public void testMillis0() { Time t = new Time(Time.TIMEZONE_UTC); t.set(0, 0, 0, 1, 1, 2006); long r = t.toMillis(true /* ignore isDst */); Loading @@ -338,23 +346,23 @@ public class TimeTest extends TestCase { // System.out.println("r=" + r); } @SmallTest public void testMillis1() throws Exception { @Test public void testMillis1() { Time t = new Time(Time.TIMEZONE_UTC); t.set(1, 0, 0, 1, 0, 1970); long r = t.toMillis(true /* ignore isDst */); // System.out.println("r=" + r); } @SmallTest public void testParse0() throws Exception { @Test public void testParse0() { Time t = new Time(Time.TIMEZONE_UTC); t.parse("12345678T901234"); // System.out.println("t=" + t); } @SmallTest public void testParse33390() throws Exception { @Test public void testParse33390() { Time t = new Time(Time.TIMEZONE_UTC); t.parse3339("1980-05-23"); Loading Loading @@ -435,8 +443,8 @@ public class TimeTest extends TestCase { } } @SmallTest public void testSet0() throws Exception { @Test public void testSet0() { Time t = new Time(Time.TIMEZONE_UTC); t.set(1000L); // System.out.println("t.year=" + t.year); Loading @@ -449,8 +457,8 @@ public class TimeTest extends TestCase { // System.out.println("t=" + t); } @SmallTest public void testSet1() throws Exception { @Test public void testSet1() { Time t = new Time(Time.TIMEZONE_UTC); t.set(1, 2, 3, 4, 5, 6); // System.out.println("t=" + t); Loading Loading @@ -520,7 +528,7 @@ public class TimeTest extends TestCase { }; @Suppress public void disableTestGetJulianDay() throws Exception { public void disableTestGetJulianDay() { Time time = new Time(); // For each day of the year, and for each timezone, get the Julian Loading Loading @@ -562,7 +570,7 @@ public class TimeTest extends TestCase { } @Suppress public void disableTestSetJulianDay() throws Exception { public void disableTestSetJulianDay() { Time time = new Time(); // For each day of the year in 2008, and for each timezone, Loading core/tests/coretests/src/android/text/method/BackspaceTest.java +12 −6 Original line number Diff line number Diff line Loading @@ -17,9 +17,13 @@ package android.text.method; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.text.InputType; import android.view.KeyEvent; import android.widget.TextView.BufferType; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; /** * Test backspace key handling of {@link android.text.method.BaseKeyListener}. Loading @@ -27,6 +31,8 @@ import android.widget.TextView.BufferType; * Only contains edge cases. For normal cases, see {@see android.text.method.cts.BackspaceTest}. * TODO: introduce test cases for surrogate pairs and replacement span. */ @SmallTest @RunWith(AndroidJUnit4.class) public class BackspaceTest extends KeyListenerTestCase { private static final BaseKeyListener mKeyListener = new BaseKeyListener() { public int getInputType() { Loading @@ -49,7 +55,7 @@ public class BackspaceTest extends KeyListenerTestCase { state.mSelectionEnd = mTextView.getSelectionEnd(); } @SmallTest @Test public void testCombiningEnclosingKeycaps() { EditorState state = new EditorState(); Loading Loading @@ -77,7 +83,7 @@ public class BackspaceTest extends KeyListenerTestCase { state.assertEquals("|"); } @SmallTest @Test public void testVariationSelector() { EditorState state = new EditorState(); Loading Loading @@ -141,7 +147,7 @@ public class BackspaceTest extends KeyListenerTestCase { state.assertEquals("|"); } @SmallTest @Test public void testEmojiZWJSequence() { EditorState state = new EditorState(); Loading Loading @@ -221,7 +227,7 @@ public class BackspaceTest extends KeyListenerTestCase { state.assertEquals("|"); } @SmallTest @Test public void testFlags() { EditorState state = new EditorState(); Loading Loading @@ -283,7 +289,7 @@ public class BackspaceTest extends KeyListenerTestCase { state.assertEquals("'a' |"); } @SmallTest @Test public void testEmojiModifier() { EditorState state = new EditorState(); Loading Loading @@ -312,7 +318,7 @@ public class BackspaceTest extends KeyListenerTestCase { state.assertEquals("|"); } @SmallTest @Test public void testMixedEdgeCases() { EditorState state = new EditorState(); Loading Loading
core/tests/coretests/src/android/text/format/DateFormatTest.java +13 −6 Original line number Diff line number Diff line Loading @@ -16,14 +16,21 @@ package android.text.format; import android.support.test.filters.SmallTest; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import junit.framework.TestCase; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; public class DateFormatTest extends TestCase { import org.junit.Test; import org.junit.runner.RunWith; @SmallTest public void testHasDesignator() throws Exception { @RunWith(AndroidJUnit4.class) public class DateFormatTest { @Test public void testHasDesignator() { assertTrue(DateFormat.hasDesignator("hh:mm:ss", DateFormat.MINUTE)); assertTrue(DateFormat.hasDesignator("myyyy", DateFormat.MINUTE)); assertTrue(DateFormat.hasDesignator("mmm", DateFormat.MINUTE)); Loading @@ -31,8 +38,8 @@ public class DateFormatTest extends TestCase { assertFalse(DateFormat.hasDesignator("hh:MM:ss", DateFormat.MINUTE)); } @SmallTest public void testHasDesignatorEscaped() throws Exception { @Test public void testHasDesignatorEscaped() { assertTrue(DateFormat.hasDesignator("hh:mm 'LOL'", DateFormat.MINUTE)); assertFalse(DateFormat.hasDesignator("hh:mm 'yyyy'", DateFormat.YEAR)); Loading
core/tests/coretests/src/android/text/format/DateUtilsTest.java +31 −25 Original line number Diff line number Diff line Loading @@ -16,45 +16,40 @@ package android.text.format; import static org.junit.Assert.assertEquals; import android.content.res.Configuration; import android.content.res.Resources; import android.os.LocaleList; import android.support.test.filters.SmallTest; import junit.framework.TestCase; import android.support.test.runner.AndroidJUnit4; import java.util.Locale; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; public class DateUtilsTest extends TestCase { @SmallTest @RunWith(AndroidJUnit4.class) public class DateUtilsTest { private static final LocaleList LOCALE_LIST_US = new LocaleList(Locale.US); private LocaleList mOriginalLocales; @Override protected void setUp() throws Exception { super.setUp(); @Before public void setup() { mOriginalLocales = Resources.getSystem().getConfiguration().getLocales(); setLocales(LOCALE_LIST_US); } @Override protected void tearDown() throws Exception { @After public void teardown() { setLocales(mOriginalLocales); super.tearDown(); } private void setLocales(LocaleList locales) { final Resources systemResources = Resources.getSystem(); final Configuration config = new Configuration(systemResources.getConfiguration()); config.setLocales(locales); // This is not very safe to call, but since DateUtils.formatDuration() is a static method // (it gets its format strings from the system resources), we can't pass a modified Context // to it. systemResources.updateConfiguration(config, null); } @SmallTest public void test_formatDuration_seconds() throws Exception { @Test public void test_formatDuration_seconds() { assertEquals("0 seconds", DateUtils.formatDuration(0)); assertEquals("0 seconds", DateUtils.formatDuration(1)); assertEquals("0 seconds", DateUtils.formatDuration(499)); Loading @@ -75,8 +70,8 @@ public class DateUtilsTest extends TestCase { assertEquals("2s", DateUtils.formatDuration(1500, DateUtils.LENGTH_SHORTEST)); } @SmallTest public void test_formatDuration_Minutes() throws Exception { @Test public void test_formatDuration_Minutes() { assertEquals("59 seconds", DateUtils.formatDuration(59000)); assertEquals("60 seconds", DateUtils.formatDuration(59500)); assertEquals("1 minute", DateUtils.formatDuration(60000)); Loading @@ -92,8 +87,8 @@ public class DateUtilsTest extends TestCase { assertEquals("2m", DateUtils.formatDuration(120000, DateUtils.LENGTH_SHORTEST)); } @SmallTest public void test_formatDuration_Hours() throws Exception { @Test public void test_formatDuration_Hours() { assertEquals("59 minutes", DateUtils.formatDuration(3540000)); assertEquals("1 hour", DateUtils.formatDuration(3600000)); assertEquals("48 hours", DateUtils.formatDuration(172800000)); Loading @@ -107,4 +102,15 @@ public class DateUtilsTest extends TestCase { assertEquals("1h", DateUtils.formatDuration(3600000, DateUtils.LENGTH_SHORTEST)); assertEquals("48h", DateUtils.formatDuration(172800000, DateUtils.LENGTH_SHORTEST)); } private void setLocales(LocaleList locales) { final Resources systemResources = Resources.getSystem(); final Configuration config = new Configuration(systemResources.getConfiguration()); config.setLocales(locales); // This is not very safe to call, but since DateUtils.formatDuration() is a static method // (it gets its format strings from the system resources), we can't pass a modified Context // to it. systemResources.updateConfiguration(config, null); } }
core/tests/coretests/src/android/text/format/FormatterTest.java +33 −24 Original line number Diff line number Diff line Loading @@ -16,43 +16,43 @@ package android.text.format; import static org.junit.Assert.assertEquals; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.support.test.InstrumentationRegistry; import android.support.test.filters.SmallTest; import android.test.AndroidTestCase; import android.support.test.runner.AndroidJUnit4; import android.text.format.Formatter.BytesResult; import java.util.Locale; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; public class FormatterTest extends AndroidTestCase { @SmallTest @RunWith(AndroidJUnit4.class) public class FormatterTest { private Locale mOriginalLocale; private Context mContext; @Override protected void setUp() throws Exception { super.setUp(); mOriginalLocale = mContext.getResources().getConfiguration().locale; @Before public void setup() { mContext = InstrumentationRegistry.getContext(); mOriginalLocale = mContext.getResources() .getConfiguration().locale; } @Override protected void tearDown() throws Exception { @After public void tearDown() { if (mOriginalLocale != null) { setLocale(mOriginalLocale); } super.tearDown(); } private void setLocale(Locale locale) { Resources res = getContext().getResources(); Configuration config = res.getConfiguration(); config.locale = locale; res.updateConfiguration(config, res.getDisplayMetrics()); Locale.setDefault(locale); } @SmallTest @Test public void testFormatBytes() { setLocale(Locale.ENGLISH); Loading Loading @@ -90,7 +90,7 @@ public class FormatterTest extends AndroidTestCase { checkFormatBytes(-914, false, "-0.91", -910); // Missing FLAG_CALCULATE_ROUNDED case. BytesResult r = Formatter.formatBytes(getContext().getResources(), 1, 0); BytesResult r = Formatter.formatBytes(mContext.getResources(), 1, 0); assertEquals("1", r.value); assertEquals(0, r.roundedBytes); // Didn't pass FLAG_CALCULATE_ROUNDED Loading @@ -101,9 +101,18 @@ public class FormatterTest extends AndroidTestCase { private void checkFormatBytes(long bytes, boolean useShort, String expectedString, long expectedRounded) { BytesResult r = Formatter.formatBytes(getContext().getResources(), bytes, BytesResult r = Formatter.formatBytes(mContext.getResources(), bytes, Formatter.FLAG_CALCULATE_ROUNDED | (useShort ? Formatter.FLAG_SHORTER : 0)); assertEquals(expectedString, r.value); assertEquals(expectedRounded, r.roundedBytes); } private void setLocale(Locale locale) { Resources res = mContext.getResources(); Configuration config = res.getConfiguration(); config.locale = locale; res.updateConfiguration(config, res.getDisplayMetrics()); Locale.setDefault(locale); } }
core/tests/coretests/src/android/text/format/TimeTest.java +51 −43 Original line number Diff line number Diff line Loading @@ -16,17 +16,25 @@ package android.text.format; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import android.support.test.filters.SmallTest; import android.support.test.filters.Suppress; import android.support.test.runner.AndroidJUnit4; import android.util.Log; import android.util.TimeFormatException; import junit.framework.TestCase; public class TimeTest extends TestCase { import org.junit.Test; import org.junit.runner.RunWith; @SmallTest public void testNormalize0() throws Exception { @RunWith(AndroidJUnit4.class) public class TimeTest { @Test public void testNormalize0() { Time t = new Time(Time.TIMEZONE_UTC); t.parse("20060432T010203"); t.normalize(false /* use isDst */); Loading Loading @@ -174,8 +182,8 @@ public class TimeTest extends TestCase { new DateTest(2007, 10, 5, 2, 0, 60, 2007, 10, 5, 3, 0), }; @SmallTest public void testNormalize1() throws Exception { @Test public void testNormalize1() { Time local = new Time("America/Los_Angeles"); int len = dayTests.length; Loading Loading @@ -265,70 +273,70 @@ public class TimeTest extends TestCase { } } @SmallTest public void testSwitchTimezone0() throws Exception { @Test public void testSwitchTimezone0() { Time t = new Time(Time.TIMEZONE_UTC); t.parse("20061005T120000"); t.switchTimezone("America/Los_Angeles"); // System.out.println("got: " + t); } @SmallTest public void testCtor0() throws Exception { @Test public void testCtor0() { Time t = new Time(Time.TIMEZONE_UTC); assertEquals(Time.TIMEZONE_UTC, t.timezone); } @SmallTest public void testGetActualMaximum0() throws Exception { @Test public void testGetActualMaximum0() { Time t = new Time(Time.TIMEZONE_UTC); int r = t.getActualMaximum(Time.SECOND); t.getActualMaximum(Time.SECOND); // System.out.println("r=" + r); } @SmallTest public void testClear0() throws Exception { @Test public void testClear0() { Time t = new Time(Time.TIMEZONE_UTC); t.clear(Time.TIMEZONE_UTC); } @SmallTest public void testCompare0() throws Exception { @Test public void testCompare0() { Time a = new Time(Time.TIMEZONE_UTC); Time b = new Time("America/Los_Angeles"); int r = Time.compare(a, b); // System.out.println("r=" + r); } @SmallTest public void testFormat0() throws Exception { @Test public void testFormat0() { Time t = new Time(Time.TIMEZONE_UTC); String r = t.format("%Y%m%dT%H%M%S"); // System.out.println("r='" + r + "'"); } @SmallTest public void testToString0() throws Exception { @Test public void testToString0() { Time t = new Time(Time.TIMEZONE_UTC); String r = t.toString(); // System.out.println("r='" + r + "'"); } @SmallTest public void testGetCurrentTimezone0() throws Exception { @Test public void testGetCurrentTimezone0() { String r = Time.getCurrentTimezone(); // System.out.println("r='" + r + "'"); } @SmallTest public void testSetToNow0() throws Exception { @Test public void testSetToNow0() { Time t = new Time(Time.TIMEZONE_UTC); t.setToNow(); // System.out.println("t=" + t); } @SmallTest public void testMillis0() throws Exception { @Test public void testMillis0() { Time t = new Time(Time.TIMEZONE_UTC); t.set(0, 0, 0, 1, 1, 2006); long r = t.toMillis(true /* ignore isDst */); Loading @@ -338,23 +346,23 @@ public class TimeTest extends TestCase { // System.out.println("r=" + r); } @SmallTest public void testMillis1() throws Exception { @Test public void testMillis1() { Time t = new Time(Time.TIMEZONE_UTC); t.set(1, 0, 0, 1, 0, 1970); long r = t.toMillis(true /* ignore isDst */); // System.out.println("r=" + r); } @SmallTest public void testParse0() throws Exception { @Test public void testParse0() { Time t = new Time(Time.TIMEZONE_UTC); t.parse("12345678T901234"); // System.out.println("t=" + t); } @SmallTest public void testParse33390() throws Exception { @Test public void testParse33390() { Time t = new Time(Time.TIMEZONE_UTC); t.parse3339("1980-05-23"); Loading Loading @@ -435,8 +443,8 @@ public class TimeTest extends TestCase { } } @SmallTest public void testSet0() throws Exception { @Test public void testSet0() { Time t = new Time(Time.TIMEZONE_UTC); t.set(1000L); // System.out.println("t.year=" + t.year); Loading @@ -449,8 +457,8 @@ public class TimeTest extends TestCase { // System.out.println("t=" + t); } @SmallTest public void testSet1() throws Exception { @Test public void testSet1() { Time t = new Time(Time.TIMEZONE_UTC); t.set(1, 2, 3, 4, 5, 6); // System.out.println("t=" + t); Loading Loading @@ -520,7 +528,7 @@ public class TimeTest extends TestCase { }; @Suppress public void disableTestGetJulianDay() throws Exception { public void disableTestGetJulianDay() { Time time = new Time(); // For each day of the year, and for each timezone, get the Julian Loading Loading @@ -562,7 +570,7 @@ public class TimeTest extends TestCase { } @Suppress public void disableTestSetJulianDay() throws Exception { public void disableTestSetJulianDay() { Time time = new Time(); // For each day of the year in 2008, and for each timezone, Loading
core/tests/coretests/src/android/text/method/BackspaceTest.java +12 −6 Original line number Diff line number Diff line Loading @@ -17,9 +17,13 @@ package android.text.method; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; import android.text.InputType; import android.view.KeyEvent; import android.widget.TextView.BufferType; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; /** * Test backspace key handling of {@link android.text.method.BaseKeyListener}. Loading @@ -27,6 +31,8 @@ import android.widget.TextView.BufferType; * Only contains edge cases. For normal cases, see {@see android.text.method.cts.BackspaceTest}. * TODO: introduce test cases for surrogate pairs and replacement span. */ @SmallTest @RunWith(AndroidJUnit4.class) public class BackspaceTest extends KeyListenerTestCase { private static final BaseKeyListener mKeyListener = new BaseKeyListener() { public int getInputType() { Loading @@ -49,7 +55,7 @@ public class BackspaceTest extends KeyListenerTestCase { state.mSelectionEnd = mTextView.getSelectionEnd(); } @SmallTest @Test public void testCombiningEnclosingKeycaps() { EditorState state = new EditorState(); Loading Loading @@ -77,7 +83,7 @@ public class BackspaceTest extends KeyListenerTestCase { state.assertEquals("|"); } @SmallTest @Test public void testVariationSelector() { EditorState state = new EditorState(); Loading Loading @@ -141,7 +147,7 @@ public class BackspaceTest extends KeyListenerTestCase { state.assertEquals("|"); } @SmallTest @Test public void testEmojiZWJSequence() { EditorState state = new EditorState(); Loading Loading @@ -221,7 +227,7 @@ public class BackspaceTest extends KeyListenerTestCase { state.assertEquals("|"); } @SmallTest @Test public void testFlags() { EditorState state = new EditorState(); Loading Loading @@ -283,7 +289,7 @@ public class BackspaceTest extends KeyListenerTestCase { state.assertEquals("'a' |"); } @SmallTest @Test public void testEmojiModifier() { EditorState state = new EditorState(); Loading Loading @@ -312,7 +318,7 @@ public class BackspaceTest extends KeyListenerTestCase { state.assertEquals("|"); } @SmallTest @Test public void testMixedEdgeCases() { EditorState state = new EditorState(); Loading