greasemonkey - android monkeyrunner display height vs. snapshot image height -
i run below monkeyrunner script seems display.height not same snapshot image height.
in case, display .height 2360 snapshot image height 2560.
#!/usr/bin/env monkeyrunner import time com.android.monkeyrunner import monkeyrunner, monkeydevice #----------------------------------------# def main(): device = monkeyrunner.waitforconnection() device.wake() time.sleep(1) screenw = float(device.getproperty("display.width")) screenh = float(device.getproperty("display.height")) screend = device.getproperty("display.density") print "screen size: %dx%d density:%s"%(screenw,screenh,screend) return #----------------------------------------# def touch(device,x,y,action=monkeydevice.down_and_up): screenw = float(device.getproperty("display.width")) screenh = float(device.getproperty("display.height")) screend = device.getproperty("display.density") print int(screenw*x),int(screenh*y) device.touch(int(screenw*x),int(screenh*y),action) return #----------------------------------------# def startactivity(device,package,activity): component_name = package + "/" + activity device.startactivity(component=component_name) return #----------------------------------------# def snapshot(device,filename): result = device.takesnapshot() result.writetofile(filename,'png') return #----------------------------------------# if __name__ == '__main__': main() #----------------------------------------#
how can 2560 (just snapshot height) property? guess maybe display.height not means screen height?
Comments
Post a Comment