如何在Android的测试用例使用JUnit测试轻扫/一扔事件 [英] How to test swipe/fling event using jUnit in Android testcase

查看:158
本文介绍了如何在Android的测试用例使用JUnit测试轻扫/一扔事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现,在 android.test.TouchUtils 有一个拖动的方法,我尝试,但 onfling()似乎没有反应过来这个动作。我也尝试robotium的 scrollToSide(INT),不工作要么。任何建议,我怎么能在我的测试情况下,实现这一目标?

I find that in android.test.TouchUtils there is a drag method, I try it, but onfling() seems not react to this action. I also try robotium's scrollToSide(int), not working either. Any suggestions that how I can achieve this in my test case?

推荐答案

我相信你可以使用 MotionEvent 类,它是获得()方法来模拟各种刷卡的/触摸手势。以下是我对这个发现的第一个教程,它应该让你开始:的 http://softteco.blogspot.com/2011/02/touch-hold-swipe-release-gesture.html

I believe you could use MotionEvent class and it's obtain() method to simulate all kinds of swipe/touch gestures. Here's the first tutorial I found on this, it should get you started: http://softteco.blogspot.com/2011/02/touch-hold-swipe-release-gesture.html

这篇关于如何在Android的测试用例使用JUnit测试轻扫/一扔事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆