Modular Code Compatible Posters (#17703)

* poster modularity

* access control, documentation

* properly exclude lewd

* unittest too

* fix

* poster test fix
This commit is contained in:
Will
2025-05-15 13:20:20 -07:00
committed by GitHub
parent 6ba4e11f01
commit 05e75a2614
5 changed files with 111 additions and 73 deletions
+24
View File
@@ -0,0 +1,24 @@
/datum/unit_test/posters_shall_have_legal_states
name = "POSTERS: All poster decls shall have valid icon and icon overrides"
/datum/unit_test/posters_shall_have_legal_states/start_test()
var/failed = 0
var/list/all_posters = decls_repository.get_decls_of_type(/decl/poster)
all_posters -= decls_repository.get_decl(/decl/poster/lewd) // Dumb exclusion for now. This really needs to become a valid poster instead of an illegaly made base type
for(var/path in all_posters)
var/decl/poster/D = all_posters[path]
var/obj/structure/sign/poster/P = /obj/structure/sign/poster // The base poster shows ALL subtypes except /lewd, so all posters should function here regardless!
var/icon/I = initial(P.icon)
if(D.icon_override)
I = D.icon_override
if(!(D.icon_state in cached_icon_states(I)))
failed += 1
log_unit_test("[D.type]: Poster - missing icon_state \"[D.icon_state]\" in \"[I]\", as [D.icon_override ? "override" : "base"] dmi.")
if(failed)
fail("[failed] posters had missing icon_states or bad icon overrides.")
else
pass("All [all_posters.len] posters have their icon_states and overrides set correctly.")
return TRUE