Skip to content

Commit e028740

Browse files
EraChen233yimelia
authored andcommitted
用户主动选择是否使用render solution
(cherry picked from commit 36c944c)
1 parent 4ac9f74 commit e028740

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

poco/pocofw.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,3 +494,12 @@ def post_action(self, action, ui, args):
494494
cb(self, action, ui, args)
495495
except Exception as e:
496496
warnings.warn("Error occurred at post action stage.\n{}".format(traceback.format_exc()))
497+
498+
def use_render_resolution(self, use=True):
499+
'''
500+
Whether to use render resolution
501+
502+
Args:
503+
use: True or false
504+
'''
505+
self._agent.input.use_render_resolution = use

poco/utils/airtest/input.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def __init__(self):
4141
super(AirtestInput, self).__init__()
4242
self.default_touch_down_duration = 0.01
4343
self._driver = None
44+
self.use_render_resolution = False
4445

4546
def add_preaction_cb(self, driver):
4647
self._driver = driver
@@ -60,7 +61,11 @@ def _get_touch_resolution(self):
6061
or window size if running in window mode
6162
"""
6263
current_device().display_info
63-
return current_device().get_render_resolution()
64+
if self.use_render_resolution:
65+
return current_device().get_render_resolution()
66+
else:
67+
w, h = current_device().get_current_resolution()
68+
return 0, 0, w, h
6469

6570
def setTouchDownDuration(self, duration):
6671
self.default_touch_down_duration = duration

0 commit comments

Comments
 (0)