use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.
the class MergeTest method testMerged.
@MediumTest
public void testMerged() throws Exception {
final Merge activity = getActivity();
final ViewGroup layout = activity.getLayout();
assertEquals("The layout wasn't merged", 7, layout.getChildCount());
}
use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.
the class ListViewTest method testRequestLayout.
/**
* If a view in a ListView requests a layout it should be remeasured.
*/
@MediumTest
public void testRequestLayout() throws Exception {
MockContext context = new MockContext2();
ListView listView = new ListView(context);
List<String> items = Lists.newArrayList("hello");
Adapter<String> adapter = new Adapter<String>(context, 0, items);
listView.setAdapter(adapter);
int measureSpec = View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.EXACTLY);
adapter.notifyDataSetChanged();
listView.measure(measureSpec, measureSpec);
listView.layout(0, 0, 100, 100);
MockView childView = (MockView) listView.getChildAt(0);
childView.requestLayout();
childView.onMeasureCalled = false;
listView.measure(measureSpec, measureSpec);
listView.layout(0, 0, 100, 100);
Assert.assertTrue(childView.onMeasureCalled);
}
use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.
the class ListViewTest method testNoSelectableItems.
/**
* The list view should handle the disappearance of the only selected item, even when that item
* was selected before its disappearance.
*
*/
@MediumTest
public void testNoSelectableItems() throws Exception {
MockContext context = new MockContext2();
ListView listView = new ListView(context);
// We use a header as the unselectable item to remain after the selectable one is removed.
listView.addHeaderView(new View(context), null, false);
List<String> items = Lists.newArrayList("hello");
Adapter<String> adapter = new Adapter<String>(context, 0, items);
listView.setAdapter(adapter);
listView.setSelection(1);
int measureSpec = View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.EXACTLY);
adapter.notifyDataSetChanged();
listView.measure(measureSpec, measureSpec);
listView.layout(0, 0, 100, 100);
items.remove(0);
adapter.notifyDataSetChanged();
listView.measure(measureSpec, measureSpec);
listView.layout(0, 0, 100, 100);
}
use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.
the class VelocityTest method testInitialCondiditions.
@MediumTest
public void testInitialCondiditions() {
VelocityTracker vt = VelocityTracker.obtain();
assertNotNull(vt);
vt.recycle();
}
use of android.test.suitebuilder.annotation.MediumTest in project android_frameworks_base by ParanoidAndroid.
the class VelocityTest method testDragWith2Points.
/**
* Test dragging with two points only
* (velocity must be an exact value)
*/
@MediumTest
public void testDragWith2Points() {
long t = System.currentTimeMillis();
VelocityTracker vt = VelocityTracker.obtain();
// 100px, 2 steps, 100ms => 1000px/s
drag(vt, 100, 200, 100, 200, 2, t, 100);
vt.computeCurrentVelocity(1000);
assertEquals(1000.0f, vt.getXVelocity());
assertEquals(1000.0f, vt.getYVelocity());
vt.recycle();
}
Aggregations