Hopefully fix some wayland keyboard stuff.
This commit is contained in:
32
tests/test_default_script_shutdown_regressions.py
Normal file
32
tests/test_default_script_shutdown_regressions.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import sys
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
|
||||
|
||||
from cthulhu import cthulhu_state
|
||||
from cthulhu.scripts import default
|
||||
|
||||
|
||||
class DefaultScriptShutdownRegressionTests(unittest.TestCase):
|
||||
def test_remove_key_grabs_clears_tracking_without_touching_dead_device(self):
|
||||
script = object.__new__(default.Script)
|
||||
script.grab_ids = [474, 475]
|
||||
script._modifierGrabIds = [("Insert", 99)]
|
||||
|
||||
with (
|
||||
mock.patch.object(cthulhu_state, "device", None),
|
||||
mock.patch("cthulhu.scripts.default.cthulhu.removeKeyGrab") as removeKeyGrab,
|
||||
mock.patch("cthulhu.scripts.default.input_event_manager.get_manager") as getManager,
|
||||
):
|
||||
script.removeKeyGrabs()
|
||||
|
||||
removeKeyGrab.assert_not_called()
|
||||
getManager.assert_not_called()
|
||||
self.assertEqual(script.grab_ids, [])
|
||||
self.assertEqual(script._modifierGrabIds, [])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user