From 6465ffceeef5c3df404972bf4eaa1b24e451a7c4 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 9 Nov 2026 20:41:29 +0100 Subject: feat: window rows get app icons and a close/move menu --- tests/test_windows.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests/test_windows.py') diff --git a/tests/test_windows.py b/tests/test_windows.py index ca9be71..8e27d26 100644 --- a/tests/test_windows.py +++ b/tests/test_windows.py @@ -4,10 +4,40 @@ from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import unittest +from unittest import mock import deckit.modules.windows as windows +class DesktopIcons(unittest.TestCase): + def test_maps_class_and_wmclass(self): + import tempfile + from pathlib import Path + base = Path(tempfile.mkdtemp()) + (base / "com.obsproject.Studio.desktop").write_text( + "[Desktop Entry]\nIcon=com.obsproject.Studio\nStartupWMClass=obs\n") + mapping = windows._desktop_icons([base]) + self.assertEqual(mapping["com.obsproject.studio"], ["com.obsproject.Studio", "obs"]) + self.assertEqual(mapping["obs"], ["com.obsproject.Studio", "obs"]) + + +class Move(unittest.TestCase): + def test_lua_focuses_then_moves(self): + calls = [] + m = windows.make({"hyprland": "lua", "run": lambda cmd: "[]"}) + with mock.patch.object(windows, "_dispatch", lambda cmd: calls.append(cmd)): + m.actions["move"]({"address": "0x1", "n": 3}) + self.assertIn("focus", calls[0][2]) + self.assertIn("window.move", calls[1][2]) + + def test_classic_uses_movetoworkspacesilent(self): + calls = [] + m = windows.make({"hyprland": "classic", "run": lambda cmd: "[]"}) + with mock.patch.object(windows, "_dispatch", lambda cmd: calls.append(cmd)): + m.actions["move"]({"address": "0x1", "n": 3}) + self.assertEqual(calls[0], ["hyprctl", "dispatch", "movetoworkspacesilent", "3,address:0x1"]) + + class Commands(unittest.TestCase): def test_lua_and_classic(self): self.assertEqual(windows.workspace_cmd(3, lua=False), -- cgit v1.2.3