Android??????????????????μ????????
???????????? ???????[ 2012/10/26 10:19:07 ] ????????
???????дAndroid???????????????????????????????????????????Android?汾????????????е?ú???????????????????汾??Android??????????в????????????????????????????????View?????????????robotium??click???????????
????View view = ... // ???????????????View?????
????solo.click(view); // ?????????
????????????????????е??????????????????????????????????????в????汾??????????????????????????????汾???????е?ú????????????????汾????????????????????
??????????????????????????Android??????????????????????????????п????????????????????????????С?????????????????????????Щ????????????????????С?Щ????????????
????????Щ?????????????????????????????????????????????????????С – ?????dp??λ?????dp??λ?????е?????????????????????????????????????????????????????????android??????????????????????????????????????????????????????????????С????μ????????????
????????????????????????????????Щ??????Android?????????????????????????????????????????????????????????????????????????16????????????????????????????????????? 16???? / 160 dpi????????????磨??2.5???????????????????????棬??????????16???? / 240 dpi?????????????磨??1.7??????????????????????????????????????????????о????????????????????Щ??
???????????????????????棬??????DPI?????С?????????????????????????????????????????????????????????????robotium?????instrumentation??????android??????????????????????????????????λ???x??y????Robotium???????????????????????
????1????????????????View???????
????2?????View. getLocationOnScreen?????????????????????????????????λ???????
????3?????View.getWidth??View.getHeight?????????????С??
????4????????????????м?λ??????λ???????????????????????С????ó????????λ????????
????5?????robotium??????λ???x??y?????????????android??????
1: public void clickOnScreen(float x?? float y) {
2: long downTime = SystemClock.uptimeMillis();
3: long eventTime = SystemClock.uptimeMillis();
4: MotionEvent event = MotionEvent.obtain(downTime?? eventTime??
5: MotionEvent.ACTION_DOWN?? x?? y?? 0);
6: MotionEvent event2 = MotionEvent.obtain(downTime?? eventTime??
7: MotionEvent.ACTION_UP?? x?? y?? 0);
8: try{
9: inst.sendPointerSync(event);
10: inst.sendPointerSync(event2);
11: sleeper.sleep(MINISLEEP);
12: }catch(SecurityException e){
13: Assert.assertTrue("Click can not be completed!"?? false);
14: }
15: }
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11