logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class GameCameraSettingsCreatorTests

    EditMode tests for GameCameraSettingsCreator. Every test targets a fixture asset path under a private temp folder via Input.SettingsAssetPath — the real project's own UnityGameCameraSettings asset(s), if any, are never touched, so these tests stay hermetic regardless of what the project already has configured.

    Inheritance
    object
    GameCameraSettingsCreatorTests
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.GameCamera.Tests.Editor.Builder
    Assembly: Serenity.GameCamera.Tests.Editor.dll
    Syntax
    public class GameCameraSettingsCreatorTests

    Constructors

    GameCameraSettingsCreatorTests()

    Declaration
    public GameCameraSettingsCreatorTests()

    Methods

    Create_EmptyId_FailsWithoutCreatingAnyAsset()

    Declaration
    public void Create_EmptyId_FailsWithoutCreatingAnyAsset()

    Create_ExistingAssetAtExplicitPath_UpdatesItInPlaceInsteadOfCreatingANewOne()

    Declaration
    public void Create_ExistingAssetAtExplicitPath_UpdatesItInPlaceInsteadOfCreatingANewOne()

    Create_ExistingAssetFileRemovedBeforeSecondRun_RollsBackTheAppliedFieldMutation()

    Exercises the resolve-or-edit rollback path specifically: an already-existing asset gets its fields mutated in memory, then the pre-persist disk check fails (the settings file was removed from disk after the first Create() call). The mutation must be rolled back to its pre-call values, not just reported as failed.

    Asserts against settingsBeforeSecondRun — the SAME C# object instance resolved right after the first, successful Create() call — rather than re-resolving via a second UnityEditor.AssetDatabase.LoadAssetAtPath``1(System.String) call after the failing one. The rollback's own UnityEditor.AssetDatabase.Refresh could plausibly notice the deleted backing file and drop the GUID-to-asset mapping; reading the already-held reference's fields sidesteps that uncertainty entirely, since GameCameraSettingsCreator's restore mutates the very instance the wizard already resolved, not a freshly re-loaded one.

    Declaration
    public void Create_ExistingAssetFileRemovedBeforeSecondRun_RollsBackTheAppliedFieldMutation()

    Create_ExistingAssetSeededOnEverySerializedField_RestoresThemAll()

    Field-by-field regression guard for the generic capture Create(Input) now rolls back through (transaction.TrackExistingAsset), replacing the hand-rolled ExistingAssetSnapshot class this migration deleted. Writes a distinct value into EVERY serialized field of a real UnityGameCameraSettings via reflection — including the UnityEngine.LayerMask-typed ExcludeLayerMask, which the deleted snapshot instead stored as a plain int — forces the update run to fail via the same planted-and-deleted-file technique Create_ExistingAssetFileRemovedBeforeSecondRun_RollsBackTheAppliedFieldMutation() uses, and asserts every field comes back. Proves the capture covers whatever the type declares, not a hand-maintained field list a future field addition could silently outgrow.

    Declaration
    public void Create_ExistingAssetSeededOnEverySerializedField_RestoresThemAll()

    Create_NestedOutputFolderDoesNotExistYet_CreatesTheFullChainAndTheAsset()

    Declaration
    public void Create_NestedOutputFolderDoesNotExistYet_CreatesTheFullChainAndTheAsset()

    Create_RegisterAsAddressablesFalse_LeavesAddressablesUntouched()

    Declaration
    public void Create_RegisterAsAddressablesFalse_LeavesAddressablesUntouched()

    Create_RegisterAsAddressablesTrue_RegistersTheCreatedAsset()

    Declaration
    public void Create_RegisterAsAddressablesTrue_RegistersTheCreatedAsset()

    Create_StaleFolderCacheOnFreshCreation_RollsBackAndLeavesNothing()

    Declaration
    public void Create_StaleFolderCacheOnFreshCreation_RollsBackAndLeavesNothing()

    Create_UpdateRunAgainstAnExistingAsset_DoesNotCreateTheOutputFolder()

    Regression test for the stray-folder bug this change fixes: an update-in-place run used to unconditionally ensure the run's own output folder even though the resolved existing asset lives entirely elsewhere (an explicit SettingsAssetPath match), leaving an empty folder behind. The second run below resolves the SAME existing asset via Serenity.GameCamera.Tests.Editor.Builder.GameCameraSettingsCreatorTests.SettingsPath but names a different, not-yet-existing Serenity.GameCamera.Tests.Editor.Builder.GameCameraSettingsCreatorTests.ProbeOutputFolder as its NewSettingsFolderPath — exactly the "editing an asset that lives elsewhere while some unrelated output folder is also configured" shape the Create Camera Settings wizard reproduced.

    Declaration
    public void Create_UpdateRunAgainstAnExistingAsset_DoesNotCreateTheOutputFolder()

    Create_ValidInput_CreatesAssetWithConfiguredValues()

    Declaration
    public void Create_ValidInput_CreatesAssetWithConfiguredValues()

    OneTimeTearDown()

    Declaration
    public void OneTimeTearDown()

    SetUp()

    Declaration
    public void SetUp()

    TearDown()

    Declaration
    public void TearDown()

    Validate_AssetAlreadyExistsAtTheExactPath_IsValidForAnUpdateInsteadOfAnError()

    Declaration
    public void Validate_AssetAlreadyExistsAtTheExactPath_IsValidForAnUpdateInsteadOfAnError()

    Validate_EmptyId_ReturnsError()

    Declaration
    public void Validate_EmptyId_ReturnsError()

    Validate_MultipleSettingsAssetsExistInProject_WarnsAboutAmbiguityWithoutBlocking()

    Declaration
    public void Validate_MultipleSettingsAssetsExistInProject_WarnsAboutAmbiguityWithoutBlocking()
    In this article
    © 2026 Serenity. All Rights Reserved