mirror of
https://github.com/ralsina/xrandroll.git
synced 2024-11-21 18:42:22 +00:00
initial test
This commit is contained in:
parent
002c12a2c0
commit
e65fd89d65
10
tests/test_monitor.py
Normal file
10
tests/test_monitor.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
from xrandroll.monitor import Monitor
|
||||||
|
|
||||||
|
|
||||||
|
def test_parse_pos():
|
||||||
|
data = [
|
||||||
|
"eDP connected primary 1920x1080+0+1080 (0x56) normal (normal left inverted right x axis y axis) 309mm x 173mm"
|
||||||
|
]
|
||||||
|
m = Monitor(data)
|
||||||
|
assert m.pos_x == 0
|
||||||
|
assert m.pos_y == 1080
|
@ -67,7 +67,11 @@ class Monitor:
|
|||||||
self.output = parse.search("{}{:s}", self.header)[0]
|
self.output = parse.search("{}{:s}", self.header)[0]
|
||||||
|
|
||||||
modes_data = _split_by_lines_matching("^ [^ ]", data)
|
modes_data = _split_by_lines_matching("^ [^ ]", data)
|
||||||
|
|
||||||
|
if modes_data:
|
||||||
fields_data = _split_by_lines_matching(r"^\t[^ ]", modes_data.pop(0))
|
fields_data = _split_by_lines_matching(r"^\t[^ ]", modes_data.pop(0))
|
||||||
|
else:
|
||||||
|
fields_data = []
|
||||||
|
|
||||||
self.modes = {}
|
self.modes = {}
|
||||||
for m in (Mode(d) for d in modes_data):
|
for m in (Mode(d) for d in modes_data):
|
||||||
|
Loading…
Reference in New Issue
Block a user