1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-02-12 07:58:07 +00:00

AndroidTarget: Fixes 'swipe_to_unlock' method.

This commit is contained in:
Marc Bonnici 2017-07-26 11:29:10 +01:00
parent 003785dde1
commit 1229af0895

View File

@ -1065,16 +1065,16 @@ class AndroidTarget(Target):
width, height = self.screen_resolution width, height = self.screen_resolution
command = 'input swipe {} {} {} {}' command = 'input swipe {} {} {} {}'
if direction == "horizontal": if direction == "horizontal":
swipe_heigh = height * 2 // 3 swipe_height = height * 2 // 3
start = 100 start = 100
stop = width - start stop = width - start
self.execute(command.format(start, swipe_heigh, stop, swipe_heigh)) self.execute(command.format(start, swipe_height, stop, swipe_height))
if direction == "vertical": elif direction == "vertical":
swipe_middle = height / 2 swipe_middle = width / 2
swipe_heigh = height * 2 // 3 swipe_height = height * 2 // 3
self.execute(command.format(swipe_middle, swipe_heigh, swipe_middle, 0)) self.execute(command.format(swipe_middle, swipe_height, swipe_middle, 0))
else: else:
raise DeviceError("Invalid swipe direction: {}".format(self.swipe_to_unlock)) raise TargetError("Invalid swipe direction: {}".format(direction))
def getprop(self, prop=None): def getprop(self, prop=None):
props = AndroidProperties(self.execute('getprop')) props = AndroidProperties(self.execute('getprop'))