列表中有 十几种 item,也有几种重型控件 无限滚动的水平 banner 和可以无限垂直滚动的类似淘宝头条的控件。担心会出现内存泄露或者其他问题,于是用 mokey 测试 快速滑动来发现隐藏问题。
运行
➜ monkeyrunner fling.py
查看 android monitor 内存也都释放掉了
测试代码如下
代码如下 fling.py
#!/usr/bin/env monkeyrunner
import time
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
device = MonkeyRunner.waitForConnection(5)
# fling up
def scrollUpFling():
device.touch(100, 500, MonkeyDevice.DOWN)
device.touch(100, 100, MonkeyDevice.MOVE)
device.touch(100, 100, MonkeyDevice.UP)
print "fling up"
# fling down
def scrollDownFling():
device.touch(100, 400, MonkeyDevice.DOWN)
device.touch(100, 500, MonkeyDevice.MOVE)
device.touch(100, 500, MonkeyDevice.UP)
print "fling down"
def fling():
for i in range(1,1000):
scrollUpFling()
time.sleep(0.1)
scrollDownFling()
time.sleep(0.1)
fling()