復現android 平台上的問題,有时需要壓力測試。可以使用命令 adb shell input來進行模擬,比如:
//以下命令可以在遊戲《* of King》中切換地圖。
adb shell input tap 120 1705
//以下可以用來滑動解屏
adb shell input swipe 615 1600 615 500
具體可以參考如下說明:
Usage: input [<source>] <command> [<arg>...]
The sources are:
mouse
keyboard
joystick
touchnavigation
touchpad
trackball
stylus
dpad
touchscreen
gamepad
The commands and default sources are:
text <string> (Default: touchscreen) //輸入字串
keyevent [--longpress] <key code number or name> ... (Default: keyboard) //按鍵
tap <x> <y> (Default: touchscreen) //點擊
swipe <x1> <y1> <x2> <y2> [duration(ms)] (Default: touchscreen) //滑動
press (Default: trackball)
roll <dx> <dy> (Default: trackball)
[End_By_ChampWang]