forked from your-land-mirror/minetest-flow
Fix tests
This commit is contained in:
parent
150cef9399
commit
d990864834
3
init.lua
3
init.lua
@ -651,7 +651,8 @@ function field_value_transformers.dropdown(node, _, formspec_version)
|
||||
-- value of the dropdown is anyway, we can just enable index_event for new
|
||||
-- clients and keep the same behaviour
|
||||
if (formspec_version and formspec_version >= 4) or
|
||||
(minetest.global_exists("fs51") and fs51.monkey_patching_enabled) then
|
||||
(minetest.global_exists("fs51") and
|
||||
fs51.monkey_patching_enabled) then
|
||||
node.index_event = true
|
||||
|
||||
-- Detect reuse of the same Dropdown element (this is unsupported and
|
||||
|
10
test.lua
10
test.lua
@ -81,15 +81,19 @@ string.split = string.split or function(str, chr)
|
||||
end
|
||||
|
||||
function minetest.explode_textlist_event(event)
|
||||
local event_type, number = event:match("^([A-Z]+):(%d+)#")
|
||||
local event_type, number = event:match("^([A-Z]+):(%d+)$")
|
||||
return {type = event_type, index = tonumber(number) or 0}
|
||||
end
|
||||
|
||||
function minetest.explode_table_event(event)
|
||||
local event_type, row, column = event:match("^([A-Z]+):(%d+):(%d+)#")
|
||||
local event_type, row, column = event:match("^([A-Z]+):(%d+):(%d+)$")
|
||||
return {type = event_type, row = tonumber(row) or 0, column = tonumber(column) or 0}
|
||||
end
|
||||
|
||||
function minetest.global_exists(var)
|
||||
return rawget(_G, var) ~= nil
|
||||
end
|
||||
|
||||
-- Load flow
|
||||
local f = assert(io.open("init.lua"))
|
||||
local code = f:read("*a") .. "\nreturn naive_str_width"
|
||||
@ -819,7 +823,7 @@ describe("Flow", function()
|
||||
}, [[
|
||||
size[1.6,1.6]
|
||||
style[_#0;hello=world]
|
||||
button[0.3,0.3;1,1;\10;]
|
||||
button[0.3,0.3;1,1;_#0;]
|
||||
]])
|
||||
end)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user