Skip to content

Commit

Permalink
Add spritesheet unit test for complying with css requirements
Browse files Browse the repository at this point in the history
Rename 88m4 to _88m4 to comply with css requirements
  • Loading branch information
Drulikar committed Feb 16, 2024
1 parent c421196 commit d39031c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion code/modules/projectiles/guns/pistols.dm
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@
name = "\improper 88 Mod 4 combat pistol"
desc = "Standard issue USCM firearm. Also found in the hands of Weyland-Yutani PMC teams. Fires 9mm armor shredding rounds and is capable of 3-round burst."
icon = 'icons/obj/items/weapons/guns/guns_by_faction/uscm.dmi'
icon_state = "88m4"
icon_state = "_88m4" // to comply with css standards
item_state = "88m4"
fire_sound = "88m4"
firesound_volume = 20
Expand Down
4 changes: 4 additions & 0 deletions code/modules/unit_tests/spritesheets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
/datum/unit_test/spritesheets

/datum/unit_test/spritesheets/Run()
var/regex/valid_css_class = new(@"^([\l_][\w\-]|[\l_\-][\l_])")
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.")
if(!valid_css_class.Find(sprite_name))
// https://www.w3.org/TR/CSS2/syndata.html#value-def-identifier
TEST_FAIL("Spritesheet [sheet.type] has a icon state that doesn't comply with css standards: '[sprite_name]'.")
Binary file modified icons/obj/items/weapons/guns/guns_by_faction/uscm.dmi
Binary file not shown.
Binary file modified icons/obj/items/weapons/guns/lineart.dmi
Binary file not shown.

0 comments on commit d39031c

Please sign in to comment.