Skip to content

Commit

Permalink
better unit tests to help me
Browse files Browse the repository at this point in the history
  • Loading branch information
FalloutFalcon committed Sep 19, 2024
1 parent c5f0cce commit 0b8b15f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions code/modules/unit_tests/_unit_tests.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#ifdef BASIC_TESTS

//#include "icons/inhands.dm"
#include "icons/inhands.dm"
#include "icons/missing_icons.dm"
#include "icons/spritesheets.dm"
#include "icons/worn_icons.dm"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/unit_tests/icons/inhands.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//Add EVEN MORE paths if needed here!
//generate_possible_icon_states_list("your/folder/path/inhands/")

for(var/obj/item/item_path as anything in subtypesof(/obj/item))
for(var/obj/item/item_path as anything in subtypesof(/obj/item/melee))
if(initial(item_path.item_flags) & ABSTRACT)
continue

Expand Down
13 changes: 13 additions & 0 deletions code/modules/unit_tests/icons/missing_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,18 @@
//generate_possible_icon_states_list("your/folder/path/")
var/list/bad_list = list()
for(var/obj/obj_path as anything in subtypesof(/obj))
var/search_for_w = FALSE
var/search_for_on = FALSE
if(ispath(obj_path, /obj/item))
var/obj/item/item_path = obj_path
if(initial(item_path.item_flags) & ABSTRACT)
continue
if(ispath(obj_path, /obj/item/melee))
var/obj/item/melee/melee_item = new(item_path)
if(melee_item.GetComponent(/datum/component/two_handed))
search_for_w = TRUE
if(melee_item.GetComponent(/datum/component/transforming))
search_for_on = TRUE

var/icon = initial(obj_path.icon)
if(isnull(icon))
Expand All @@ -49,6 +57,11 @@

bad_list[icon] += list(icon_state)

if(search_for_on && icon_exists(icon, "[icon_state]_on"))
TEST_FAIL("Missing on icon_state for [obj_path] in '[icon]'.\n\ticon_state = \"[icon_state]\"")
if(search_for_w && icon_exists(icon, "[icon_state]_on"))
TEST_FAIL("Missing wielded icon_state for [obj_path] in '[icon]'.\n\ticon_state = \"[icon_state]\"")

var/match_message
if(icon_state in possible_icon_states)
for(var/file_place in possible_icon_states[icon_state])
Expand Down
Binary file modified icons/obj/surgery.dmi
Binary file not shown.
Binary file modified icons/obj/weapon/axe.dmi
Binary file not shown.

0 comments on commit 0b8b15f

Please sign in to comment.