logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Namespace Serenity.AnimationHub.Tests.Editor

    Classes

    AnimationClipBindingCatalogTests

    EditMode tests for AnimationClipBindingCatalog. Every fixture is an in-memory GameObject hierarchy — AnimationUtility.GetAnimatableBindings only needs a live GameObject/Transform pair, not a persisted asset — destroyed in teardown, and every excludeClip is an in-memory UnityEngine.AnimationClip never written to disk, the same fixture shape ModelClipCreatorTests's BuildStandaloneSourceClip already uses. Covers Candidate discovery with a plain UnityEngine.SpriteRenderer rather than a UnityEngine.SkinnedMeshRenderer for the PPtr-candidate coverage: trivially constructible via UnityEngine.GameObject.AddComponent(System.Type), with a fixed m_Sprite field GetAnimatableBindings always reports, unlike a mesh renderer's dynamic (and, unassigned, empty) materials array.

    AnimationClipBindingLabelsTests

    Pure tests for AnimationClipBindingLabels — no fixtures, no assets, one assert per property-name mapping the engine is documented to support.

    AnimationClipCopyEngineTests

    EditMode tests for AnimationClipCopyEngine. Every fixture (clip, controller) is built under a private temp folder and torn down after each test, mirroring ModelClipCreatorTests. Every Input.RegisterAsAddressables is false so these tests never touch the project's real Addressables settings.

    Not covered: the humanoid warning branch (Validate(Input) adding a warning when the source clip's UnityEngine.AnimationClip.humanMotion is true). That flag is a read-only fact a ModelImporter's Avatar/rig configuration sets at import time — there is no API to flip it on an in-memory or hand-built clip, and this project ships no imported humanoid (.fbx) fixture anywhere under Assets to build one from. Same accepted limitation ModelClipCreatorTests already documents for its own FBX-dependent branches.

    AnimationClipCurveEditingEngineTests

    EditMode tests for AnimationClipCurveEditingEngine. Every fixture is a real UnityEngine.AnimationClip asset created under a private temp folder and torn down after each test, mirroring AnimationClipSettingsEngineTests. Most CRUD tests bind against typeof(SkinnedMeshRenderer)'s "blendShape.Cheek" property specifically because it is one of the few animatable properties Unity never auto-expands into sibling axis curves — unlike Transform position/rotation/scale, which the high-level AnimationClip.SetCurve expands into all three m_LocalPosition./m_LocalScale./localEulerAnglesRaw.* bindings (documented in ModelClipCreatorTests). The low-level SetEditorCurve binding overload this engine uses does NOT expand — the quaternion-continuity test at the bottom pins that difference.

    AnimationClipEditabilityTests

    EditMode tests for AnimationClipEditability. The decision-table tests drive the pure seam directly with no fixtures, the same way ModelAnimationValidatorTests drives ModelAnimationValidator off hand-built DTOs. One integration test at the bottom proves the UnityEngine.AnimationClip overload gathers its five facts correctly against a real asset.

    AnimationClipEditorPanelStateTests

    EditMode tests for the pure helpers on AnimationClipEditorPanelState — the only part of AnimationClipEditorPanel that is GUI-free and therefore unit testable. Every other member on the panel itself, and on AnimationClipCurveCache and AnimationClipPreviewScrubber, only makes sense inside an OnGUI pass or against live UnityEditor.AnimationMode state and is exempt from unit tests per the established Animation Hub pattern (the engines underneath already carry the contract for every mutation the panel calls into).

    AnimationClipPreviewSamplingTests

    EditMode tests for AnimationClipPreviewSampling. CountUnresolvedBindingPaths(AnimationClip, Transform) fixtures are in-memory GameObject hierarchies and in-memory UnityEngine.AnimationClip instances, never written to disk — the same fixture shape AnimationClipBindingCatalogTests already uses, since UnityEditor.AnimationUtility.GetCurveBindings(UnityEngine.AnimationClip) and UnityEngine.Transform.Find(System.String) only need a live object graph, not a persisted asset.

    AnimationClipSettingsEngineTests

    EditMode tests for AnimationClipSettingsEngine. Every fixture is a real UnityEngine.AnimationClip asset created under a private temp folder and torn down after each test, mirroring ModelClipCreatorTests — UnityEditor.AnimationUtility.GetAnimationClipSettings(UnityEngine.AnimationClip) only round-trips meaningfully against a persisted clip, not an in-memory one.

    AnimationHubClipEditorRegistryTests

    EditMode tests for AnimationHubClipEditorRegistry. Every fixture is built under a private temp folder and torn down after each test, mirroring ModelClipCreatorTests. The fallback path deliberately mutates the Editor's selection and opens Unity's Animation window — those side effects are acceptable to run in EditMode, so assertions stay on the returned AnimationHubClipEditorRegistry.Result, never on UnityEditor.Selection state; the original selection is restored in TearDown() regardless.

    AnimationHubIssueIndexTests

    EditMode tests for AnimationHubIssueIndex, extracted from AnimationHubUnityTabGui so its lookup and its parent-key propagation for the "issues only" filter are testable on their own.

    AnimationHubRowFilterTests

    EditMode tests for the pure AnimationHubRowFormatting helpers the Animation Hub window and its tab GUI format rows with, plus BuildRowKey(params string[])'s join behavior — no EditorWindow instantiation, since none of this logic touches UnityEditor.

    AnimatorControllerClipRewirerTests

    EditMode tests for AnimatorControllerClipRewirer. Every fixture (controller, clips, blend trees) is built directly against the low-level UnityEditor.Animations API under a private temp folder and torn down after each test, mirroring ModelAnimatorCreatorTests and ModelAnimationScannerTests — including the blend-parameter gotcha the latter already documents: a UnityEditor.Animations.BlendTree.blendParameter must name a parameter the controller actually declares, or the blend tree silently binds to nothing.

    ModelAnimationScannerTests

    EditMode tests for ModelAnimationScanner. Every fixture (prefab, controller, clips) is built under a private temp folder and torn down after each test, mirroring GameSaveCreatorTests.

    ModelAnimationValidatorTests

    EditMode tests for ModelAnimationValidator. Every fixture is a hand-built ModelAnimationInventory — no asset fixtures, no temp folder — since the validator reads only the DTOs ModelAnimationScanner would have produced.

    ModelAnimatorCreatorTests

    EditMode tests for ModelAnimatorCreator. Every fixture (prefab, controller, clip) is built under a private temp folder and torn down after each test, mirroring GameSaveCreatorTests and ModelAnimationScannerTests. Every Input.RegisterAsAddressables is false so these tests never touch the project's real Addressables settings.

    Not covered: Validate rejecting an imported-model source. That branch needs a real UnityEditor.PrefabAssetType.Model asset (an actually-imported .fbx or equivalent), and this project ships no such fixture anywhere under Assets to build one from without adding a binary test asset.

    ModelAnimatorParameterCreatorTests

    EditMode tests for ModelAnimatorParameterCreator. Mirrors ModelAnimatorCreatorTests's fixture shape (a private temp folder, torn down per test) — split into its own file the same way the production code split, once state/parameter/transition ops together would have pushed one test file past its own size guidance.

    ModelAnimatorTransitionCreatorTests

    EditMode tests for ModelAnimatorTransitionCreator, split out of ModelAnimatorCreatorTests the same way the production code split — see ModelAnimatorParameterCreatorTests for the parameter half.

    ModelClipCreatorTests

    EditMode tests for ModelClipCreator. Every fixture is built under a private temp folder and torn down after each test, mirroring ModelAnimatorCreatorTests. Every Input.RegisterAsAddressables is false so these tests never touch the project's real Addressables settings.

    This project ships no imported-model (.fbx) fixture anywhere under Assets, so DuplicateEmbeddedClip(Input)'s FBX-discovery step and CreatePrefabVariant(Input)'s "imported model" framing are covered indirectly: the former through its public DuplicateClip(AnimationClip, Input) overload (same copy mechanics, source clip given directly) plus a real prefab asset that legitimately has no embedded clip to exercise the "not found" validation branch; the latter through a regular prefab, which UnityEditor.PrefabUtility.SaveAsPrefabAsset(UnityEngine.GameObject,System.String,System.Boolean@) also persists as a UnityEditor.PrefabAssetType.Variant when the source instance stays connected — the exact mechanic the real imported-model path relies on.

    Not covered: a genuine mid-transaction throw for the "invalid destination folder" rollback scenario — same accepted limitation ModelAnimatorCreatorTests documents for its own rollback test. Every folder well-formedness check here runs at Validate* time, before any transaction starts, so "rollback" is instead proven as "no mutation ever began" (zero created paths, target folder never materializes).

    ProceduralAnimatorLayerActivationTests

    EditMode regression lock for ProceduralAnimatorComponent's activation-relative one-shot API: ActivateLayer(ProceduralLayerSO), DeactivateLayer(ProceduralLayerSO), and the auto-deactivation ProceduralLayerWeightScheduler drives for ON_ACTIVATE layers with a RepeatCount. Reuses the same in-memory GameObject/ScriptableObject fixture approach as ProceduralAnimatorTickTests (via Serenity.AnimationHub.Tests.Editor.ProceduralAnimatorTestFixtures's reflection helpers) so the whole pipeline runs without entering Play mode. Also exercises the no-rig Tick path (drivesRig = false, no RigDefinition assigned) and ConfigureRuntimeLayers/RegisterTransformTarget together, since a one-shot ON_ACTIVATE layer is the primary use case those exist for.

    ProceduralAnimatorSimulatorTests

    EditMode tests for ProceduralAnimatorSimulator: the Bind/Unbind lifecycle, the rig guard that keeps a preview from ever writing onto the source prefab asset's own rig, state-key seeding and writes landing on the instance's StateBusComponent, and that advancing simulated time actually ticks the pipeline. Every fixture is built by the shared Serenity.AnimationHub.Tests.Editor.ProceduralAnimatorTestFixtures.BuildOscillatingModel(System.Collections.Generic.List{UnityEngine.Object},UnityEngine.Transform@,Serenity.ProceduralAnimator.Infrastructure.Components.ProceduralAnimatorComponent@,Serenity.ProceduralAnimator.Infrastructure.Settings.UnityStateKey@,System.Boolean,System.Boolean,System.Boolean,System.Boolean) and passed straight into Bind(GameObject) as the "prefab asset" — the underlying preview session only ever calls UnityEngine.Object.Instantiate(UnityEngine.Object) on it, which works identically for a plain scene object and a real persisted prefab, so no asset needs to be written to disk, mirroring ProceduralAnimatorTickTests' and ProceduralStateKeyCollectorTests' scene/in-memory-only fixtures.

    ProceduralAnimatorTickTests

    EditMode regression lock for the editor-time seams Tick(float, float) and EnsureInitialized() add so an in-hub simulator can drive the procedural pipeline without entering Play mode. Every fixture is an in-memory GameObject hierarchy plus in-memory ScriptableObject instances (built by the shared Serenity.AnimationHub.Tests.Editor.ProceduralAnimatorTestFixtures), mirroring ProceduralInventoryScanTests' scene-only fixtures — the rig applier, rule evaluation and layer evaluation under test only need live object references, never a persisted asset.

    ProceduralInventoryScanTests

    EditMode tests for ProceduralAnimatorScanner. Every fixture (prefab, profile chain) is built under a private temp folder and torn down after each test, mirroring ModelAnimationScannerTests and ProceduralAnimatorScaffoldGeneratorTests.

    ProceduralStateKeyCollectorTests

    EditMode tests for ProceduralStateKeyCollector. Every fixture asset is an in-memory UnityEngine.ScriptableObject.CreateInstance``1 instance (via the shared Serenity.AnimationHub.Tests.Editor.ProceduralAnimatorTestFixtures), never written to disk — SerializedObject iteration only needs a live object, not a persisted asset, the same in-memory fixture shape AnimationClipPreviewSamplingTests uses for its UnityEngine.AnimationClip fixtures.

    StateKeyPulseTests

    EditMode tests for StateKeyPulse: the parabolic 0-1-0 arc shape, its start/end boundaries, and the minimum-duration clamp.

    In this article
    © 2026 Serenity. All Rights Reserved