Class CreateHudWindowRetargetTests
CreateHudWindow is a by-Id wizard: the HUD id IS the resolution key, mirroring
SerenityWizardByIdAssetField{TAsset}'s own retarget convention elsewhere. Typing a new id
re-resolves _existingAsset — never leaving it pointed at whatever "Edit existing" previously
held — so reusing the window for another run never silently updates an unrelated, previously-resolved
asset, and typing an id that collides with a real HUD resolves to Update instead of a plain "Will
create" (the duplicate-Id refusal itself is covered from the HudCreator side by
HudCreatorDuplicateIdTests). Every test targets a private temp folder, so the project's own HUDs
are never touched.
Inherited Members
Namespace: Serenity.GameUi.Tests.Editor.Builder
Assembly: Serenity.GameUi.Tests.Editor.dll
Syntax
public class CreateHudWindowRetargetTests
Constructors
CreateHudWindowRetargetTests()
Declaration
public CreateHudWindowRetargetTests()
Methods
OneTimeTearDown()
Declaration
public void OneTimeTearDown()
RunPrimaryActionForTests_AfterRetargetingToAFreeId_CreatesANewAssetAndLeavesTheOriginalUntouched()
Companion end-to-end proof: confirming after the retarget above creates a genuinely new, separate asset and leaves the original completely untouched.
Declaration
public void RunPrimaryActionForTests_AfterRetargetingToAFreeId_CreatesANewAssetAndLeavesTheOriginalUntouched()
RunPrimaryActionForTests_ReopenedViaMenuItemAfterASuccessfulCreate_NewFreeIdCreatesASecondAssetAndLeavesTheFirstUntouched()
CreateHudWindow offers no "Create Another" restart on its Done step —
DrawDoneStep builds its own SerenityWizardDoneStep.Model by hand and never sets
NextSteps, so SerenityWizardDoneStep.DrawNextStepButtons draws nothing — and
CreateHudWindow calls neither ResetForAnotherRun nor FinishWithAsset anywhere
(Apply lands on Done through a plain GoTo(WizardStep.Done)). The only way to "start
another run" after a successful create is reopening the window through its own menu item while the
instance is still alive — EditorWindow.GetWindow<CreateHudWindow> returns the SAME
instance rather than a fresh one, carrying _existingAssetTarget forward pointed at the HUD
the first run just wrote. This proves that path never overwrites the first HUD: typing a new, free
Id (the by-Id retarget DrawHudStep runs synchronously off every keystroke — see
SetHudIdForTests_FreeIdAfterAnExistingIsLoaded_ClearsExistingAsset()) clears the stale
target before a second confirm, exactly as it does starting from a bare pick.
Declaration
public void RunPrimaryActionForTests_ReopenedViaMenuItemAfterASuccessfulCreate_NewFreeIdCreatesASecondAssetAndLeavesTheFirstUntouched()
SetHudIdForTests_FreeIdAfterAnExistingIsLoaded_ClearsExistingAsset()
With "Edit existing" already resolved to one HUD, typing a brand-new, non-colliding id for what is
meant to be a fresh create must clear _existingAsset instead of silently keeping it —
otherwise confirming overwrites the unrelated, previously-resolved asset.
Declaration
public void SetHudIdForTests_FreeIdAfterAnExistingIsLoaded_ClearsExistingAsset()
SetHudIdForTests_IdCollidesWithARealHud_ResolvesToUpdate()
On a fresh window with "Edit existing" untouched, typing an id that collides with a real HUD must resolve to Update (not a plain, false "Will create").
Declaration
public void SetHudIdForTests_IdCollidesWithARealHud_ResolvesToUpdate()
SetHudIdForTests_ReturningToTheSameHudAfterAFreeIdDetour_RebindsWithoutReseeding()
Returning to the SAME HUD after a free-id detour must rebind WITHOUT reseeding — an unsaved element edit made after the detour must survive, matching Serenity.Global.Infrastructure.Editor.SerenityWizardTargetAsset.ConsumeSeedRequest(UnityEngine.Object@)'s own "only remembers the LAST seeded path" contract: the free detour never updates that record, so the target still reads as "already seeded from A" the moment the id resolves back to A.
Declaration
public void SetHudIdForTests_ReturningToTheSameHudAfterAFreeIdDetour_RebindsWithoutReseeding()
SetHudIdForTests_UnsavedElementEditSurvivesTypingThroughIntermediateFreeIds()
The path-keyed semantics Serenity.Global.Infrastructure.Editor.SerenityWizardByIdAssetBinding<> establishes elsewhere: an unsaved element edit made while editing an existing HUD survives typing the Id through several intermediate, non-colliding values (a free Id unbinds — it never wipes the scratch to template defaults). Mirrors SetHudIdForTests_FreeIdAfterAnExistingIsLoaded_ClearsExistingAsset() but proves the ELEMENT list, not just the Id, survives the detour.
Declaration
public void SetHudIdForTests_UnsavedElementEditSurvivesTypingThroughIntermediateFreeIds()
SetUp()
Declaration
public void SetUp()
TearDown()
Declaration
public void TearDown()