Search in sources :

Example 36 with MediumTest

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

the class VelocityTest method testStabilityInSpace.

/**
     * Velocity is independent of the position of the events,
     * it only depends on their relative distance.
     */
@MediumTest
public void testStabilityInSpace() {
    long t = System.currentTimeMillis();
    VelocityTracker vt = VelocityTracker.obtain();
    drag(vt, 100, 200, 100, 200, 10, t, 400);
    vt.computeCurrentVelocity(1);
    float firstX = vt.getXVelocity();
    float firstY = vt.getYVelocity();
    vt.clear();
    // 100px further
    drag(vt, 200, 300, 200, 300, 10, t, 400);
    vt.computeCurrentVelocity(1);
    float secondX = vt.getXVelocity();
    float secondY = vt.getYVelocity();
    assertEqualFuzzy(firstX, secondX, 0.1f);
    assertEqualFuzzy(firstY, secondY, 0.1f);
    vt.recycle();
}
Also used : VelocityTracker(android.view.VelocityTracker) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 37 with MediumTest

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

the class VelocityTest method testStabilityOfComputation.

/**
     * Test that calls to {@link android.view.VelocityTracker}.computeCurrentVelocity()
     * will output same values when using the same data.
     */
@MediumTest
public void testStabilityOfComputation() {
    long t = System.currentTimeMillis();
    VelocityTracker vt = VelocityTracker.obtain();
    drag(vt, 100, 200, 100, 200, 10, t, 300);
    vt.computeCurrentVelocity(1);
    float firstX = vt.getXVelocity();
    float firstY = vt.getYVelocity();
    vt.computeCurrentVelocity(1);
    float secondX = vt.getXVelocity();
    float secondY = vt.getYVelocity();
    assertEquals(firstX, secondX);
    assertEquals(firstY, secondY);
    vt.recycle();
}
Also used : VelocityTracker(android.view.VelocityTracker) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 38 with MediumTest

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

the class VelocityTest method testDragLinearVertical.

@MediumTest
public void testDragLinearVertical() {
    long t = System.currentTimeMillis();
    VelocityTracker vt = VelocityTracker.obtain();
    // 100px in 400ms => 250px/s
    drag(vt, 200, 200, 100, 200, 15, t, 400);
    vt.computeCurrentVelocity(1000);
    assertEquals(0.0f, vt.getXVelocity());
    assertEqualFuzzy(250.0f, vt.getYVelocity(), 4f);
    vt.recycle();
}
Also used : VelocityTracker(android.view.VelocityTracker) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 39 with MediumTest

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

the class VelocityTest method testDragAcceleration.

@MediumTest
public void testDragAcceleration() {
    long t = System.currentTimeMillis();
    VelocityTracker vt = VelocityTracker.obtain();
    drag(vt, 100, 200, 100, 200, 15, t, 400, new AccelerateInterpolator());
    vt.computeCurrentVelocity(1000);
    assertGreater(250.0f, vt.getXVelocity());
    assertGreater(250.0f, vt.getYVelocity());
    vt.recycle();
}
Also used : AccelerateInterpolator(android.view.animation.AccelerateInterpolator) VelocityTracker(android.view.VelocityTracker) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 40 with MediumTest

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

the class ListEmptyViewTest method testZeroToOneForwardBack.

@MediumTest
public void testZeroToOneForwardBack() {
    Instrumentation inst = getInstrumentation();
    inst.invokeMenuActionSync(mActivity, mActivity.MENU_ADD, 0);
    inst.waitForIdleSync();
    assertTrue("Empty view still shown", mActivity.getEmptyView().getVisibility() == View.GONE);
    assertTrue("List not shown", mActivity.getListView().getVisibility() == View.VISIBLE);
    // Navigate forward
    Intent intent = new Intent();
    intent.setClass(mActivity, ListWithEmptyView.class);
    mActivity.startActivity(intent);
    // Navigate backward
    inst.sendCharacterSync(KeyEvent.KEYCODE_BACK);
    inst.waitForIdleSync();
    assertTrue("Empty view still shown", mActivity.getEmptyView().getVisibility() == View.GONE);
    assertTrue("List not shown", mActivity.getListView().getVisibility() == View.VISIBLE);
}
Also used : Instrumentation(android.app.Instrumentation) Intent(android.content.Intent) 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