From 585543c531a84c2dca335708ba351c73d79eed4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 13 Nov 2025 01:48:25 +0100 Subject: [PATCH] tests: adjust for default editor in Whonix 18 Whonix 18 has FeatherPad as default editor, but it doesn't have application name in the title. Look for just file name, but move that section at the end, to not intercept any other editor that require special handling (most editors put the file name in the title). This change will possibly make test failure less informative - if another editor shows up, but still has the file name in the title, it will be handled by this section too. And if it requires different handling, the test will fail with confusing message. But since many editors work with the same interaction, it should be a rare issue. --- qubes/tests/integ/dispvm.py | 68 +++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/qubes/tests/integ/dispvm.py b/qubes/tests/integ/dispvm.py index 80a2edc1b..b68dab52c 100644 --- a/qubes/tests/integ/dispvm.py +++ b/qubes/tests/integ/dispvm.py @@ -864,39 +864,7 @@ def _handle_editor(self, winid, copy=False): .replace(")", r"\)") ) time.sleep(1) - if ( - "gedit" in window_title - or "KWrite" in window_title - or "Mousepad" in window_title - or "Geany" in window_title - or "Text Editor" in window_title - ): - subprocess.check_call( - ["xdotool", "windowactivate", "--sync", winid] - ) - if copy: - subprocess.check_call( - [ - "xdotool", - "key", - "--window", - winid, - "key", - "ctrl+a", - "ctrl+c", - "ctrl+shift+c", - ] - ) - else: - subprocess.check_call(["xdotool", "type", "Test test 2"]) - subprocess.check_call( - ["xdotool", "key", "--window", winid, "key", "Return"] - ) - time.sleep(0.5) - subprocess.check_call(["xdotool", "key", "ctrl+s"]) - time.sleep(0.5) - subprocess.check_call(["xdotool", "key", "ctrl+q"]) - elif "LibreOffice" in window_title: + if "LibreOffice" in window_title: # wait for actual editor (we've got splash screen) search = subprocess.Popen( [ @@ -976,6 +944,40 @@ def _handle_editor(self, winid, copy=False): subprocess.check_call( ["xdotool", "key", "Escape", "colon", "w", "q", "Return"] ) + elif ( + "gedit" in window_title + or "KWrite" in window_title + or "Mousepad" in window_title + or "Geany" in window_title + or "Text Editor" in window_title + # FeatherPad (default in Whonix 18), no app name in the title... + or "test.txt" in window_title + ): + subprocess.check_call( + ["xdotool", "windowactivate", "--sync", winid] + ) + if copy: + subprocess.check_call( + [ + "xdotool", + "key", + "--window", + winid, + "key", + "ctrl+a", + "ctrl+c", + "ctrl+shift+c", + ] + ) + else: + subprocess.check_call(["xdotool", "type", "Test test 2"]) + subprocess.check_call( + ["xdotool", "key", "--window", winid, "key", "Return"] + ) + time.sleep(0.5) + subprocess.check_call(["xdotool", "key", "ctrl+s"]) + time.sleep(0.5) + subprocess.check_call(["xdotool", "key", "ctrl+q"]) else: raise KeyError(window_title)