Skip to content

Commit

Permalink
Adds unit test to check for spritesheet issues (tgstation#70351)
Browse files Browse the repository at this point in the history
* Adds a new spritesheet unit test to catch edge-cases that caused problems in the past.
  • Loading branch information
AnturK authored Oct 11, 2022
1 parent 98848fd commit ed3bade
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
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 @@ -169,6 +169,7 @@
#include "spell_mindswap.dm"
#include "spell_names.dm"
#include "spell_shapeshift.dm"
#include "spritesheets.dm"
#include "stack_singular_name.dm"
#include "stomach.dm"
#include "strippable.dm"
Expand Down
2 changes: 2 additions & 0 deletions code/modules/unit_tests/achievements.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
var/init_icon = initial(award.icon)
if(!init_icon || !(init_icon in award_icons))
TEST_FAIL("Award [initial(award.name)] has an unexistent icon: \"[init_icon || "null"]\"")
if(length(initial(award.database_id)) > 32) //sql schema limit
TEST_FAIL("Award [initial(award.name)] database id is is too long")
11 changes: 11 additions & 0 deletions code/modules/unit_tests/spritesheets.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
///Checks if spritesheet assets contain icon states with invalid names
/datum/unit_test/spritesheets

/datum/unit_test/spritesheets/Run()
for(var/datum/asset/spritesheet/sheet as anything in subtypesof(/datum/asset/spritesheet))
if(!initial(sheet.name)) //Ignore abstract types
continue
sheet = get_asset_datum(sheet)
for(var/sprite_name in sheet.sprites)
if(!sprite_name)
TEST_FAIL("Spritesheet [sheet.type] has a nameless icon state.")
Binary file modified icons/ui_icons/achievements/achievements.dmi
Binary file not shown.

0 comments on commit ed3bade

Please sign in to comment.