当前位置: 首页>>代码示例>>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;未经允许,请勿转载。