From 08ce2032ab23ed3c4f8f9a30034de4ef5c0fd128 Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Wed, 5 Feb 2020 19:17:02 -0300 Subject: [PATCH] more tests and asserts --- tests/test_monitor.py | 8 ++++++++ tests/test_xrandr.py | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/tests/test_monitor.py b/tests/test_monitor.py index 2b26431..4c73728 100644 --- a/tests/test_monitor.py +++ b/tests/test_monitor.py @@ -22,6 +22,7 @@ def test_parse_modes(test_data): assert len(m.modes) == 9 assert m.enabled assert m.primary + assert m.orientation == "normal" def test_disabled_monitor(test_data): @@ -29,3 +30,10 @@ def test_disabled_monitor(test_data): m = Monitor(data) assert m.enabled is False assert m.primary is False + + +def test_parse_orientation(test_data): + data = test_data.read("monitor_1.txt", deserialize=False).splitlines() + data[0] = data[0].replace("normal (", "left (") + m = Monitor(data) + assert m.orientation == "left" diff --git a/tests/test_xrandr.py b/tests/test_xrandr.py index eb2ca1b..03c541d 100644 --- a/tests/test_xrandr.py +++ b/tests/test_xrandr.py @@ -19,3 +19,13 @@ def test_replicated_monitors(test_data): screen = parse_data(data) assert screen.monitors["eDP"].replica_of == ["HDMI-A-0"] assert screen.choose_a_monitor() == "eDP" + + +def test_get_set_primary(test_data): + data = test_data.read("sample_1.txt", deserialize=False).splitlines() + screen = parse_data(data) + assert screen.get_primary().output == "eDP" + screen.set_primary("HDMI-A-0") + assert screen.get_primary().output == "HDMI-A-0" + screen.set_primary("FOOBAR") + assert screen.get_primary() is None