Skip to content

Commit a5d604e

Browse files
committed
Android:APIJSONTest 自动 UI 测试初步完成迁移公共的录制与回放操作逻辑到公共的 Application 类;完善和优化字段的存取与显示
1 parent 4acfd0b commit a5d604e

File tree

11 files changed

+1359
-679
lines changed

11 files changed

+1359
-679
lines changed

APIJSON-Android/APIJSONTest/app/src/main/java/apijson/demo/ui/CodeUtil.java renamed to APIJSON-Android/APIJSONTest/app/src/main/java/apijson/demo/CodeUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
See the License for the specific language governing permissions and
1313
limitations under the License.*/
1414

15-
package apijson.demo.ui;
15+
package apijson.demo;
1616

1717
import com.alibaba.fastjson.JSONArray;
1818
import com.alibaba.fastjson.JSONObject;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package apijson.demo;
2+
3+
import android.content.res.Configuration;
4+
import android.view.KeyEvent;
5+
import android.view.MotionEvent;
6+
7+
public class InputUtil {
8+
9+
public static String getActionName(int action) {
10+
return MotionEvent.actionToString(action);
11+
// switch (action) {
12+
// case MotionEvent.ACTION_DOWN:
13+
// return "DOWN";
14+
// case MotionEvent.ACTION_MOVE:
15+
// return "MOVE";
16+
// case MotionEvent.ACTION_SCROLL:
17+
// return "SCROLL";
18+
// case MotionEvent.ACTION_UP:
19+
// return "UP";
20+
// case MotionEvent.ACTION_MASK:
21+
// return "MASK";
22+
// case MotionEvent.ACTION_OUTSIDE:
23+
// return "OUTSIDE";
24+
// default:
25+
// return "CANCEL";
26+
// }
27+
}
28+
29+
public static String getOrientationName(int orientation) {
30+
return orientation == Configuration.ORIENTATION_LANDSCAPE ? "HORIZONTAL" : "VERTICAL";
31+
}
32+
33+
public static String getKeyCodeName(int keyCode) {
34+
return KeyEvent.keyCodeToString(keyCode);
35+
}
36+
37+
public static String getScanCodeName(int scanCode) {
38+
return "" + scanCode; //它是 hardware key id KeyEvent.keyCodeToString(scanCode);
39+
}
40+
}

0 commit comments

Comments
 (0)