Skip to content

Commit 2eaec6b

Browse files
alice9210The android_world Authors
authored andcommitted
Internal change
PiperOrigin-RevId: 766759783
1 parent c67c3cf commit 2eaec6b

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

android_world/env/actuation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def execute_adb_action(
8282
click_action.action_type = 'click'
8383
execute_adb_action(click_action, screen_elements, screen_size, env)
8484
time.sleep(1.0)
85+
8586
adb_utils.type_text(text, env, timeout_sec=10)
8687
adb_utils.press_enter_button(env)
8788
else:

android_world/env/actuation_test.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ def test_input_text(self):
163163
mock.patch.object(
164164
adb_utils, 'press_enter_button'
165165
) as mock_press_enter_button,
166+
mock.patch.object(adb_utils, 'issue_generic_request') as mock_issue_generic_request,
166167
):
167168
actuation.execute_adb_action(
168169
action, self.screen_elements, self.screen_size, self.mock_env
@@ -172,6 +173,34 @@ def test_input_text(self):
172173
'test input', self.mock_env, timeout_sec=10
173174
)
174175
mock_press_enter_button.assert_called_once_with(self.mock_env)
176+
mock_issue_generic_request.assert_not_called()
177+
178+
def test_input_text_with_clear_text(self):
179+
action = json_action.JSONAction(
180+
action_type='input_text', text='test input', x=50, y=50, clear_text=True
181+
)
182+
with (
183+
mock.patch.object(
184+
adb_utils, 'issue_generic_request'
185+
) as mock_issue_generic_request,
186+
):
187+
actuation.execute_adb_action(
188+
action, self.screen_elements, self.screen_size, self.mock_env
189+
)
190+
mock_issue_generic_request.assert_called_once_with(
191+
[
192+
'shell',
193+
'input',
194+
'keycombination',
195+
'113',
196+
'29',
197+
'&&',
198+
'input',
199+
'keyevent',
200+
'67',
201+
],
202+
self.mock_env,
203+
)
175204

176205
def test_scroll(self):
177206
action = json_action.JSONAction(action_type='scroll', direction='down')

0 commit comments

Comments
 (0)