Search in sources :

Example 26 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.

the class TimeTest method testMillis1.

@SmallTest
public void testMillis1() throws Exception {
    Time t = new Time(Time.TIMEZONE_UTC);
    t.set(1, 0, 0, 1, 0, 1970);
    long r = t.toMillis(true);
// System.out.println("r=" + r);
}
Also used : Time(android.text.format.Time) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 27 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.

the class PatternsTest method testPhonePattern.

@SmallTest
public void testPhonePattern() throws Exception {
    boolean t;
    t = Patterns.PHONE.matcher("(919) 555-1212").matches();
    assertTrue("Valid phone", t);
    t = Patterns.PHONE.matcher("2334 9323/54321").matches();
    assertFalse("Invalid phone", t);
    String[] tests = { "Me: 16505551212 this\n", "Me: 6505551212 this\n", "Me: 5551212 this\n", "Me: 2211 this\n", "Me: 112 this\n", "Me: 1-650-555-1212 this\n", "Me: (650) 555-1212 this\n", "Me: +1 (650) 555-1212 this\n", "Me: +1-650-555-1212 this\n", "Me: 650-555-1212 this\n", "Me: 555-1212 this\n", "Me: 1.650.555.1212 this\n", "Me: (650) 555.1212 this\n", "Me: +1 (650) 555.1212 this\n", "Me: +1.650.555.1212 this\n", "Me: 650.555.1212 this\n", "Me: 555.1212 this\n", "Me: 1 650 555 1212 this\n", "Me: (650) 555 1212 this\n", "Me: +1 (650) 555 1212 this\n", "Me: +1 650 555 1212 this\n", "Me: 650 555 1212 this\n", "Me: 555 1212 this\n" };
    for (String test : tests) {
        Matcher m = Patterns.PHONE.matcher(test);
        assertTrue("Valid phone " + test, m.find());
    }
}
Also used : Matcher(java.util.regex.Matcher) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 28 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.

the class CreateViewTest method testLayout2.

@SmallTest
public void testLayout2() throws Exception {
    LinearLayout vert = new LinearLayout(mContext);
    vert.addView(new CreateViewTest.ViewOne(mContext), new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT, 0));
}
Also used : LinearLayout(android.widget.LinearLayout) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 29 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.

the class MenuTest method testCheckable.

@SmallTest
public void testCheckable() {
    final int groupId = 1;
    final MenuItem item1 = mMenu.add(groupId, 1, 0, "item1");
    final MenuItem item2 = mMenu.add(groupId, 2, 0, "item2");
    // Set to exclusive
    mMenu.setGroupCheckable(groupId, true, true);
    Assert.assertTrue("Item was not set to checkable", item1.isCheckable());
    item1.setChecked(true);
    Assert.assertTrue("Item did not get checked", item1.isChecked());
    Assert.assertFalse("Item was not unchecked due to exclusive checkable", item2.isChecked());
    mMenu.findItem(2).setChecked(true);
    Assert.assertTrue("Item did not get checked", item2.isChecked());
    Assert.assertFalse("Item was not unchecked due to exclusive checkable", item1.isChecked());
    // Multiple non-exlusive checkable items
    mMenu.setGroupCheckable(groupId, true, false);
    Assert.assertTrue("Item was not set to checkable", item1.isCheckable());
    item1.setChecked(false);
    Assert.assertFalse("Item did not get unchecked", item1.isChecked());
    item1.setChecked(true);
    Assert.assertTrue("Item did not get checked", item1.isChecked());
    mMenu.findItem(2).setChecked(true);
    Assert.assertTrue("Item did not get checked", item2.isChecked());
    Assert.assertTrue("Item was unchecked when it shouldnt have been", item1.isChecked());
}
Also used : MenuItem(android.view.MenuItem) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 30 with SmallTest

use of android.test.suitebuilder.annotation.SmallTest in project android_frameworks_base by ParanoidAndroid.

the class MenuTest method testGroupId.

@SmallTest
public void testGroupId() {
    final int groupId = 541;
    final int item1Index = 1;
    final int item2Index = 3;
    mMenu.add(0, 0, item1Index - 1, "ignore");
    final MenuItem item = mMenu.add(groupId, 0, item1Index, "test");
    mMenu.add(0, 0, item2Index - 1, "ignore");
    final MenuItem item2 = mMenu.add(groupId, 0, item2Index, "test2");
    Assert.assertEquals(groupId, item.getGroupId());
    Assert.assertEquals(groupId, item2.getGroupId());
    Assert.assertEquals(item1Index, mMenu.findGroupIndex(groupId));
    Assert.assertEquals(item2Index, mMenu.findGroupIndex(groupId, item1Index + 1));
}
Also used : MenuItem(android.view.MenuItem) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

SmallTest (android.test.suitebuilder.annotation.SmallTest)1764 Parcel (android.os.Parcel)143 Time (android.text.format.Time)97 Rect (android.graphics.Rect)94 ByteBuffer (java.nio.ByteBuffer)71 Bundle (android.os.Bundle)68 LinkProperties (android.net.LinkProperties)66 ArrayList (java.util.ArrayList)63 SpannableString (android.text.SpannableString)60 DhcpPacket (android.net.dhcp.DhcpPacket)52 Rational (android.util.Rational)50 File (java.io.File)47 RouteInfo (android.net.RouteInfo)45 NetworkRequest (android.net.NetworkRequest)44 ParcelUuid (android.os.ParcelUuid)43 MenuItem (android.view.MenuItem)42 BitwiseInputStream (com.android.internal.util.BitwiseInputStream)42 BitwiseOutputStream (com.android.internal.util.BitwiseOutputStream)42 CaptureRequest (android.hardware.camera2.CaptureRequest)40 IpPrefix (android.net.IpPrefix)40