Skip to content

Commit

Permalink
DevTest: Add test for supertip formspec element
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuzzy2 committed Jun 4, 2024
1 parent 46bc0d5 commit 4fa1b47
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion games/devtest/mods/testformspec/formspec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,43 @@ mouse control = true]
background9[0,0;0,0;testformspec_bg_9slice.png;true;4,6]
background[1,1;0,0;testformspec_bg.png;true]
]],

-- Tooltip
[[
formspec_version[7]
size[12,13]
label[1,0.5;Hover a red box for a tooltip.]
box[1,1;1,1;#ff000080]
tooltip[1,1;1,1;Normal tooltip]
box[1,3;1,1;#ff000080]
box[2.4,3.4;0.2,0.2;#ffffff80]
supertip[1,3;1,1;2.5,3.5;5;supertip_static;<big>Simple supertip (<i>static</i>)</big>
This one should always appear at the tiny white square.]
box[1,5;1,1;#ff000080]
supertip[1,5;1,1;5;supertip_dynamic;<big>Simple supertip (<i>dynamic</i>)</big>
This should appear at the cursor.]
box[1,7;1,1;#ff000080]
supertip[1,7;1,1;5;supertip_dynamic_complex;]]..minetest.formspec_escape([[<big>Complex supertip (<i>dynamic</i>)</big>
<img name=testformspec_node.png float=right width=64 height=64>
<left>Left align</left>
<center>Right align</center>
<right>Right align</right>
<b>Bold</b> <i>Italic</i> <u>Underline</u> <mono>Mono</mono>
Item:
<item name=testformspec:node>]])..[[]
box[1,9;1,1;#ff000080]
supertip[1,9;1,1;5;supertip_stone;]]..minetest.formspec_escape([[<global color=#333 background=#aaa margin=20>
<item name=testformspec:node float=left width=64 height=64>
<big><b><center>Formspec Test Node</center></b></big>
The <b>Formspec Test Node</b> is a dummy node to display an item in the <mono>testformspec</mono> mod.
• <b>Max. stack size:</b> 99
• <b>Drops:</b> <i>itself</i> <item name=testformspec:node width=32 height=32>]])..
"]"
}

local page_id = 2
Expand All @@ -477,7 +514,7 @@ local function show_test_formspec(pname)
page = page()
end

local fs = page .. "tabheader[0,0;11,0.65;maintabs;Real Coord,Styles,Noclip,Hypertext,Tabs,Invs,Window,Anim,Model,ScrollC,Sound,Background,Unsized;" .. page_id .. ";false;false]"
local fs = page .. "tabheader[0,0;11,0.65;maintabs;Real Coord,Styles,Noclip,Hypertext,Tabs,Invs,Window,Anim,Model,ScrollC,Sound,Background,Unsized,Tooltip;" .. page_id .. ";false;false]"

minetest.show_formspec(pname, "testformspec:formspec", fs)
end
Expand Down

0 comments on commit 4fa1b47

Please sign in to comment.