From 06afb03807b1b3d376cb182b9b9ae01ee834010d Mon Sep 17 00:00:00 2001 From: Naya Verdier Date: Sun, 26 Jul 2020 13:29:14 -0700 Subject: [PATCH] [xrandr] add tests for dis/connecting without autotoggle --- tests/modules/core/test_xrandr.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/modules/core/test_xrandr.py b/tests/modules/core/test_xrandr.py index c2d5dca..fb1acb4 100644 --- a/tests/modules/core/test_xrandr.py +++ b/tests/modules/core/test_xrandr.py @@ -103,14 +103,29 @@ def test_exclude_off(mocker): assert_trigger(xrandr_cli, module, 0, RIGHT_MOUSE, "xrandr --output HDMI-1-1 --auto --right-of eDP-1-1") -def test_autotoggle_excluded_active_disconnected(mocker): - xrandr_cli = mock_xrandr(mocker, HDMI_CONNECTED_ACTIVE) - module = Module(Config(["-p", "xrandr.autotoggle=true", "xrandr.exclude=HDMI"]), theme=None) +def test_no_autotoggle_inactive_connected(mocker): + xrandr_cli = mock_xrandr(mocker, HDMI_DISCONNECTED_INACTIVE) + module = Module(Config([]), theme=None) module.update() xrandr_cli.assert_called_once_with("xrandr -q") assert_widgets(module, ("eDP-1-1", "on", 0)) + xrandr_cli.return_value = HDMI_CONNECTED_INACTIVE + xrandr_cli.reset_mock() + + module.update() + xrandr_cli.assert_called_once_with("xrandr -q") + + +def test_no_autotoggle_active_disconnected(mocker): + xrandr_cli = mock_xrandr(mocker, HDMI_CONNECTED_ACTIVE) + module = Module(Config([]), theme=None) + module.update() + xrandr_cli.assert_called_once_with("xrandr -q") + + assert_widgets(module, ("eDP-1-1", "on", 0), ("HDMI-1-1", "on", 1920)) + xrandr_cli.return_value = HDMI_DISCONNECTED_ACTIVE xrandr_cli.reset_mock()