Fix bgcolor fullscreen value

This commit is contained in:
luk3yx 2021-03-09 10:18:14 +13:00
parent 98906e1dde
commit e9302239fb
5 changed files with 26 additions and 5 deletions

View File

@ -142,6 +142,13 @@ function types.boolean(bool)
end
end
function types.fullscreen(param)
if param == 'both' or param == 'neither' then
return param
end
return types.boolean(param)
end
function types.table(obj)
local s, e = obj:find('=', nil, true)
assert(s, 'Invalid syntax: "' .. obj .. '".')

File diff suppressed because one or more lines are too long

View File

@ -65,10 +65,10 @@ background9:
- - [middle_x, number]
bgcolor:
- - [bgcolor, string]
- [fullscreen, boolean]
- [fullscreen, fullscreen]
- [fbgcolor, string]
- - [bgcolor, string]
- [fullscreen, boolean]
- [fullscreen, fullscreen]
- - [bgcolor, string]
box:
- - - [x, number]

View File

@ -18,8 +18,9 @@ _known = _make_known(
'starting_item_index', 'scroll_factor', 'frame_count',
'frame_duration', 'frame_start'),
boolean=('auto_clip', 'fixed_size', 'transparent', 'draw_border', 'bool',
'fullscreen', 'noclip', 'drawborder', 'selected', 'force',
'close_on_enter', 'continuous', 'mouse_control'),
'noclip', 'drawborder', 'selected', 'force', 'close_on_enter',
'continuous', 'mouse_control'),
fullscreen=('fullscreen',),
table=('param', 'opt', 'prop'),
null=('',),
)

View File

@ -82,6 +82,8 @@ local fs = [[
dropdown[0,0;1;test;abc,def,ghi,jkl;2]
field_close_on_enter[my-field;false]
bgcolor[blue]
bgcolor[blue;true]
bgcolor[blue;both;green]
]]
fs = ('\n' .. fs):gsub('\n[ \n]*', '')
@ -173,6 +175,17 @@ test_parse_unparse(fs, {
type = "bgcolor",
bgcolor = "blue",
},
{
type = "bgcolor",
bgcolor = "blue",
fullscreen = true,
},
{
type = "bgcolor",
bgcolor = "blue",
fullscreen = "both",
fbgcolor = "green",
},
})
local function permutations(elem_s, elem, ...)