Search in sources :

Example 21 with MediumTest

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());
}
Also used : Merge(android.view.Merge) ViewGroup(android.view.ViewGroup) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 22 with MediumTest

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);
}
Also used : MockContext(android.test.mock.MockContext) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 23 with MediumTest

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);
}
Also used : MockContext(android.test.mock.MockContext) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter) View(android.view.View) ListView(android.widget.ListView) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 24 with MediumTest

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();
}
Also used : VelocityTracker(android.view.VelocityTracker) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 25 with MediumTest

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();
}
Also used : VelocityTracker(android.view.VelocityTracker) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Aggregations

MediumTest (android.test.suitebuilder.annotation.MediumTest)1023 View (android.view.View)246 ListView (android.widget.ListView)151 Cursor (android.database.Cursor)116 Handler (android.os.Handler)116 Suppress (android.test.suitebuilder.annotation.Suppress)73 TextView (android.widget.TextView)67 ContentValues (android.content.ContentValues)63 ServiceStatus (com.vodafone360.people.service.ServiceStatus)60 SQLiteCursor (android.database.sqlite.SQLiteCursor)54 SQLiteStatement (android.database.sqlite.SQLiteStatement)49 IOException (java.io.IOException)49 UiThreadTest (android.test.UiThreadTest)48 Message (android.os.Message)43 LogRec (com.android.internal.util.StateMachine.LogRec)42 Intent (android.content.Intent)40 ContentResolver (android.content.ContentResolver)37 GridView (android.widget.GridView)36 InputStream (java.io.InputStream)36 ByteArrayInputStream (java.io.ByteArrayInputStream)35