Class AchievementConditionNodeWriterTests
EditMode tests for the writes the condition tree drawer makes. They go through a real UnityEditor.SerializedObject over a real achievement asset, because that round trip is the whole point of the drawer: an edit that skipped it would work in a test and lose undo, prefab overrides and repaints in the editor.
Inherited Members
Namespace: Serenity.UnityAchievements.Tests.Editor
Assembly: Tests.Editor.dll
Syntax
public class AchievementConditionNodeWriterTests
Remarks
The confirmation and the undo grouping are exercised through the seams on
AchievementConditionEditContext rather than through
EditorUtility.DisplayDialog and Undo.PerformUndo: a modal dialog would hang the
run, and driving Unity's global undo stack from a test would undo whatever the editor was
doing beforehand. What is therefore proven here is that the writer asks before it destroys
and that both halves of a type swap land inside one group — NOT that Unity then collapses
that group correctly, which only a human pressing Ctrl+Z can confirm.
Constructors
AchievementConditionNodeWriterTests()
Declaration
public AchievementConditionNodeWriterTests()
Methods
AWriteThatDidNothing_TellsTheHostNothing()
Declaration
public void AWriteThatDidNothing_TellsTheHostNothing()
AppendChildDeferred_AddsAChildOfThePickedType()
Declaration
public void AppendChildDeferred_AddsAChildOfThePickedType()
ChildLossQuestion_NamesBothNodesAndWhatGoesAway()
Declaration
public void ChildLossQuestion_NamesBothNodesAndWhatGoesAway()
ChildrenToCarryOver_GivesALeafNothing()
Declaration
public void ChildrenToCarryOver_GivesALeafNothing()
ChildrenToCarryOver_HasNothingToCarryFromAnEmptySlot()
Declaration
public void ChildrenToCarryOver_HasNothingToCarryFromAnEmptySlot()
ChildrenToCarryOver_MovesAWrappedConditionIntoTheNewWrapper()
Declaration
public void ChildrenToCarryOver_MovesAWrappedConditionIntoTheNewWrapper()
ChildrenToCarryOver_PromotesAWrappedConditionIntoACompositesList()
Declaration
public void ChildrenToCarryOver_PromotesAWrappedConditionIntoACompositesList()
ChildrenToCarryOver_RefusesToShrinkACompositeIntoAWrapper()
A wrapper holds one child, so taking the first of several would throw the rest away without saying so. Carrying nothing makes the loss the author's decision.
Declaration
public void ChildrenToCarryOver_RefusesToShrinkACompositeIntoAWrapper()
ClearDeferred_LeavesTheAchievementUnlockedFromCodeAlone()
Declaration
public void ClearDeferred_LeavesTheAchievementUnlockedFromCodeAlone()
CreateDefinition()
Declaration
public void CreateDefinition()
DestroyDefinition()
Declaration
public void DestroyDefinition()
EveryWrite_TellsTheHostTheTreeChanged()
Every write applies its own serialized changes, so a host watching only its own
ApplyModifiedProperties sees none of them — which is how an inspector ends up
showing findings about a tree the author already changed.
Declaration
public void EveryWrite_TellsTheHostTheTreeChanged()
MoveChild_IgnoresATargetOutsideTheList()
Declaration
public void MoveChild_IgnoresATargetOutsideTheList()
MoveChild_ReordersTheSteps()
Declaration
public void MoveChild_ReordersTheSteps()
RemoveChildAt_TakesExactlyOneChildAway()
Declaration
public void RemoveChildAt_TakesExactlyOneChildAway()
ReplaceDeferred_AsksBeforeItDropsChildren()
Declaration
public void ReplaceDeferred_AsksBeforeItDropsChildren()
ReplaceDeferred_DoesNotAskWhenTheChildrenSurviveTheSwap()
Declaration
public void ReplaceDeferred_DoesNotAskWhenTheChildrenSurviveTheSwap()
ReplaceDeferred_DoesNotAskWhenThereWasNothingToLose()
Declaration
public void ReplaceDeferred_DoesNotAskWhenThereWasNothingToLose()
ReplaceDeferred_FillsAnEmptyConditionSlot()
Declaration
public void ReplaceDeferred_FillsAnEmptyConditionSlot()
ReplaceDeferred_LeavesTheTreeAloneWhenTheAuthorDeclines()
Declaration
public void ReplaceDeferred_LeavesTheTreeAloneWhenTheAuthorDeclines()
ReplaceDeferred_SwappingAndForASequenceKeepsTheOrderOfTheChildren()
Declaration
public void ReplaceDeferred_SwappingAndForASequenceKeepsTheOrderOfTheChildren()
ReplaceDeferred_SwappingAndForOrKeepsTheChildren()
The swap an author makes most: "these three all have to happen" becoming "any one of them will do". Losing the three would make the type button unusable.
Declaration
public void ReplaceDeferred_SwappingAndForOrKeepsTheChildren()
ReplaceDeferred_WritesTheWholeSwapInsideOneUndoGroup()
Replacing a node and re-parenting its children are two applies, so they are two undo entries unless something collapses them. Undoing only the second would leave the author holding the new node with none of its children — a tree nobody authored.
Declaration
public void ReplaceDeferred_WritesTheWholeSwapInsideOneUndoGroup()