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);
}
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());
}
}
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));
}
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());
}
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));
}
Aggregations