当前位置: 编程技术>移动开发
本页文章导读:
▪CMMB有关资料 CMMB相关资料
江苏开通CMMB的城市
南京
徐州
淮安
宿迁
无锡
连云港
苏州
盐城
扬州
常州
泰州
镇江
南通
参考
覆盖的城市
......
▪ 在monkeyrunner里应用Java做为脚本语言 在monkeyrunner里使用Java做为脚本语言
monkeyrunner官网和很多地方都是使用的python做为脚本语言的,但是实际上monkeyrunner是支持Java做为脚本语言的,下面是对在monkeyrunner中使用Java的一些尝试,.........
▪ Prefix.pch的功用和用法 Prefix.pch的作用和用法
Hello World_Prefix.pch:扩展名.pch表示"precompiled header",这是一个你工程要用到的来自于外部框架的头文件列表。xcode将编译这些头到文件,这将减少你在选择Build 或Build and Go.........
[1]CMMB有关资料
来源: 互联网 发布时间: 2014-02-18
CMMB相关资料
江苏开通CMMB的城市
江苏开通CMMB的城市
- 南京
- 徐州
- 淮安
- 宿迁
- 无锡
- 连云港
- 苏州
- 盐城
- 扬州
- 常州
- 泰州
- 镇江
- 南通
- 覆盖的城市
[2] 在monkeyrunner里应用Java做为脚本语言
来源: 互联网 发布时间: 2014-02-18
在monkeyrunner里使用Java做为脚本语言
monkeyrunner官网和很多地方都是使用的python做为脚本语言的,但是实际上monkeyrunner是支持Java做为脚本语言的,下面是对在monkeyrunner中使用Java的一些尝试,已经全部使用过是可行的,需要引入的jar包包括:
ddmlib.jar;guavalib.jar;sdklib.jar和monkeyrunner.jar
monkeyrunner官网和很多地方都是使用的python做为脚本语言的,但是实际上monkeyrunner是支持Java做为脚本语言的,下面是对在monkeyrunner中使用Java的一些尝试,已经全部使用过是可行的,需要引入的jar包包括:
ddmlib.jar;guavalib.jar;sdklib.jar和monkeyrunner.jar
package com.test
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import com.aliyun.smoking.monkeyrunner.extend.ImageProcess;
import com.android.monkeyrunner.adb.AdbBackend;
import com.android.monkeyrunner.core.IMonkeyDevice;
import com.android.monkeyrunner.core.IMonkeyImage;
import com.android.monkeyrunner.core.TouchPressType;
/**
* this class provide java code to call monkeyrunner.jar to execute test case
*
* @author cx
*
*/
public class RunnerProxy {
private IMonkeyDevice device;
private AdbBackend adb;
private static RunnerProxy instance;
public static RunnerProxy getInstance() {
if (instance == null) {
instance = new RunnerProxy();
}
return instance;
}
private RunnerProxy() {
adb = new AdbBackend();
}
/**
* this function will connect to a device, emulator or phone
*/
public void connect() {
assert (adb != null);
device = adb.waitForConnection();
}
/**
* this function clear device connect
*/
public void dispose() {
if (device != null) {
device.dispose();
device = null;
}
}
private String imageDir;
public void setImageDir(String imageDir) {
this.imageDir = imageDir;
}
public String getImageDir() {
return imageDir;
}
private String logDir;
public void setLogDir(String logDir) {
this.logDir = logDir;
}
public String getLogDir() {
return logDir;
}
/**
* this function finish touch operation
*
* @param x
* : x coordinate
* @param y
* : y coordinate
*/
public void touch(int x, int y) {
assert (device != null);
device.shell("sendevent /dev/input/event6 3 48 1");
device.shell("sendevent /dev/input/event6 3 53 " + x);
device.shell("sendevent /dev/input/event6 3 54 " + y);
device.shell("sendevent /dev/input/event6 0 2 0");
device.shell("sendevent /dev/input/event6 0 0 0");
device.shell("sendevent /dev/input/event6 3 48 0");
device.shell("sendevent /dev/input/event6 0 2 0");
device.shell("sendevent /dev/input/event6 0 0 0");
}
/**
* this function finish long touch operation
*
* @param x
* : x coordinate
* @param y
* : y coordinate
*/
public void longTouch(int x, int y) {
assert (device != null);
device.drag(x, y, x, y, 10, 2);
}
/**
* this function finish drag from one point to another point
*
* @param x
* : x coordinate of start point
* @param y
* : y coordinate of start point
* @param endX
* : x coordinate of end point
* @param endY
* : Y coordinate of end point
*
*/
public void drag(int x, int y, int endX, int endY) {
assert (device != null);
device.drag(x, y, endX, endY, 10, 2);
}
/**
* this function finish type a text to view operation
*
* @param value
* : text to type in
*/
public void type(String value) {
assert (device != null);
device.type(value);
}
/**
* this function finish click a key operation
*
* @param keyCode
* : key code
*/
public void press(String keyCode) {
assert (device != null);
device.press(keyCode, TouchPressType.DOWN_AND_UP);
}
/**
* this function finish start an activity operation
*
* @param component
* : activity what to start
*/
public void startActivity(String component) {
assert (device != null);
String action = "android.intent.action.MAIN";
Collection<String> categories = new ArrayList<String>();
categories.add("android.intent.category.LAUNCHER");
device.startActivity(null, action, null, null, categories,
new HashMap<String, Object>(), component, 0);
}
}
1 楼
wyg1989
2011-11-02
LZ 为什么我把几个包导进去了 但是引包的时候 com.andorid.monkeyrunner.core.IMonkeyDevice 这个包引不了 不知道怎么回事啊 我的邮箱是 wangyuegang1989@163.com QQ 339631616 能告诉我是为什么啊 谢谢了!!!
[3] Prefix.pch的功用和用法
来源: 互联网 发布时间: 2014-02-18
Prefix.pch的作用和用法
Hello World_Prefix.pch:扩展名.pch表示"precompiled header",这是一个你工程要用到的来自于外部框架的头文件列表。xcode将编译这些头到文件,这将减少你在选择Build 或Build and Go时编译项目的时间。通常用到的头文件已经自动包含了
pch,系统编译每个cpp文件前,都会先include这个文件。这样就节省了添加include的时间,相当于加速编译(有待取证)
还有就是可以再这里面放入宏,在整个工程中都可以用。节省了时间
Hello World_Prefix.pch:扩展名.pch表示"precompiled header",这是一个你工程要用到的来自于外部框架的头文件列表。xcode将编译这些头到文件,这将减少你在选择Build 或Build and Go时编译项目的时间。通常用到的头文件已经自动包含了
pch,系统编译每个cpp文件前,都会先include这个文件。这样就节省了添加include的时间,相当于加速编译(有待取证)
还有就是可以再这里面放入宏,在整个工程中都可以用。节省了时间
1 楼
liuxco
2011-10-14
我们要如何利用这个机制?现在集成的头文件是一个二维码库,是因为.o文件的存在么?如果我们自己模块化了一些调用集合,是否可以利用这种机制?
最新技术文章: