當前位置: 首頁>>代碼示例>>Java>>正文


Java TouchUtils類代碼示例

本文整理匯總了Java中android.test.TouchUtils的典型用法代碼示例。如果您正苦於以下問題:Java TouchUtils類的具體用法?Java TouchUtils怎麽用?Java TouchUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TouchUtils類屬於android.test包,在下文中一共展示了TouchUtils類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testSwipingEmptyView

import android.test.TouchUtils; //導入依賴的package包/類
/**
 * 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());
        }
    });
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:SampleTests.java

示例2: testSwipingListView

import android.test.TouchUtils; //導入依賴的package包/類
/**
 * 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());
        }
    });
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:SampleTests.java

示例3: setUp

import android.test.TouchUtils; //導入依賴的package包/類
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_");
        addAllTargetView("TC_");

        Thread.sleep(3000);
    }
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:27,代碼來源:WeexUiTestCaseTcTextStyleColumn.java

示例4: setUp

import android.test.TouchUtils; //導入依賴的package包/類
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_");
        addAllTargetView("TC_");

        Thread.sleep(3000);
    }
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:27,代碼來源:WeexUiTestCaseTcTextStyleRow.java

示例5: setUpToFindComponet

import android.test.TouchUtils; //導入依賴的package包/類
/**
 *
 */
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;
        }

    }
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:21,代碼來源:WeexUiTestCaseTCAHrefEvent.java

示例6: setUpToFindComponet

import android.test.TouchUtils; //導入依賴的package包/類
/**
 *
 */
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;
        }

    }
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:21,代碼來源:WeexUiTestCaseTCAHrefUpdate.java

示例7: setUpToFindComponet

import android.test.TouchUtils; //導入依賴的package包/類
/**
 *
 */
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;
        }

    }
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:21,代碼來源:TestFlow.java

示例8: findTargetComponetIfNotFound

import android.test.TouchUtils; //導入依賴的package包/類
/**
 *
 */
public void findTargetComponetIfNotFound(String target, InstrumentationTestCase test){
    if(mCaseListIndexView.size() ==1 || targetComponetNotFound){
        if(((WXTextView)mCaseListIndexView.get(0))
                .getText()
                .toString()
                .equals("TC__Home")){

            TouchUtils.dragQuarterScreenUp(test,WXPageActivity.wxPageActivityInstance );
            mViewGroup = (ViewGroup) WXPageActivity.wxPageActivityInstance.findViewById(R.id.container);
            mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, target);
        }

        TouchUtils.dragQuarterScreenUp(test, WXPageActivity.wxPageActivityInstance );
        mViewGroup = (ViewGroup) WXPageActivity.wxPageActivityInstance.findViewById(R.id.container);
        mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, target);
    }
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:21,代碼來源:WeexUiTestCaseTCAHrefEvent.java

示例9: findTargetComponetIfNotFound

import android.test.TouchUtils; //導入依賴的package包/類
/**
 *
 */
public void findTargetComponetIfNotFound(String target, InstrumentationTestCase test){
    
    if(mCaseListIndexView.size() ==1 || targetComponetNotFound){
        if(((WXTextView)mCaseListIndexView.get(0))
                .getText()
                .toString()
                .equals("TC__Home")){

            TouchUtils.dragQuarterScreenUp(test,WXPageActivity.wxPageActivityInstance );
            mViewGroup = (ViewGroup) WXPageActivity.wxPageActivityInstance.findViewById(R.id.container);
            mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, target);
        }

        TouchUtils.dragQuarterScreenUp(test, WXPageActivity.wxPageActivityInstance );
        mViewGroup = (ViewGroup) WXPageActivity.wxPageActivityInstance.findViewById(R.id.container);
        mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, target);
    }
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:22,代碼來源:WeexUiTestCaseTCAHrefStyle.java

示例10: setUp

import android.test.TouchUtils; //導入依賴的package包/類
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);
    }
 
開發者ID:dodola,項目名稱:WeexOne,代碼行數:26,代碼來源:WeexUiTestCaseTcTextStyleOwn.java

示例11: setUp

import android.test.TouchUtils; //導入依賴的package包/類
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);
    }
 
開發者ID:dodola,項目名稱:WeexOne,代碼行數:25,代碼來源:WeexUiTestCaseTcTextStyleColumn.java

示例12: setUp

import android.test.TouchUtils; //導入依賴的package包/類
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);
    }
 
開發者ID:dodola,項目名稱:WeexOne,代碼行數:25,代碼來源:WeexUiTestCaseTcTextStyleRow.java

示例13: setUp

import android.test.TouchUtils; //導入依賴的package包/類
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);
    }
 
開發者ID:Laisly,項目名稱:weex,代碼行數:24,代碼來源:WeexUiTestCaseTcTextStyleOwn.java

示例14: setUp

import android.test.TouchUtils; //導入依賴的package包/類
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);
    }
 
開發者ID:Laisly,項目名稱:weex,代碼行數:23,代碼來源:WeexUiTestCaseTcTextStyleColumn.java

示例15: setUp

import android.test.TouchUtils; //導入依賴的package包/類
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);
    }
 
開發者ID:Laisly,項目名稱:weex,代碼行數:23,代碼來源:WeexUiTestCaseTcTextStyleRow.java


注:本文中的android.test.TouchUtils類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。