本文整理汇总了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());
}
});
}
示例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());
}
});
}
示例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);
}
示例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);
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}