使用UiAutomator中swipe(Point[], int)方法绘制解锁图案
2015-07-06 11:51
651 查看
swipe(Point[] segments, int segmentSteps)
实现的方法,从point数组中的第一个点滑动到第二个点,第二个点滑动到第三个点,依次滑动,形成一条条折线,每条直线所有步伐segmentSteps
例如:
package com.vv7; import junit.framework.Assert; import com.android.uiautomator.core.UiObject; import com.android.uiautomator.core.UiObjectNotFoundException; import com.android.uiautomator.core.UiSelector; import com.android.uiautomator.testrunner.UiAutomatorTestCase; import android.graphics.Point; import android.os.RemoteException; public class UnlockCase extends UiAutomatorTestCase { public void testUnlockCase() throws RemoteException, UiObjectNotFoundException { if (getUiDevice().isScreenOn()) { getUiDevice().sleep(); } getUiDevice().wakeUp();// 唤醒屏幕 // 向上滑动,调出图案解锁面板 getUiDevice().swipe(540, 1576, 540, 676, 10); sleep(3000); //绘制解锁图案 Point p1 = new Point(); Point p2 = new Point(); Point p3 = new Point(); Point p4 = new Point(); Point p5 = new Point(); p1.x = 215;p1.y = 872; p2.x = 545;p2.y = 872; p3.x = 545;p3.y = 1202; p4.x = 545;p4.y = 1532; p5.x = 875;p5.y = 1532; Point[] p = { p1, p2, p3, p4, p5 }; getUiDevice().swipe(p, 40); sleep(3000); getUiDevice().pressHome(); UiObject extDateWidget = new UiObject( new UiSelector() .resourceId("com.android.deskclock:id/imageview")); Assert.assertEquals("日期", extDateWidget.getContentDescription()); } }
相关文章推荐
- MIUI添加内存调试工具:查看进程中的Bitmap信息
- 通用 PE 工具箱1.9.6(XP内核)by Uepon(李培聪)
- 开始刷leetcode day59: Unique Paths
- UITableView的优化
- 双心ping GUI工具1.0
- MIUI添加内存调试工具:查看进程中的Bitmap信息
- 文章标题
- N-Queens II DFS
- 利用HTML实现软件的UI
- UIDatePicker简单使用
- UITextView的内容长度限制
- IOS入门学习笔记(普通UI控件--UIButton)
- kernel build
- unique-paths-ii
- N-Queens DFS
- Arduino Uno 在win7 64位下的驱动问题
- DAX Tabular Calculate,Filter,Value和All
- 优先队列priority_queue 用法详解
- UIDynamicAnimator 小结
- 从源代码的角度聊聊java中StringBuffer、StringBuilder、String中的字符串拼接