mirror of
https://github.com/ralsina/xrandroll.git
synced 2024-11-24 12:02:23 +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]
|
||||
|
||||
modes_data = _split_by_lines_matching("^ [^ ]", data)
|
||||
fields_data = _split_by_lines_matching(r"^\t[^ ]", modes_data.pop(0))
|
||||
|
||||
if modes_data:
|
||||
fields_data = _split_by_lines_matching(r"^\t[^ ]", modes_data.pop(0))
|
||||
else:
|
||||
fields_data = []
|
||||
|
||||
self.modes = {}
|
||||
for m in (Mode(d) for d in modes_data):
|
||||
|
Loading…
Reference in New Issue
Block a user