use of android.app.Instrumentation in project android_frameworks_base by ParanoidAndroid.
the class ListManagedCursorTest method testKeyScrolling.
/**
* Scroll the list using arrows, launch new activity, hit back, make sure we're still scrolled.
*/
@LargeTest
public void testKeyScrolling() {
Instrumentation inst = getInstrumentation();
int firstVisiblePosition = arrowScroll(inst);
inst.sendCharacterSync(KeyEvent.KEYCODE_BACK);
inst.waitForIdleSync();
assertTrue("List changed to touch mode", !mListView.isInTouchMode());
assertTrue("List did not preserve scroll position", firstVisiblePosition == mListView.getFirstVisiblePosition());
}
use of android.app.Instrumentation in project android_frameworks_base by ParanoidAndroid.
the class ListScrollListenerTest method testKeyScrolling.
@LargeTest
public void testKeyScrolling() {
Instrumentation inst = getInstrumentation();
int firstVisibleItem = mFirstVisibleItem;
for (int i = 0; i < mVisibleItemCount * 2; i++) {
inst.sendCharacterSync(KeyEvent.KEYCODE_DPAD_DOWN);
}
inst.waitForIdleSync();
assertTrue("Arrow scroll did not happen", mFirstVisibleItem > firstVisibleItem);
firstVisibleItem = mFirstVisibleItem;
inst.sendCharacterSync(KeyEvent.KEYCODE_SPACE);
inst.waitForIdleSync();
assertTrue("Page scroll did not happen", mFirstVisibleItem > firstVisibleItem);
firstVisibleItem = mFirstVisibleItem;
KeyEvent down = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_DOWN, 0, KeyEvent.META_ALT_ON);
KeyEvent up = new KeyEvent(0, 0, KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DPAD_DOWN, 0, KeyEvent.META_ALT_ON);
inst.sendKeySync(down);
inst.sendKeySync(up);
inst.waitForIdleSync();
assertTrue("Full scroll did not happen", mFirstVisibleItem > firstVisibleItem);
assertEquals("Full scroll did not happen", mTotalItemCount, mFirstVisibleItem + mVisibleItemCount);
}
use of android.app.Instrumentation in project android_frameworks_base by ParanoidAndroid.
the class ListViewHeightTest method testButtons.
@MediumTest
public void testButtons() {
Instrumentation inst = getInstrumentation();
final Button button1 = (Button) mActivity.findViewById(R.id.button1);
final Button button2 = (Button) mActivity.findViewById(R.id.button2);
final Button button3 = (Button) mActivity.findViewById(R.id.button3);
ListView list = (ListView) mActivity.findViewById(R.id.inner_list);
assertEquals("Unexpected items in adapter", 0, list.getCount());
assertEquals("Unexpected children in list view", 0, list.getChildCount());
mActivity.runOnUiThread(new Runnable() {
public void run() {
button1.performClick();
}
});
inst.waitForIdleSync();
assertTrue("List not be visible after clicking button1", list.isShown());
assertTrue("List incorrect height", list.getHeight() == 200);
mActivity.runOnUiThread(new Runnable() {
public void run() {
button2.performClick();
}
});
inst.waitForIdleSync();
assertTrue("List not be visible after clicking button2", list.isShown());
mActivity.runOnUiThread(new Runnable() {
public void run() {
button3.performClick();
}
});
inst.waitForIdleSync();
assertFalse("List should not be visible clicking button3", list.isShown());
}
use of android.app.Instrumentation in project android_frameworks_base by ParanoidAndroid.
the class EffectsVideoCapture method testBackEffectsVideoCapture.
@LargeTest
public void testBackEffectsVideoCapture() throws Exception {
Instrumentation inst = getInstrumentation();
Intent intent = new Intent();
intent.setClass(getInstrumentation().getTargetContext(), CameraEffectsRecordingSample.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("OUTPUT_FILENAME", Environment.getExternalStorageDirectory().toString() + "/CameraEffectsRecordingTest.mp4");
Activity act = inst.startActivitySync(intent);
captureVideos("Back Camera Video Capture\n", inst);
act.finish();
// Verification
File file = new File(Environment.getExternalStorageDirectory(), "CameraEffectsRecordingTest.mp4");
Uri uri = Uri.fromFile(file);
verify(getActivity(), uri);
}
use of android.app.Instrumentation in project cucumber-jvm by cucumber.
the class CucumberActivitySteps method before.
@Before
public void before() {
assertEquals(0, steps);
Instrumentation instrumentation = getInstrumentation();
assertNotNull(instrumentation);
assertNotNull(getActivity());
String testPackageName = instrumentation.getContext().getPackageName();
String targetPackageName = instrumentation.getContext().getPackageName();
assertEquals(testPackageName, targetPackageName);
}
Aggregations