diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2022-05-17 22:12:00 +0200 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2022-05-17 22:12:00 +0200 |
commit | 21df26984da91143c15587f5a03c98d68c3adc4e (patch) | |
tree | aaa707a628ad331f67890023dffe1b4f60dd01d3 /games/devtest/mods/unittests/itemdescription.lua | |
parent | b09fc5de5cdb021f43ad32b7e3f50dc75c0bc622 (diff) | |
parent | eabf05758e3ba5f6f4bb1b8d1d1f02179b84e410 (diff) | |
download | dragonfireclient-21df26984da91143c15587f5a03c98d68c3adc4e.tar.xz |
Merge branch 'master' of https://github.com/minetest/minetest
Diffstat (limited to 'games/devtest/mods/unittests/itemdescription.lua')
-rw-r--r-- | games/devtest/mods/unittests/itemdescription.lua | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/games/devtest/mods/unittests/itemdescription.lua b/games/devtest/mods/unittests/itemdescription.lua index d6ee6551a..b4c218c98 100644 --- a/games/devtest/mods/unittests/itemdescription.lua +++ b/games/devtest/mods/unittests/itemdescription.lua @@ -1,17 +1,7 @@ -local full_description = "Colorful Pickaxe\nThe best pick." -minetest.register_tool("unittests:colorful_pick", { +local full_description = "Description Test Item\nFor testing item decription" +minetest.register_tool("unittests:description_test", { description = full_description, - inventory_image = "basetools_mesepick.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=3, - groupcaps={ - cracky={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3}, - crumbly={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3}, - snappy={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3} - }, - damage_groups = {fleshy=4}, - }, + inventory_image = "unittests_description_test.png", }) minetest.register_chatcommand("item_description", { @@ -25,23 +15,23 @@ minetest.register_chatcommand("item_description", { end }) -function unittests.test_short_desc() +local function test_short_desc() local function get_short_description(item) return ItemStack(item):get_short_description() end - local stack = ItemStack("unittests:colorful_pick") - assert(stack:get_short_description() == "Colorful Pickaxe") - assert(get_short_description("unittests:colorful_pick") == "Colorful Pickaxe") - assert(minetest.registered_items["unittests:colorful_pick"].short_description == nil) + local stack = ItemStack("unittests:description_test") + assert(stack:get_short_description() == "Description Test Item") + assert(get_short_description("unittests:description_test") == "Description Test Item") + assert(minetest.registered_items["unittests:description_test"].short_description == nil) assert(stack:get_description() == full_description) - assert(stack:get_description() == minetest.registered_items["unittests:colorful_pick"].description) + assert(stack:get_description() == minetest.registered_items["unittests:description_test"].description) stack:get_meta():set_string("description", "Hello World") assert(stack:get_short_description() == "Hello World") assert(stack:get_description() == "Hello World") assert(get_short_description(stack) == "Hello World") - assert(get_short_description("unittests:colorful_pick") == "Colorful Pickaxe") + assert(get_short_description("unittests:description_test") == "Description Test Item") stack:get_meta():set_string("short_description", "Foo Bar") assert(stack:get_short_description() == "Foo Bar") @@ -49,3 +39,4 @@ function unittests.test_short_desc() return true end +unittests.register("test_short_desc", test_short_desc) |