Skip to content

Commit

Permalink
Adds a unit test to make sure the right amount of colors are supplied…
Browse files Browse the repository at this point in the history
… to GAGS configurations (tgstation#59388)
  • Loading branch information
ninjanomnom authored May 31, 2021
1 parent a26c748 commit 58743c1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion code/modules/clothing/shoes/miscellaneous.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/item/clothing/shoes/sneakers/mime
name = "mime shoes"
greyscale_colors = "#ffffff"
greyscale_colors = "#ffffff#ffffff"

/obj/item/clothing/shoes/combat //basic syndicate combat boots for nuke ops and mob corpses
name = "combat boots"
Expand Down
15 changes: 15 additions & 0 deletions code/modules/unit_tests/greyscale_config.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,18 @@
var/belt_icon_state = initial(item_path.belt_icon_state) || initial(item_path.icon_state)
if(belt && !belt.icon_states[belt_icon_state])
Fail("[belt.DebugName()] is missing a sprite for the belt overlay for [item_path]. Expected icon state: '[belt_icon_state]'")

/// Makes sure objects using greyscale configs have, if any, the correct number of colors
/datum/unit_test/greyscale_color_count

/datum/unit_test/greyscale_color_count/Run()
for(var/atom/thing as anything in subtypesof(/atom))
var/datum/greyscale_config/config = SSgreyscale.configurations["[initial(thing.greyscale_config)]"]
if(!config)
continue
var/list/colors = splittext(initial(thing.greyscale_colors), "#")
if(!length(colors))
continue
var/number_of_colors = length(colors) - 1
if(config.expected_colors != number_of_colors)
Fail("[thing] has the wrong amount of colors configured for [config.DebugName()]. Expected [config.expected_colors] but only found [number_of_colors].")

0 comments on commit 58743c1

Please sign in to comment.