From 4fa1b479a66c9515361d9a5e904d64d7abff63b5 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 4 Jun 2024 22:47:41 +0200 Subject: [PATCH] DevTest: Add test for supertip formspec element --- games/devtest/mods/testformspec/formspec.lua | 39 +++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/games/devtest/mods/testformspec/formspec.lua b/games/devtest/mods/testformspec/formspec.lua index c2074e6e0..f6450e97a 100644 --- a/games/devtest/mods/testformspec/formspec.lua +++ b/games/devtest/mods/testformspec/formspec.lua @@ -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;Simple supertip (static) +This one should always appear at the tiny white square.] + box[1,5;1,1;#ff000080] + supertip[1,5;1,1;5;supertip_dynamic;Simple supertip (dynamic) +This should appear at the cursor.] + + box[1,7;1,1;#ff000080] + supertip[1,7;1,1;5;supertip_dynamic_complex;]]..minetest.formspec_escape([[Complex supertip (dynamic) + +Left align +
Right align
+Right align +Bold Italic Underline Mono +Item: +]])..[[] + + box[1,9;1,1;#ff000080] + supertip[1,9;1,1;5;supertip_stone;]]..minetest.formspec_escape([[ + +
Formspec Test Node
+The Formspec Test Node is a dummy node to display an item in the testformspec mod. + +• Max. stack size: 99 +• Drops: itself ]]).. +"]" } local page_id = 2 @@ -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