1 -- {{{ mock notion context
3 geom
= function() return { x
=0, y
=0, w
=1680, h
=1050 } end,
4 name
= function() return "WScreen<1>" end,
5 id
= function() return 0 end
8 geom
= function() return { x
=1680, y
=0, w
=1920, h
=1080 } end,
9 name
= function() return "WScreen" end,
10 id
= function() return 1 end
14 load_module
= function() return 1 end,
15 get_hook
= function() return { add
= function() end; } end,
16 region_i
= function(callback
, type)
17 local next = callback(firstscreen
)
18 if next then callback(secondscreen
) end
25 local all_outputs
= { VGA1
= { x
=0, y
=0, w
=1680, h
=1050, name
='VGA1' }, LVDS1
= { x
=1680, y
=0, w
=1920, h
=1080, name
='LVDS1' } }
28 -- query_screens = function() end
29 get_all_outputs
= function()
36 -- load xrandr module lua code
37 dofile('mod_xrandr.lua')
38 dofile('cfg_xrandr.lua')
40 local falls_within_secondscreen
= falls_within(secondscreen
.geom())
41 assert(falls_within_secondscreen(secondscreen
:geom()))
42 assert(falls_within_secondscreen(firstscreen
:geom())==false)
44 local outputs_within_secondscreen
= mod_xrandr
.get_outputs_within(all_outputs
, secondscreen
)
45 assert(singleton(outputs_within_secondscreen
))
46 assert(firstValue(outputs_within_secondscreen
).y
== 0)
47 assert(firstValue(outputs_within_secondscreen
).x
== 1680)
49 local candidates
= candidate_screens_for_output(1, all_outputs
, 'VGA1')
50 assert(singleton(candidates
))
51 assert(firstKey(candidates
) == "WScreen<1>")
53 candidates
= candidate_screens_for_outputs(1, all_outputs
, {'VGA1'})
54 assert(singleton(candidates
))
55 assert(firstKey(candidates
) == "WScreen<1>")
57 candidates
= candidate_screens_for_output(1, all_outputs
, 'LVDS1')
58 assert(singleton(candidates
))
59 assert(firstKey(candidates
) == "WScreen")