Tests¶
Purpose¶
EditMode tests for every behaviour that is cheap to get wrong and expensive to notice: persistence, cache invalidation, path safety, preset schema, contrast, geometry, and the boundary around another product's preferences.
Owns¶
SkintTestEnvironment— captures and restores theEditorPrefskeys SKINT owns, around every fixture- Fixtures for persistence, skin change, style invalidation, preset schema, preset paths, undo durability, file IO, contrast, install path, geometry and preference keys
Does NOT Own¶
- PlayMode or runtime testing — SKINT has no runtime
- Rendering assertions; IMGUI cannot be rendered from an EditMode test
- The player build check — that lives in
Assets/Editorand runs fromtools/verify.ps1
Allowed Dependencies¶
Tests may depend on:
- NUnit,
UnityEditor,UnityEngine - Every SKINT territory
Nothing may depend on Tests. The fixture assembly is referenced by nothing.
Notes¶
SkintTestEnvironment exists because EditorPrefs is global to a Unity installation, not per project. A test that writes the active theme is writing the developer's actual theme, in every project they own. Capture and restore is therefore mandatory, not hygiene.
Its owned-key list is split by type. EditorPrefs values are typed, and backing an int key up with GetString silently replaces it with an empty string on restore — which is a test harness quietly corrupting the thing it was written to protect.
SnapPro_UITheme was on that list while migration tests needed to write it. It is a foreign key and backing a key up means writing it, so it is deliberately absent now. PrefKeyTests reads the parent product's keys and asserts none of them moved, comparing each as both a string and an int — a key read at the wrong type yields the default and would pass trivially.
Style getters cannot be called from here. They build from EditorStyles, which throws "You can only call GUI functions from inside OnGUI" outside a GUI callback. Tests that need the theme-resolution path call ThemeColorResolver.GetThemeColor directly instead, which is the same code the getters reach.
Two Unity traps the suite is run through tools/verify.ps1 to avoid: -runTests returns exit code 0 even when tests fail, so the results XML is parsed rather than the exit code; and BuildSummary.totalErrors is non-zero on a perfectly good build, so the player check keys on BuildResult.
Future Candidates¶
- IMGUI layout and the designer's column reflow are verified by hand, recorded against a manual verification checklist kept with the source. Nothing here can cover them.