modules/android-integration: termux-reload-settings

This commit is contained in:
Alexander Sosedkin 2024-07-06 18:26:18 +02:00
parent 438cf8c620
commit e0216d3e47
6 changed files with 53 additions and 3 deletions

View file

@ -1,3 +1,4 @@
import base64
import time
import bootstrap_channels
@ -7,7 +8,7 @@ from common import screenshot, wait_for
def run(d):
OPENERS = ['termux-open', 'termux-open-url', 'xdg-open']
TOOLS = ['am', 'termux-setup-storage',
TOOLS = ['am', 'termux-setup-storage', 'termux-reload-settings',
'termux-wake-lock', 'termux-wake-unlock'] + OPENERS
nod = bootstrap_channels.run(d)
@ -162,3 +163,31 @@ def run(d):
screenshot(d, 'back')
wait_for(d, 'termux-wake-unlock')
screenshot(d, 'really-back')
# Test termux-reload-settings
assert 'text="PGUP"' in d.ui.dump_hierarchy()
assert 'text="F12"' not in d.ui.dump_hierarchy()
d('input text "mkdir ~/.termux"')
d.ui.press('enter')
cmd = 'echo "extra-keys=[[\'F12\']]" > ~/.termux/termux.properties'
cmd_base64 = base64.b64encode(cmd.encode()).decode()
d(f'input text "echo {cmd_base64} | base64 -d | bash -s"')
d.ui.press('enter')
screenshot(d, 'pre-reload')
d('input text "termux-reload-settings"')
d.ui.press('enter')
time.sleep(1)
screenshot(d, 'post-reload')
assert 'text="PGUP"' not in d.ui.dump_hierarchy()
assert 'text="F12"' in d.ui.dump_hierarchy()
d('input text "rm -r ~/.termux"')
d.ui.press('enter')
screenshot(d, 'pre-reload-back')
d('input text "termux-reload-settings"')
d.ui.press('enter')
time.sleep(1)
screenshot(d, 'post-reload-back')
assert 'text="PGUP"' in d.ui.dump_hierarchy()
assert 'text="F12"' not in d.ui.dump_hierarchy()

View file

@ -8,6 +8,7 @@ load lib
run ! command -v termux-setup-storage
run ! command -v termux-open
run ! command -v termux-open-url
run ! command -v termux-reload-settings
run ! command -v termux-wake-lock
run ! command -v termux-wake-unlock
run ! command -v xdg-open
@ -22,6 +23,7 @@ load lib
command -v termux-setup-storage
command -v termux-open
command -v termux-open-url
command -v termux-reload-settings
command -v termux-wake-lock
command -v termux-wake-unlock
command -v xdg-open
@ -36,6 +38,7 @@ load lib
command -v termux-setup-storage
command -v termux-open
command -v termux-open-url
command -v termux-reload-settings
command -v termux-wake-lock
command -v termux-wake-unlock
command -v xdg-open

View file

@ -6,6 +6,7 @@ _:
am.enable = true;
termux-open.enable = true;
termux-open-url.enable = true;
termux-reload-settings.enable = true;
termux-setup-storage.enable = true;
termux-wake-lock.enable = true;
termux-wake-unlock.enable = true;