android.test.TouchUtils Java Examples
The following examples show how to use
android.test.TouchUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SampleTests.java From android-SwipeRefreshLayoutBasic with Apache License 2.0 | 6 votes |
/** * Test that swiping on the populated list triggers a refresh. */ public void testSwipingListView() { // Given a SwipeRefreshLayout which is displaying a populated list // When the swipe refresh layout is dragged TouchUtils.dragViewBy(this, mSwipeRefreshLayout, Gravity.CENTER, 0, Math.round(mSwipeRefreshLayout.getHeight() * 0.4f)); // Then the SwipeRefreshLayout should be refreshing // We need to use runOnMainSync here as fake dragging uses waitForIdleSync() getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { assertTrue(mSwipeRefreshLayout.isRefreshing()); } }); }
Example #2
Source File: WeexUiTestCaseTcTextType.java From incubator-weex-playground with Apache License 2.0 | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("org.apache.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); Thread.sleep(2000); TouchUtils.scrollToBottom(this, waTestPageActivity, mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); addAllTargetView("TC_"); Thread.sleep(3000); }
Example #3
Source File: WeexUiTestCaseTcTextStyleColumn.java From incubator-weex-playground with Apache License 2.0 | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("org.apache.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); Thread.sleep(2000); TouchUtils.scrollToBottom(this, waTestPageActivity, mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); addAllTargetView("TC_"); Thread.sleep(3000); }
Example #4
Source File: SampleTests.java From views-widgets-samples with Apache License 2.0 | 6 votes |
/** * Test that swiping on the populated list triggers a refresh. */ public void testSwipingListView() { // Given a SwipeRefreshLayout which is displaying a populated list // When the swipe refresh layout is dragged TouchUtils.dragViewBy(this, mSwipeRefreshLayout, Gravity.CENTER, 0, Math.round(mSwipeRefreshLayout.getHeight() * 0.4f)); // Then the SwipeRefreshLayout should be refreshing // We need to use runOnMainSync here as fake dragging uses waitForIdleSync() getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { assertTrue(mSwipeRefreshLayout.isRefreshing()); } }); }
Example #5
Source File: SampleTests.java From views-widgets-samples with Apache License 2.0 | 6 votes |
/** * Test that swiping on the empty view triggers a refresh. */ public void testSwipingEmptyView() { // Given a SwipeRefreshLayout which is displaying the empty view // When the swipe refresh layout is dragged TouchUtils.dragViewBy(this, mSwipeRefreshLayout, Gravity.CENTER, 0, Math.round(mSwipeRefreshLayout.getHeight() * 0.4f)); // Then the SwipeRefreshLayout should be refreshing getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { assertTrue(mSwipeRefreshLayout.isRefreshing()); } }); }
Example #6
Source File: WeexUiTestCaseTcTextStyleRow.java From incubator-weex-playground with Apache License 2.0 | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("org.apache.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); Thread.sleep(2000); TouchUtils.scrollToBottom(this, waTestPageActivity, mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); addAllTargetView("TC_"); Thread.sleep(3000); }
Example #7
Source File: WeexUiTestCaseTCAHrefEvent.java From incubator-weex-playground with Apache License 2.0 | 6 votes |
/** * */ public void setUpToFindComponet(String target, InstrumentationTestCase test){ int max = 60; int count = 0; while(mCaseListIndexView.size() == 0){ if (count < max){ TouchUtils.dragQuarterScreenUp(test, WXPageActivity.wxPageActivityInstance ); mViewGroup = (ViewGroup) WXPageActivity.wxPageActivityInstance.findViewById(R.id.container); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, target); count ++; } else{ break; } } }
Example #8
Source File: WeexUiTestCaseTCAHrefUpdate.java From incubator-weex-playground with Apache License 2.0 | 6 votes |
/** * */ public void setUpToFindComponet(String target, InstrumentationTestCase test){ int max = 60; int count = 0; while(mCaseListIndexView.size() == 0){ if (count < max){ TouchUtils.dragQuarterScreenUp(test, WXPageActivity.wxPageActivityInstance ); mViewGroup = (ViewGroup) WXPageActivity.wxPageActivityInstance.findViewById(R.id.container); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, target); count ++; } else{ targetComponetNotFound = true; } } }
Example #9
Source File: WeexUiTestCaseTCAHrefStyle.java From incubator-weex-playground with Apache License 2.0 | 6 votes |
/** * */ public void setUpToFindComponet(String target, InstrumentationTestCase test){ int max = 60; int count = 0; while(mCaseListIndexView.size() == 0){ if (count < max){ TouchUtils.dragQuarterScreenUp(test, WXPageActivity.wxPageActivityInstance ); mViewGroup = (ViewGroup) WXPageActivity.wxPageActivityInstance.findViewById(R.id.container); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, target); count ++; } else{ break; } } }
Example #10
Source File: TestFlow.java From incubator-weex-playground with Apache License 2.0 | 6 votes |
private void findChildCase(final WXTextView inputView ){ // handle if the view is INVISIBLE then scrollToBottom // int maxStep = 10; int scrollCount = 0; if(inputView.getVisibility() == View.INVISIBLE){ while(scrollCount <maxStep){ TouchUtils.dragQuarterScreenUp(this, this.getActivity()); sleep(1000); scrollCount ++; } } // int topCount = 10; if(inputView.getVisibility() == View.INVISIBLE){ while(topCount>0 && (inputView.getVisibility() == View.INVISIBLE)){ TouchUtils.dragQuarterScreenDown(this, this.getActivity()); sleep(1000); topCount--; } } }
Example #11
Source File: TestFlow.java From incubator-weex-playground with Apache License 2.0 | 6 votes |
/** * */ public void setUpToFindComponet(String targert){ int max = 60; int count = 0; while(mCaseListIndexView.size() == 0){ if (count < max){ TouchUtils.dragQuarterScreenUp(this, this.getActivity()); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, targert); count ++; } else{ break; } } }
Example #12
Source File: SampleTests.java From user-interface-samples with Apache License 2.0 | 6 votes |
/** * Test that the floating shape can be dragged and that it's raised while dragging. */ public void testDrag() { final float initialX = mFloatingShape.getX(); // Drag the shape to the left edge. TouchUtils.dragViewToX(this, mFloatingShape, Gravity.CENTER, 0); // Check that the view is dragging and that it's been raised. // We need to use runOnMainSync here as fake dragging uses waitForIdleSync(). getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { // Check that the view has moved. float deltaX = mFloatingShape.getX() - initialX; assertTrue(Math.abs(deltaX) > 0f); // Check that the view is raised. assertTrue(mFloatingShape.getZ() > 0f); } }); }
Example #13
Source File: WeexUiTestCaseTcTextStyleOwn.java From WeexOne with MIT License | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); Thread.sleep(2000); TouchUtils.scrollToBottom(this, waTestPageActivity, mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); Thread.sleep(3000); }
Example #14
Source File: WeexUiTestCaseTcTextStyleRow.java From WeexOne with MIT License | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); Thread.sleep(2000); TouchUtils.scrollToBottom(this, waTestPageActivity, mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); Thread.sleep(3000); }
Example #15
Source File: SampleTests.java From views-widgets-samples with Apache License 2.0 | 6 votes |
/** * Test that swiping on the populated list triggers a refresh. */ public void testSwipingListView() { // Given a SwipeRefreshLayout which is displaying a populated list populateList(); // When the swipe refresh layout is dragged TouchUtils.dragViewBy(this, mSwipeRefreshLayout, Gravity.CENTER, 0, Math.round(mSwipeRefreshLayout.getHeight() * 0.4f)); // Then the SwipeRefreshLayout should be refreshing // We need to use runOnMainSync here as fake dragging uses waitForIdleSync() getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { assertTrue(mSwipeRefreshLayout.isRefreshing()); } }); }
Example #16
Source File: SampleTests.java From android-SwipeRefreshListFragment with Apache License 2.0 | 6 votes |
/** * Test that swiping on the populated list triggers a refresh. */ public void testSwipingListView() { // Given a SwipeRefreshLayout which is displaying a populated list // When the swipe refresh layout is dragged TouchUtils.dragViewBy(this, mSwipeRefreshLayout, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, Math.round(mSwipeRefreshLayout.getHeight() * 0.4f)); // Then the SwipeRefreshLayout should be refreshing // We need to use runOnMainSync here as fake dragging uses waitForIdleSync() getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { assertTrue(mSwipeRefreshLayout.isRefreshing()); } }); }
Example #17
Source File: SampleTests.java From android-SwipeRefreshMultipleViews with Apache License 2.0 | 6 votes |
/** * Test that swiping on the populated list triggers a refresh. */ public void testSwipingListView() { // Given a SwipeRefreshLayout which is displaying a populated list populateList(); // When the swipe refresh layout is dragged TouchUtils.dragViewBy(this, mSwipeRefreshLayout, Gravity.CENTER, 0, Math.round(mSwipeRefreshLayout.getHeight() * 0.4f)); // Then the SwipeRefreshLayout should be refreshing // We need to use runOnMainSync here as fake dragging uses waitForIdleSync() getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { assertTrue(mSwipeRefreshLayout.isRefreshing()); } }); }
Example #18
Source File: SampleTests.java From android-SwipeRefreshMultipleViews with Apache License 2.0 | 6 votes |
/** * Test that swiping on the empty view triggers a refresh. */ public void testSwipingEmptyView() { // Given a SwipeRefreshLayout which is displaying the empty view // When the swipe refresh layout is dragged TouchUtils.dragViewBy(this, mSwipeRefreshLayout, Gravity.CENTER, 0, Math.round(mSwipeRefreshLayout.getHeight() * 0.4f)); // Then the SwipeRefreshLayout should be refreshing getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { assertTrue(mSwipeRefreshLayout.isRefreshing()); } }); }
Example #19
Source File: SampleTests.java From android-ElevationDrag with Apache License 2.0 | 6 votes |
/** * Test that the floating shape can be dragged and that it's raised while dragging. */ public void testDrag() { final float initialX = mFloatingShape.getX(); // Drag the shape to the left edge. TouchUtils.dragViewToX(this, mFloatingShape, Gravity.CENTER, 0); // Check that the view is dragging and that it's been raised. // We need to use runOnMainSync here as fake dragging uses waitForIdleSync(). getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { // Check that the view has moved. float deltaX = mFloatingShape.getX() - initialX; assertTrue(Math.abs(deltaX) > 0f); // Check that the view is raised. assertTrue(mFloatingShape.getZ() > 0f); } }); }
Example #20
Source File: WeexUiTestCaseTcTextType.java From weex with Apache License 2.0 | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); TouchUtils.scrollToBottom(this, waTestPageActivity, mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); Thread.sleep(3000); }
Example #21
Source File: WeexUiTestCaseTcTextStyleRow.java From weex with Apache License 2.0 | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); TouchUtils.scrollToBottom(this, waTestPageActivity, mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); Thread.sleep(3000); }
Example #22
Source File: WeexUiTestCaseTcTextStyleColumn.java From weex with Apache License 2.0 | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); TouchUtils.scrollToBottom(this, waTestPageActivity, mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); Thread.sleep(1000); }
Example #23
Source File: WeexUiTestCaseTcTextStyleOwn.java From weex with Apache License 2.0 | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); TouchUtils.scrollToBottom(this, waTestPageActivity, mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); Thread.sleep(3000); }
Example #24
Source File: WeexUiTestCaseTcTextType.java From WeexOne with MIT License | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); Thread.sleep(2000); TouchUtils.scrollToBottom(this, waTestPageActivity, mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); Thread.sleep(3000); }
Example #25
Source File: WeexUiTestCaseTcTextStyleColumn.java From WeexOne with MIT License | 6 votes |
public void setUp() throws Exception{ Log.e("TestScript_Guide", "setUp test!!"); setActivityInitialTouchMode(false); weappApplication = new WeappJsBaseTestCase(); mInstrumentation = getInstrumentation(); Intent intent = new Intent(); intent.putExtra("bundleUrl", Constants.BUNDLE_URL); launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent); waTestPageActivity = getActivity(); // waTestPageActivity.getIntent().getData().toString(); Log.e(TAG,"activity1=" + waTestPageActivity.toString() ); Thread.sleep(3000); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); setViewGroup(mViewGroup); Thread.sleep(2000); TouchUtils.scrollToBottom(this, waTestPageActivity, mViewGroup); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_"); Thread.sleep(3000); }
Example #26
Source File: SampleTests.java From android-ClippingBasic with Apache License 2.0 | 5 votes |
/** * Triggers a click on the button and tests if the view is clipped afterwards. */ public void testClipping() { View clippedView = mTestActivity.findViewById(R.id.frame); // Initially, the view is not clipped. assertFalse(clippedView.getClipToOutline()); // Trigger a click on the button to activate clipping. TouchUtils.clickView(this, mTestActivity.findViewById(R.id.button)); // Check that the view has been clipped. assertTrue(clippedView.getClipToOutline()); }
Example #27
Source File: IFrameTest.java From cordova-amazon-fireos with Apache License 2.0 | 5 votes |
protected void setUp() throws Exception { super.setUp(); mInstr = this.getInstrumentation(); testActivity = this.getActivity(); containerView = (FrameLayout) testActivity.findViewById(android.R.id.content); innerContainer = (LinearLayout) containerView.getChildAt(0); testView = (CordovaWebView) innerContainer.getChildAt(0); touch = new TouchUtils(); touchTool = new Purity(testActivity, getInstrumentation()); }
Example #28
Source File: WeexUiTestCaseTcDowngradeDevMTrue.java From incubator-weex-playground with Apache License 2.0 | 5 votes |
public void addAllTargetView(String target){ int max = 6; int count =0 ; while (count < max){ TouchUtils.dragQuarterScreenUp(this, this.getActivity()); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, target); mCaseListIndexView.addAll(mCaseListIndexView); count ++; } }
Example #29
Source File: WeexUiTestCaseTcDowngradeOSVTrue.java From incubator-weex-playground with Apache License 2.0 | 5 votes |
public void addAllTargetView(String target){ int max = 6; int count =0 ; while (count < max){ TouchUtils.dragQuarterScreenUp(this, this.getActivity()); mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container); mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, target); mCaseListIndexView.addAll(mCaseListIndexView); count ++; } }
Example #30
Source File: DocumentCentricAppsInstrumentationTest.java From android-DocumentCentricApps with Apache License 2.0 | 5 votes |
public void testNewDocument_CreatesOverviewEntry() { // Given a initialized Activity assertNotNull("mDocumentCentricActivity is null", mDocumentCentricActivity); final Button createNewDocumentButton = (Button) mDocumentCentricActivity .findViewById(R.id.new_document_button); assertNotNull(createNewDocumentButton); // When "Create new Document" Button is clicked TouchUtils.clickView(this, createNewDocumentButton); // Then a entry in overview app tasks is created. List<ActivityManager.AppTask> recentAppTasks = getRecentAppTasks(); assertEquals("# of recentAppTasks does not match", 2, recentAppTasks.size()); }