com.wallstop-studios.unity-helpers 2.0.0-rc81.9 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +1 -1
- package/.gitattributes +1 -1
- package/.githooks/pre-commit +31 -5
- package/.githooks/pre-push +50 -0
- package/.github/dependabot.yml +24 -2
- package/.github/scripts/check-markdown-links.ps1 +77 -0
- package/.github/scripts/check_markdown_links.py +89 -0
- package/.github/scripts/check_markdown_url_encoding.py +74 -0
- package/.github/scripts/validate_markdown_links.py +194 -0
- package/.github/workflows/csharpier-autofix.yml +152 -0
- package/.github/workflows/format-on-demand.yml +305 -0
- package/.github/workflows/lint-doc-links.yml +8 -5
- package/.github/workflows/markdown-json.yml +6 -2
- package/.github/workflows/npm-publish.yml +1 -1
- package/.github/workflows/prettier-autofix.yml +195 -0
- package/.github/workflows/update-dotnet-tools.yml +80 -0
- package/.github/workflows/yaml-format-lint.yml +41 -0
- package/.lychee.toml +4 -4
- package/.markdownlint.jsonc +21 -0
- package/.pre-commit-config.yaml +11 -3
- package/.yamllint.yaml +31 -0
- package/AGENTS.md +5 -1
- package/Docs/CHANGELOG.md +11 -0
- package/Docs/CONTRIBUTING.md +49 -0
- package/Docs/CONTRIBUTING.md.meta +7 -0
- package/{EDITOR_TOOLS_GUIDE.md → Docs/EDITOR_TOOLS_GUIDE.md} +4 -0
- package/Docs/EFFECTS_SYSTEM.md +1316 -0
- package/{EFFECTS_SYSTEM_TUTORIAL.md → Docs/EFFECTS_SYSTEM_TUTORIAL.md} +1 -1
- package/{GETTING_STARTED.md → Docs/GETTING_STARTED.md} +50 -64
- package/{GLOSSARY.md → Docs/GLOSSARY.md} +4 -4
- package/Docs/HELPER_UTILITIES.md +885 -0
- package/Docs/HELPER_UTILITIES.md.meta +7 -0
- package/{INDEX.md → Docs/INDEX.md} +107 -62
- package/Docs/MATH_AND_EXTENSIONS.md +1039 -0
- package/{RANDOM_PERFORMANCE.md → Docs/RANDOM_PERFORMANCE.md} +15 -15
- package/{RELATIONAL_COMPONENTS.md → Docs/RELATIONAL_COMPONENTS.md} +111 -84
- package/{SERIALIZATION.md → Docs/SERIALIZATION.md} +15 -0
- package/{SPATIAL_TREES_2D_GUIDE.md → Docs/SPATIAL_TREES_2D_GUIDE.md} +2 -2
- package/{SPATIAL_TREES_3D_GUIDE.md → Docs/SPATIAL_TREES_3D_GUIDE.md} +1 -1
- package/Docs/SPATIAL_TREE_2D_PERFORMANCE.md +241 -0
- package/Docs/SPATIAL_TREE_3D_PERFORMANCE.md +243 -0
- package/{THIRD_PARTY_NOTICES.md → Docs/THIRD_PARTY_NOTICES.md} +1 -1
- package/Docs/UTILITY_COMPONENTS.md +906 -0
- package/Docs/UTILITY_COMPONENTS.md.meta +7 -0
- package/Docs/VISUAL_COMPONENTS.md +337 -0
- package/Docs/VISUAL_COMPONENTS.md.meta +7 -0
- package/Editor/AnimationEventEditor.cs +337 -160
- package/Editor/Core/Helper/AnimationEventHelpers.cs +178 -152
- package/Editor/CustomEditors/PersistentDirectoryGUI.cs +20 -11
- package/Editor/CustomEditors/TexturePlatformOverrideEntryDrawer.cs +11 -2
- package/Editor/FitTextureSizeWindow.cs +43 -19
- package/Editor/PersistentDirectorySettings.cs +64 -12
- package/Editor/PrefabChecker.cs +72 -5
- package/Editor/Sprites/AnimationCopier.cs +131 -55
- package/Editor/Sprites/AnimationCreator.cs +63 -22
- package/Editor/Sprites/AnimationViewerWindow.cs +42 -6
- package/Editor/Sprites/TexturePlatformNameHelper.cs +50 -39
- package/Editor/Sprites/TextureResizerWizard.cs +23 -1
- package/Editor/Sprites/TextureSettingsApplierWindow.cs +148 -85
- package/Editor/Tools/ImageBlurTool.cs +81 -10
- package/Editor/Utils/EditorUi.cs +1 -1
- package/Editor/Utils/ScriptableObjectSingletonCreator.cs +1 -1
- package/README.md +428 -2433
- package/Runtime/AssemblyInfo.cs +4 -0
- package/Runtime/Core/Attributes/NotNullAttribute.cs +1 -3
- package/Runtime/Core/Attributes/RelationalComponentAssigner.cs +50 -5
- package/Runtime/Core/DataStructure/CyclicBuffer.cs +0 -1
- package/Runtime/Core/DataStructure/KDTree3D.cs +1 -1
- package/Runtime/Core/DataStructure/OctTree3D.cs +1 -1
- package/Runtime/Core/Extension/AsyncOperationExtensions.cs +122 -0
- package/Runtime/Core/Extension/RandomExtensions.cs +68 -0
- package/Runtime/Core/Extension/WallstopStudiosLogger.cs +16 -0
- package/Runtime/Core/Helper/Partials/ObjectHelpers.cs +4 -1
- package/Runtime/Core/Helper/ReflectionHelpers.cs +21 -10
- package/Runtime/Core/Helper/SpriteHelpers.cs +3 -1
- package/Runtime/Core/Helper/UnityMainThreadDispatcher.cs +45 -1
- package/Runtime/Core/Serialization/JsonConverters/GameObjectConverter.cs +13 -5
- package/Runtime/Core/Serialization/JsonConverters/ResolutionConverter.cs +1 -1
- package/Runtime/Core/Serialization/JsonConverters/TypeConverter.cs +1 -1
- package/Runtime/Core/Serialization/ProtobufUnitySurrogates.cs +24 -29
- package/Runtime/Core/Serialization/Serializer.cs +101 -0
- package/Runtime/Integrations/Reflex/AssemblyInfo.cs +7 -0
- package/Runtime/Integrations/Reflex/AssemblyInfo.cs.meta +11 -0
- package/Runtime/Integrations/Reflex/ContainerRelationalExtensions.cs +198 -0
- package/Runtime/Integrations/Reflex/ContainerRelationalExtensions.cs.meta +11 -0
- package/Runtime/Integrations/Reflex/RelationalComponentsInstaller.cs +86 -0
- package/Runtime/Integrations/Reflex/RelationalComponentsInstaller.cs.meta +11 -0
- package/Runtime/Integrations/Reflex/RelationalReflexSceneBootstrapper.cs +316 -0
- package/Runtime/Integrations/Reflex/RelationalReflexSceneBootstrapper.cs.meta +11 -0
- package/Runtime/Integrations/Reflex/RelationalSceneAssignmentOptions.cs +86 -0
- package/Runtime/Integrations/Reflex/RelationalSceneAssignmentOptions.cs.meta +11 -0
- package/Runtime/Integrations/Reflex/WallstopStudios.UnityHelpers.Integration.Reflex.asmdef +20 -0
- package/Runtime/Integrations/Reflex/WallstopStudios.UnityHelpers.Integration.Reflex.asmdef.meta +7 -0
- package/Runtime/Integrations/Reflex.meta +8 -0
- package/Runtime/Integrations/VContainer/AssemblyInfo.cs +9 -0
- package/Runtime/Integrations/VContainer/AssemblyInfo.cs.meta +3 -0
- package/Runtime/Integrations/VContainer/ObjectResolverRelationalExtensions.cs +96 -0
- package/Runtime/Integrations/VContainer/RelationalComponentEntryPoint.cs +90 -10
- package/Runtime/Integrations/VContainer/RelationalComponentsBuilderExtensions.cs +13 -1
- package/Runtime/Integrations/VContainer/RelationalObjectPools.cs +114 -0
- package/Runtime/Integrations/VContainer/RelationalObjectPools.cs.meta +11 -0
- package/Runtime/Integrations/VContainer/RelationalSceneAssignmentOptions.cs +16 -4
- package/Runtime/Integrations/VContainer/RelationalSceneLoadListener.cs +241 -0
- package/Runtime/Integrations/VContainer/RelationalSceneLoadListener.cs.meta +11 -0
- package/Runtime/Integrations/Zenject/AssemblyInfo.cs +9 -0
- package/Runtime/Integrations/Zenject/AssemblyInfo.cs.meta +3 -0
- package/Runtime/Integrations/Zenject/DiContainerRelationalExtensions.cs +69 -2
- package/Runtime/Integrations/Zenject/RelationalComponentSceneInitializer.cs +89 -12
- package/Runtime/Integrations/Zenject/RelationalComponentsInstaller.cs +23 -1
- package/Runtime/Integrations/Zenject/RelationalMemoryPools.cs +44 -0
- package/Runtime/Integrations/Zenject/RelationalMemoryPools.cs.meta +11 -0
- package/Runtime/Integrations/Zenject/RelationalSceneAssignmentOptions.cs +16 -10
- package/Runtime/Integrations/Zenject/RelationalSceneLoadListener.cs +243 -0
- package/Runtime/Integrations/Zenject/RelationalSceneLoadListener.cs.meta +11 -0
- package/Runtime/Tags/AttributeMetadataCache.cs +1 -4
- package/Runtime/Utils/Buffers.cs +4 -4
- package/Runtime/Utils/ScriptableObjectSingleton.cs +1 -2
- package/Runtime/Utils/SetTextureImportData.cs +3 -1
- package/Runtime/Utils/TextureScale.cs +10 -2
- package/Runtime/Visuals/UGUI/EnhancedImage.cs +6 -0
- package/Runtime/Visuals/UIToolkit/LayeredImage.cs +4 -1
- package/Samples~/DI - Reflex/README.md +527 -0
- package/Samples~/DI - Reflex/README.md.meta +7 -0
- package/Samples~/DI - Reflex/Scripts/ReflexPaletteService.cs +36 -0
- package/Samples~/DI - Reflex/Scripts/ReflexPaletteService.cs.meta +11 -0
- package/Samples~/DI - Reflex/Scripts/ReflexRelationalConsumer.cs +79 -0
- package/Samples~/DI - Reflex/Scripts/ReflexRelationalConsumer.cs.meta +11 -0
- package/Samples~/DI - Reflex/Scripts/ReflexSampleInstaller.cs +30 -0
- package/Samples~/DI - Reflex/Scripts/ReflexSampleInstaller.cs.meta +11 -0
- package/Samples~/DI - Reflex/Scripts/ReflexSpawner.cs +79 -0
- package/Samples~/DI - Reflex/Scripts/ReflexSpawner.cs.meta +11 -0
- package/Samples~/DI - Reflex/Scripts/Samples.UnityHelpers.DI.Reflex.asmdef +26 -0
- package/Samples~/DI - Reflex/Scripts/Samples.UnityHelpers.DI.Reflex.asmdef.meta +9 -0
- package/Samples~/DI - Reflex/Scripts.meta +8 -0
- package/Samples~/DI - Reflex.meta +8 -0
- package/Samples~/DI - VContainer/README.md +238 -56
- package/Samples~/DI - VContainer/Scripts/GameLifetimeScope.cs +22 -4
- package/Samples~/DI - VContainer/Scripts/RelationalConsumer.cs +5 -2
- package/Samples~/DI - VContainer/Scripts/Spawner.cs +113 -4
- package/Samples~/DI - Zenject/README.md +223 -58
- package/Samples~/DI - Zenject/Scripts/RelationalConsumer.cs +3 -0
- package/Samples~/DI - Zenject/Scripts/RelationalConsumerPool.cs +37 -0
- package/Samples~/DI - Zenject/Scripts/RelationalConsumerPool.cs.meta +12 -0
- package/Samples~/DI - Zenject/Scripts/SpawnerZenject.cs +74 -3
- package/Samples~/Random - PRNG/README.md +2 -1
- package/Samples~/Relational Components - Basic/README.md +3 -1
- package/Samples~/Serialization - JSON/README.md +2 -1
- package/Samples~/Spatial Structures - 2D and 3D/README.md +2 -1
- package/Samples~/UGUI - EnhancedImage/README.md +2 -1
- package/Samples~/UI Toolkit - MultiFile Selector (Editor)/README.md +2 -1
- package/Tests/Editor/Attributes/AnimationEventHelpersTests.cs +16 -0
- package/Tests/Editor/Core/Attributes/RelationalComponentAssignerTests.cs +32 -34
- package/Tests/Editor/Integrations/Reflex/ReflexIntegrationCompilationTests.cs +41 -0
- package/Tests/Editor/Integrations/Reflex/ReflexIntegrationCompilationTests.cs.meta +11 -0
- package/Tests/Editor/Integrations/Reflex/WallstopStudios.UnityHelpers.Tests.Editor.Reflex.asmdef +27 -0
- package/Tests/Editor/Integrations/Reflex/WallstopStudios.UnityHelpers.Tests.Editor.Reflex.asmdef.meta +7 -0
- package/Tests/Editor/Integrations/Reflex.meta +8 -0
- package/Tests/Editor/Integrations/VContainer/VContainerRelationalEntryPointTests.cs +21 -18
- package/Tests/Editor/Integrations/VContainer/VContainerRelationalHelpersTests.cs +164 -0
- package/Tests/Editor/Integrations/VContainer/VContainerRelationalHelpersTests.cs.meta +11 -0
- package/Tests/Editor/Integrations/VContainer/WallstopStudios.UnityHelpers.Tests.Editor.VContainer.asmdef +2 -1
- package/Tests/Editor/Integrations/Zenject/WallstopStudios.UnityHelpers.Tests.Editor.Zenject.asmdef +3 -2
- package/Tests/Editor/Integrations/Zenject/ZenjectRelationalHelpersTests.cs +127 -0
- package/Tests/Editor/Integrations/Zenject/ZenjectRelationalHelpersTests.cs.meta +11 -0
- package/Tests/Editor/Integrations/Zenject/ZenjectRelationalInitializerTests.cs +25 -23
- package/Tests/Editor/PersistentDirectorySettingsTests.cs +58 -0
- package/Tests/Editor/PersistentDirectorySettingsTests.cs.meta +11 -0
- package/Tests/Editor/PrefabCheckerReportTests.cs +32 -0
- package/Tests/Editor/PrefabCheckerReportTests.cs.meta +11 -0
- package/Tests/Editor/Sprites/AnimationCopierFilterTests.cs +63 -0
- package/Tests/Editor/Sprites/AnimationCopierFilterTests.cs.meta +11 -0
- package/Tests/Editor/Sprites/AnimationCopierWindowTests.cs +1 -1
- package/Tests/Editor/Sprites/AnimationViewerWindowTests.cs +38 -0
- package/Tests/Editor/Sprites/AnimationViewerWindowTests.cs.meta +11 -0
- package/Tests/Editor/Sprites/ScriptableSpriteAtlasEditorTests.cs +1 -1
- package/Tests/Editor/Sprites/SpriteCropperAdditionalTests.cs +12 -12
- package/Tests/Editor/Sprites/SpriteCropperTests.cs +9 -9
- package/Tests/Editor/Sprites/SpritePivotAdjusterTests.cs +3 -3
- package/Tests/Editor/Sprites/TexturePlatformNameHelperTests.cs +18 -0
- package/Tests/Editor/Sprites/TextureResizerWizardTests.cs +5 -5
- package/Tests/Editor/Sprites/TextureSettingsApplierAPITests.cs +3 -3
- package/Tests/Editor/Sprites/TextureSettingsApplierWizardAdditionalTests.cs +4 -4
- package/Tests/Editor/Sprites/TextureSettingsApplierWizardTests.cs +4 -4
- package/Tests/Editor/Tools/ImageBlurToolTests.cs +22 -110
- package/Tests/Editor/Utils/CommonTestBase.cs +60 -1
- package/Tests/Editor/Utils/ScriptableObjectSingletonCreatorTests.cs +6 -6
- package/Tests/Editor/Windows/FitTextureSizeWindowTests.cs +66 -74
- package/Tests/Runtime/Attributes/RelationalComponentInitializerTests.cs +4 -15
- package/Tests/Runtime/DataStructures/SpatialTree3DBoundsConsistencyTests.cs +29 -29
- package/Tests/Runtime/Extensions/AsyncOperationExtensionsTests.cs +179 -0
- package/Tests/Runtime/Extensions/RandomExtensionTests.cs +55 -0
- package/Tests/Runtime/Integrations/Reflex/RelationalComponentsReflexTests.cs +445 -0
- package/Tests/Runtime/Integrations/Reflex/RelationalComponentsReflexTests.cs.meta +11 -0
- package/Tests/Runtime/Integrations/Reflex/WallstopStudios.UnityHelpers.Tests.Runtime.Reflex.asmdef +28 -0
- package/Tests/Runtime/Integrations/Reflex/WallstopStudios.UnityHelpers.Tests.Runtime.Reflex.asmdef.meta +7 -0
- package/Tests/Runtime/Integrations/Reflex.meta +8 -0
- package/Tests/Runtime/Integrations/VContainer/RelationalComponentsVContainerTests.cs +257 -221
- package/Tests/Runtime/Integrations/VContainer/RelationalObjectPoolsVContainerTests.cs +91 -0
- package/Tests/Runtime/Integrations/VContainer/RelationalObjectPoolsVContainerTests.cs.meta +11 -0
- package/Tests/Runtime/Integrations/Zenject/RelationalComponentsZenjectTests.cs +251 -233
- package/Tests/Runtime/Performance/RandomPerformanceTests.cs +1 -1
- package/Tests/Runtime/Performance/SpatialTree2DPerformanceTests.cs +6 -1
- package/Tests/Runtime/Performance/SpatialTree3DPerformanceTests.cs +4 -1
- package/Tests/Runtime/Serialization/JsonConverterAdditionalTests.cs +30 -0
- package/Tests/Runtime/Serialization/JsonConverterAdditionalTests.cs.meta +11 -0
- package/Tests/Runtime/Serialization/JsonConverterTests.cs +8 -12
- package/Tests/Runtime/Serialization/JsonRoundtripComprehensiveTests.cs +4 -9
- package/Tests/Runtime/Serialization/JsonSerializationTest.cs +16 -5
- package/Tests/Runtime/Serialization/ProtoRoundtripComprehensiveTests.cs +13 -13
- package/Tests/Runtime/Serialization/SerializerAdditionalTests.cs +12 -0
- package/Tests/Runtime/Serialization/SerializerFileIoTests.cs +105 -0
- package/Tests/Runtime/Serialization/SerializerFileIoTests.cs.meta +11 -0
- package/Tests/Runtime/Serialization/UnityEngineObjectJsonTests.cs +247 -0
- package/Tests/Runtime/Serialization/UnityEngineObjectJsonTests.cs.meta +11 -0
- package/Tests/Runtime/TestUtils/CommonTestBase.cs +99 -0
- package/Tests/Runtime/TestUtils/ReflexTestSupport.cs +111 -0
- package/Tests/Runtime/TestUtils/ReflexTestSupport.cs.meta +12 -0
- package/Tests/Runtime/Utils/CoroutineHandlerTests.cs +1 -1
- package/Tests/Runtime/Utils/LZMAComprehensiveTests.cs +1 -1
- package/Tests/Runtime/Utils/LZMATests.cs +1 -1
- package/Tests/Runtime/Utils/MatchColliderToSpriteTests.cs +5 -5
- package/Tests/Runtime/Visuals/EnhancedImageTests.cs +25 -56
- package/Tests/Runtime/Visuals/VisualsTestHelpers.cs +1 -8
- package/Tests/TestUtils.meta +8 -0
- package/package-lock.json.meta +7 -0
- package/package.json +13 -4
- package/scripts/check-eol.ps1 +4 -5
- package/scripts/lint-tests.ps1 +156 -0
- package/scripts/lint-tests.ps1.meta +7 -0
- package/scripts/normalize-eol.ps1 +6 -9
- package/.github/workflows/csharpier.yml +0 -135
- package/CHANGELOG.md +0 -0
- package/EFFECTS_SYSTEM.md +0 -242
- package/MATH_AND_EXTENSIONS.md +0 -316
- package/SPATIAL_TREE_2D_PERFORMANCE.md +0 -238
- package/SPATIAL_TREE_3D_PERFORMANCE.md +0 -240
- /package/{CHANGELOG.md.meta → Docs/CHANGELOG.md.meta} +0 -0
- /package/{DATA_STRUCTURES.md → Docs/DATA_STRUCTURES.md} +0 -0
- /package/{DATA_STRUCTURES.md.meta → Docs/DATA_STRUCTURES.md.meta} +0 -0
- /package/{EDITOR_TOOLS_GUIDE.md.meta → Docs/EDITOR_TOOLS_GUIDE.md.meta} +0 -0
- /package/{EFFECTS_SYSTEM.md.meta → Docs/EFFECTS_SYSTEM.md.meta} +0 -0
- /package/{EFFECTS_SYSTEM_TUTORIAL.md.meta → Docs/EFFECTS_SYSTEM_TUTORIAL.md.meta} +0 -0
- /package/{GETTING_STARTED.md.meta → Docs/GETTING_STARTED.md.meta} +0 -0
- /package/{GLOSSARY.md.meta → Docs/GLOSSARY.md.meta} +0 -0
- /package/{HULLS.md → Docs/HULLS.md} +0 -0
- /package/{HULLS.md.meta → Docs/HULLS.md.meta} +0 -0
- /package/{INDEX.md.meta → Docs/INDEX.md.meta} +0 -0
- /package/{LICENSE.md → Docs/LICENSE.md} +0 -0
- /package/{LICENSE.md.meta → Docs/LICENSE.md.meta} +0 -0
- /package/{MATH_AND_EXTENSIONS.md.meta → Docs/MATH_AND_EXTENSIONS.md.meta} +0 -0
- /package/{RANDOM_PERFORMANCE.md.meta → Docs/RANDOM_PERFORMANCE.md.meta} +0 -0
- /package/{REFLECTION_HELPERS.md → Docs/REFLECTION_HELPERS.md} +0 -0
- /package/{REFLECTION_HELPERS.md.meta → Docs/REFLECTION_HELPERS.md.meta} +0 -0
- /package/{RELATIONAL_COMPONENTS.md.meta → Docs/RELATIONAL_COMPONENTS.md.meta} +0 -0
- /package/{SERIALIZATION.md.meta → Docs/SERIALIZATION.md.meta} +0 -0
- /package/{SINGLETONS.md → Docs/SINGLETONS.md} +0 -0
- /package/{SINGLETONS.md.meta → Docs/SINGLETONS.md.meta} +0 -0
- /package/{SPATIAL_TREES_2D_GUIDE.md.meta → Docs/SPATIAL_TREES_2D_GUIDE.md.meta} +0 -0
- /package/{SPATIAL_TREES_3D_GUIDE.md.meta → Docs/SPATIAL_TREES_3D_GUIDE.md.meta} +0 -0
- /package/{SPATIAL_TREE_2D_PERFORMANCE.md.meta → Docs/SPATIAL_TREE_2D_PERFORMANCE.md.meta} +0 -0
- /package/{SPATIAL_TREE_3D_PERFORMANCE.md.meta → Docs/SPATIAL_TREE_3D_PERFORMANCE.md.meta} +0 -0
- /package/{SPATIAL_TREE_SEMANTICS.md → Docs/SPATIAL_TREE_SEMANTICS.md} +0 -0
- /package/{SPATIAL_TREE_SEMANTICS.md.meta → Docs/SPATIAL_TREE_SEMANTICS.md.meta} +0 -0
- /package/{THIRD_PARTY_NOTICES.md.meta → Docs/THIRD_PARTY_NOTICES.md.meta} +0 -0
package/Tests/Editor/Integrations/Zenject/WallstopStudios.UnityHelpers.Tests.Editor.Zenject.asmdef
CHANGED
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
"UnityEngine.TestRunner",
|
|
7
7
|
"WallstopStudios.UnityHelpers",
|
|
8
8
|
"WallstopStudios.UnityHelpers.Integration.Zenject",
|
|
9
|
-
"WallstopStudios.UnityHelpers.Tests.Editor"
|
|
9
|
+
"WallstopStudios.UnityHelpers.Tests.Editor",
|
|
10
|
+
"Zenject"
|
|
10
11
|
],
|
|
11
12
|
"includePlatforms": ["Editor"],
|
|
12
13
|
"excludePlatforms": [],
|
|
13
14
|
"allowUnsafeCode": false,
|
|
14
15
|
"overrideReferences": true,
|
|
15
|
-
"precompiledReferences": ["nunit.framework.dll"],
|
|
16
|
+
"precompiledReferences": ["nunit.framework.dll", "Zenject-usage.dll"],
|
|
16
17
|
"autoReferenced": false,
|
|
17
18
|
"defineConstraints": ["UNITY_INCLUDE_TESTS", "ZENJECT_PRESENT"],
|
|
18
19
|
"versionDefines": [
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#if ZENJECT_PRESENT
|
|
2
|
+
namespace WallstopStudios.UnityHelpers.Tests.Integrations.Zenject
|
|
3
|
+
{
|
|
4
|
+
using global::Zenject;
|
|
5
|
+
using NUnit.Framework;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
using WallstopStudios.UnityHelpers.Core.Attributes;
|
|
8
|
+
using WallstopStudios.UnityHelpers.Integrations.Zenject;
|
|
9
|
+
using WallstopStudios.UnityHelpers.Tests.Editor.Utils;
|
|
10
|
+
|
|
11
|
+
public sealed class ZenjectRelationalHelpersTests : CommonTestBase
|
|
12
|
+
{
|
|
13
|
+
private sealed class TestComponent : MonoBehaviour
|
|
14
|
+
{
|
|
15
|
+
[ParentComponent(OnlyAncestors = true)]
|
|
16
|
+
public Rigidbody parentBody;
|
|
17
|
+
|
|
18
|
+
[ChildComponent(OnlyDescendants = true)]
|
|
19
|
+
public CapsuleCollider childCollider;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[Test]
|
|
23
|
+
public void InjectWithRelationsAssignsFields()
|
|
24
|
+
{
|
|
25
|
+
DiContainer container = new();
|
|
26
|
+
|
|
27
|
+
// Build hierarchy: Parent(Rigidbody) -> Middle(TestComponent) -> Child(CapsuleCollider)
|
|
28
|
+
GameObject parent = NewGameObject("Root");
|
|
29
|
+
parent.AddComponent<Rigidbody>();
|
|
30
|
+
GameObject middle = NewGameObject("Middle");
|
|
31
|
+
middle.transform.SetParent(parent.transform);
|
|
32
|
+
TestComponent comp = middle.AddComponent<TestComponent>();
|
|
33
|
+
GameObject child = NewGameObject("Child");
|
|
34
|
+
child.transform.SetParent(middle.transform);
|
|
35
|
+
child.AddComponent<CapsuleCollider>();
|
|
36
|
+
|
|
37
|
+
TestComponent result = container.InjectWithRelations(comp);
|
|
38
|
+
|
|
39
|
+
Assert.That(result, Is.SameAs(comp));
|
|
40
|
+
Assert.IsTrue(comp.parentBody != null);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[Test]
|
|
44
|
+
public void InjectGameObjectWithRelationsAssignsHierarchy()
|
|
45
|
+
{
|
|
46
|
+
DiContainer container = new();
|
|
47
|
+
|
|
48
|
+
GameObject root = NewGameObject("Root");
|
|
49
|
+
root.AddComponent<Rigidbody>();
|
|
50
|
+
GameObject middle = NewGameObject("Middle");
|
|
51
|
+
middle.transform.SetParent(root.transform);
|
|
52
|
+
TestComponent comp = middle.AddComponent<TestComponent>();
|
|
53
|
+
GameObject child = NewGameObject("Child");
|
|
54
|
+
child.transform.SetParent(middle.transform);
|
|
55
|
+
child.AddComponent<CapsuleCollider>();
|
|
56
|
+
|
|
57
|
+
container.InjectGameObjectWithRelations(root);
|
|
58
|
+
|
|
59
|
+
Assert.IsTrue(comp.parentBody != null);
|
|
60
|
+
Assert.IsTrue(comp.childCollider != null);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[Test]
|
|
64
|
+
public void InstantiateGameObjectWithRelationsAssignsHierarchy()
|
|
65
|
+
{
|
|
66
|
+
DiContainer container = new();
|
|
67
|
+
|
|
68
|
+
GameObject prefab = NewGameObject("PrefabRoot");
|
|
69
|
+
prefab.AddComponent<Rigidbody>();
|
|
70
|
+
GameObject mid = NewGameObject("PrefabMiddle");
|
|
71
|
+
mid.transform.SetParent(prefab.transform);
|
|
72
|
+
_ = mid.AddComponent<TestComponent>();
|
|
73
|
+
GameObject child = NewGameObject("PrefabChild");
|
|
74
|
+
child.transform.SetParent(mid.transform);
|
|
75
|
+
child.AddComponent<CapsuleCollider>();
|
|
76
|
+
|
|
77
|
+
GameObject instance = container.InstantiateGameObjectWithRelations(prefab);
|
|
78
|
+
TestComponent comp = instance.GetComponentInChildren<TestComponent>(true);
|
|
79
|
+
|
|
80
|
+
Assert.IsTrue(comp != null);
|
|
81
|
+
Assert.IsTrue(comp.parentBody != null);
|
|
82
|
+
Assert.IsTrue(comp.childCollider != null);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
[Test]
|
|
86
|
+
public void RelationalMemoryPoolAssignsOnSpawn()
|
|
87
|
+
{
|
|
88
|
+
// Create a pool and inject a container into the private field using reflection
|
|
89
|
+
RelationalMemoryPool<TestComponent> pool = new();
|
|
90
|
+
DiContainer container = new();
|
|
91
|
+
|
|
92
|
+
pool._container = container;
|
|
93
|
+
|
|
94
|
+
GameObject go = NewGameObject("PooledRoot");
|
|
95
|
+
go.AddComponent<Rigidbody>();
|
|
96
|
+
GameObject middle = NewGameObject("PooledMiddle");
|
|
97
|
+
middle.transform.SetParent(go.transform);
|
|
98
|
+
TestComponent comp = middle.AddComponent<TestComponent>();
|
|
99
|
+
GameObject child = NewGameObject("PooledChild");
|
|
100
|
+
child.transform.SetParent(middle.transform);
|
|
101
|
+
child.AddComponent<CapsuleCollider>();
|
|
102
|
+
|
|
103
|
+
// Call OnSpawned indirectly via protected method using a small helper
|
|
104
|
+
PoolHarness harness = new(pool);
|
|
105
|
+
harness.InvokeOnSpawned(comp);
|
|
106
|
+
|
|
107
|
+
Assert.IsTrue(comp.parentBody != null);
|
|
108
|
+
Assert.IsTrue(comp.childCollider != null);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
private sealed class PoolHarness
|
|
112
|
+
{
|
|
113
|
+
private readonly RelationalMemoryPool<TestComponent> _pool;
|
|
114
|
+
|
|
115
|
+
public PoolHarness(RelationalMemoryPool<TestComponent> pool)
|
|
116
|
+
{
|
|
117
|
+
_pool = pool;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public void InvokeOnSpawned(TestComponent item)
|
|
121
|
+
{
|
|
122
|
+
_pool.InternalOnSpawned(item);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
#endif
|
|
@@ -33,20 +33,19 @@ namespace WallstopStudios.UnityHelpers.Tests.Integrations.Zenject
|
|
|
33
33
|
|
|
34
34
|
AttributeMetadataCache cache = CreateScriptableObject<AttributeMetadataCache>();
|
|
35
35
|
#if UNITY_EDITOR
|
|
36
|
-
AttributeMetadataCache.RelationalTypeMetadata relationalMetadata =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
);
|
|
36
|
+
AttributeMetadataCache.RelationalTypeMetadata relationalMetadata = new(
|
|
37
|
+
typeof(Consumer).AssemblyQualifiedName,
|
|
38
|
+
new[]
|
|
39
|
+
{
|
|
40
|
+
new AttributeMetadataCache.RelationalFieldMetadata(
|
|
41
|
+
"_spriteRenderer",
|
|
42
|
+
AttributeMetadataCache.RelationalAttributeKind.Sibling,
|
|
43
|
+
AttributeMetadataCache.FieldKind.Single,
|
|
44
|
+
typeof(SpriteRenderer).AssemblyQualifiedName,
|
|
45
|
+
false
|
|
46
|
+
),
|
|
47
|
+
}
|
|
48
|
+
);
|
|
50
49
|
|
|
51
50
|
cache.SetMetadata(
|
|
52
51
|
System.Array.Empty<string>(),
|
|
@@ -54,22 +53,25 @@ namespace WallstopStudios.UnityHelpers.Tests.Integrations.Zenject
|
|
|
54
53
|
new[] { relationalMetadata }
|
|
55
54
|
);
|
|
56
55
|
cache.ForceRebuildForTests();
|
|
56
|
+
yield return null;
|
|
57
57
|
#endif
|
|
58
58
|
|
|
59
|
-
RelationalComponentAssigner assigner = new
|
|
60
|
-
RelationalComponentSceneInitializer initializer =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
);
|
|
59
|
+
RelationalComponentAssigner assigner = new(cache);
|
|
60
|
+
RelationalComponentSceneInitializer initializer = new(
|
|
61
|
+
assigner,
|
|
62
|
+
cache,
|
|
63
|
+
RelationalSceneAssignmentOptions.Default
|
|
64
|
+
);
|
|
66
65
|
|
|
67
66
|
initializer.Initialize();
|
|
68
67
|
|
|
69
68
|
yield return null;
|
|
70
69
|
|
|
71
|
-
Assert.
|
|
72
|
-
Assert.
|
|
70
|
+
Assert.IsTrue(consumer != null);
|
|
71
|
+
Assert.IsTrue(
|
|
72
|
+
consumer.SR != null,
|
|
73
|
+
"Relational field should be assigned by initializer"
|
|
74
|
+
);
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
namespace WallstopStudios.UnityHelpers.Tests.Editor
|
|
2
|
+
{
|
|
3
|
+
#if UNITY_EDITOR
|
|
4
|
+
using NUnit.Framework;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
using WallstopStudios.UnityHelpers.Editor;
|
|
7
|
+
|
|
8
|
+
public sealed class PersistentDirectorySettingsTests
|
|
9
|
+
{
|
|
10
|
+
[Test]
|
|
11
|
+
public void GetPathsSortsByCountThenLastUsed()
|
|
12
|
+
{
|
|
13
|
+
PersistentDirectorySettings settings =
|
|
14
|
+
ScriptableObject.CreateInstance<PersistentDirectorySettings>();
|
|
15
|
+
|
|
16
|
+
string tool = "TestTool";
|
|
17
|
+
string ctx = "Context";
|
|
18
|
+
|
|
19
|
+
// B: 1 time, A: 3 times, C: 2 times
|
|
20
|
+
settings.RecordPath(tool, ctx, "Assets/A");
|
|
21
|
+
settings.RecordPath(tool, ctx, "Assets/A");
|
|
22
|
+
settings.RecordPath(tool, ctx, "Assets/A");
|
|
23
|
+
|
|
24
|
+
settings.RecordPath(tool, ctx, "Assets/C");
|
|
25
|
+
settings.RecordPath(tool, ctx, "Assets/C");
|
|
26
|
+
|
|
27
|
+
settings.RecordPath(tool, ctx, "Assets/B");
|
|
28
|
+
|
|
29
|
+
DirectoryUsageData[] paths = settings.GetPaths(tool, ctx);
|
|
30
|
+
Assert.IsNotNull(paths);
|
|
31
|
+
Assert.GreaterOrEqual(paths.Length, 3);
|
|
32
|
+
Assert.AreEqual("Assets/A", paths[0].path);
|
|
33
|
+
Assert.AreEqual("Assets/C", paths[1].path);
|
|
34
|
+
Assert.AreEqual("Assets/B", paths[2].path);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[Test]
|
|
38
|
+
public void GetPathsTopOnlyRespectsLimit()
|
|
39
|
+
{
|
|
40
|
+
PersistentDirectorySettings settings =
|
|
41
|
+
ScriptableObject.CreateInstance<PersistentDirectorySettings>();
|
|
42
|
+
|
|
43
|
+
string tool = "TopOnlyTool";
|
|
44
|
+
string ctx = "Context";
|
|
45
|
+
|
|
46
|
+
settings.RecordPath(tool, ctx, "Assets/One");
|
|
47
|
+
settings.RecordPath(tool, ctx, "Assets/One");
|
|
48
|
+
settings.RecordPath(tool, ctx, "Assets/Two");
|
|
49
|
+
settings.RecordPath(tool, ctx, "Assets/Three");
|
|
50
|
+
|
|
51
|
+
DirectoryUsageData[] top2 = settings.GetPaths(tool, ctx, topOnly: true, topN: 2);
|
|
52
|
+
Assert.IsNotNull(top2);
|
|
53
|
+
Assert.AreEqual(2, top2.Length);
|
|
54
|
+
Assert.AreEqual("Assets/One", top2[0].path);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
#endif
|
|
58
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
namespace WallstopStudios.UnityHelpers.Tests.Editor
|
|
2
|
+
{
|
|
3
|
+
#if UNITY_EDITOR
|
|
4
|
+
using System;
|
|
5
|
+
using System.Collections.Generic;
|
|
6
|
+
using NUnit.Framework;
|
|
7
|
+
using WallstopStudios.UnityHelpers.Editor;
|
|
8
|
+
|
|
9
|
+
public sealed class PrefabCheckerReportTests
|
|
10
|
+
{
|
|
11
|
+
[Test]
|
|
12
|
+
public void ScanReportConstructorCopiesFolders()
|
|
13
|
+
{
|
|
14
|
+
var report = new PrefabChecker.ScanReport(new[] { "A", "B" });
|
|
15
|
+
string[] folders = report.folders;
|
|
16
|
+
CollectionAssert.AreEqual(new[] { "A", "B" }, folders);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
[Test]
|
|
20
|
+
public void ScanReportAddCopiesMessages()
|
|
21
|
+
{
|
|
22
|
+
var report = new PrefabChecker.ScanReport(Array.Empty<string>());
|
|
23
|
+
report.Add("path.prefab", new List<string> { "m1", "m2" });
|
|
24
|
+
Assert.AreEqual(1, report.items.Count);
|
|
25
|
+
var first = report.items[0];
|
|
26
|
+
Assert.AreEqual("path.prefab", first.path);
|
|
27
|
+
string[] messages = first.messages;
|
|
28
|
+
CollectionAssert.AreEqual(new[] { "m1", "m2" }, messages);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
#endif
|
|
32
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
2
|
+
{
|
|
3
|
+
#if UNITY_EDITOR
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
using System.Linq;
|
|
6
|
+
using NUnit.Framework;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
using WallstopStudios.UnityHelpers.Editor.Sprites;
|
|
9
|
+
|
|
10
|
+
public sealed class AnimationCopierFilterTests
|
|
11
|
+
{
|
|
12
|
+
private static AnimationCopierWindow.AnimationFileInfo NewFileInfo(string name)
|
|
13
|
+
{
|
|
14
|
+
return new AnimationCopierWindow.AnimationFileInfo { FileName = name };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[Test]
|
|
18
|
+
public void SortsAscendingAndDescending()
|
|
19
|
+
{
|
|
20
|
+
AnimationCopierWindow wnd = ScriptableObject.CreateInstance<AnimationCopierWindow>();
|
|
21
|
+
var a = NewFileInfo("zeta.anim");
|
|
22
|
+
var b = NewFileInfo("alpha.anim");
|
|
23
|
+
var c = NewFileInfo("beta.anim");
|
|
24
|
+
var items = new List<AnimationCopierWindow.AnimationFileInfo> { a, b, c };
|
|
25
|
+
|
|
26
|
+
wnd._filterText = string.Empty;
|
|
27
|
+
wnd._filterUseRegex = false;
|
|
28
|
+
wnd._sortAscending = true;
|
|
29
|
+
var asc = wnd.ApplyFilterAndSort(items).ToList();
|
|
30
|
+
string[] ascNames = asc.Select(o => o.FileName).ToArray();
|
|
31
|
+
CollectionAssert.AreEqual(new[] { "alpha.anim", "beta.anim", "zeta.anim" }, ascNames);
|
|
32
|
+
|
|
33
|
+
wnd._sortAscending = false;
|
|
34
|
+
var desc = wnd.ApplyFilterAndSort(items).ToList();
|
|
35
|
+
string[] descNames = desc.Select(o => o.FileName).ToArray();
|
|
36
|
+
CollectionAssert.AreEqual(new[] { "zeta.anim", "beta.anim", "alpha.anim" }, descNames);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[Test]
|
|
40
|
+
public void FiltersBySubstringAndRegex()
|
|
41
|
+
{
|
|
42
|
+
AnimationCopierWindow wnd = ScriptableObject.CreateInstance<AnimationCopierWindow>();
|
|
43
|
+
var a = NewFileInfo("walk.anim");
|
|
44
|
+
var b = NewFileInfo("attack.anim");
|
|
45
|
+
var c = NewFileInfo("idle.anim");
|
|
46
|
+
var items = new List<AnimationCopierWindow.AnimationFileInfo> { a, b, c };
|
|
47
|
+
|
|
48
|
+
wnd._filterText = "ta";
|
|
49
|
+
wnd._filterUseRegex = false;
|
|
50
|
+
wnd._sortAscending = true;
|
|
51
|
+
var sub = wnd.ApplyFilterAndSort(items).ToList();
|
|
52
|
+
string[] subNames = sub.Select(o => o.FileName).ToArray();
|
|
53
|
+
CollectionAssert.AreEquivalent(new[] { "attack.anim" }, subNames);
|
|
54
|
+
|
|
55
|
+
wnd._filterText = "^i";
|
|
56
|
+
wnd._filterUseRegex = true;
|
|
57
|
+
var rx = wnd.ApplyFilterAndSort(items).ToList();
|
|
58
|
+
string[] rxNames = rx.Select(o => o.FileName).ToArray();
|
|
59
|
+
CollectionAssert.AreEquivalent(new[] { "idle.anim" }, rxNames);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
#endif
|
|
63
|
+
}
|
|
@@ -185,7 +185,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
185
185
|
private static void ModifyClip(string relPath)
|
|
186
186
|
{
|
|
187
187
|
AnimationClip clip = AssetDatabase.LoadAssetAtPath<AnimationClip>(relPath);
|
|
188
|
-
Assert.
|
|
188
|
+
Assert.IsTrue(clip != null);
|
|
189
189
|
clip.frameRate = clip.frameRate + 1f;
|
|
190
190
|
EditorUtility.SetDirty(clip);
|
|
191
191
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
2
|
+
{
|
|
3
|
+
#if UNITY_EDITOR
|
|
4
|
+
using NUnit.Framework;
|
|
5
|
+
using UnityEditor;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
using WallstopStudios.UnityHelpers.Editor.Sprites;
|
|
8
|
+
|
|
9
|
+
public sealed class AnimationViewerWindowTests
|
|
10
|
+
{
|
|
11
|
+
[Test]
|
|
12
|
+
public void EditorLayerDataBuildsSpriteListFromClip()
|
|
13
|
+
{
|
|
14
|
+
// Build a test clip with 3 sprite keyframes
|
|
15
|
+
AnimationClip clip = new();
|
|
16
|
+
Texture2D tex = new(2, 2);
|
|
17
|
+
Sprite s1 = Sprite.Create(tex, new Rect(0, 0, 1, 1), Vector2.zero);
|
|
18
|
+
Sprite s2 = Sprite.Create(tex, new Rect(0, 0, 1, 1), Vector2.zero);
|
|
19
|
+
Sprite s3 = Sprite.Create(tex, new Rect(0, 0, 1, 1), Vector2.zero);
|
|
20
|
+
|
|
21
|
+
EditorCurveBinding binding = EditorCurveBinding.PPtrCurve(
|
|
22
|
+
string.Empty,
|
|
23
|
+
typeof(SpriteRenderer),
|
|
24
|
+
"m_Sprite"
|
|
25
|
+
);
|
|
26
|
+
ObjectReferenceKeyframe[] keys = new ObjectReferenceKeyframe[3];
|
|
27
|
+
keys[0] = new ObjectReferenceKeyframe { time = 0f, value = s1 };
|
|
28
|
+
keys[1] = new ObjectReferenceKeyframe { time = 0.1f, value = s2 };
|
|
29
|
+
keys[2] = new ObjectReferenceKeyframe { time = 0.2f, value = s3 };
|
|
30
|
+
AnimationUtility.SetObjectReferenceCurve(clip, binding, keys);
|
|
31
|
+
|
|
32
|
+
var instance = new AnimationViewerWindow.EditorLayerData(clip);
|
|
33
|
+
Assert.NotNull(instance);
|
|
34
|
+
Assert.AreEqual(3, instance.Sprites.Count);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
#endif
|
|
38
|
+
}
|
|
@@ -57,7 +57,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
57
57
|
|
|
58
58
|
string atlasPath = Path.Combine(Root, "TestAtlas.spriteatlas").Replace('\\', '/');
|
|
59
59
|
SpriteAtlas atlas = AssetDatabase.LoadAssetAtPath<SpriteAtlas>(atlasPath);
|
|
60
|
-
Assert.
|
|
60
|
+
Assert.IsTrue(atlas != null, ".spriteatlas should be generated");
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
private static void EnsureFolder(string relPath)
|
|
@@ -36,7 +36,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
36
36
|
AssetDatabase.Refresh();
|
|
37
37
|
|
|
38
38
|
TextureImporter imp = AssetImporter.GetAtPath(src) as TextureImporter;
|
|
39
|
-
Assert.
|
|
39
|
+
Assert.IsTrue(imp != null);
|
|
40
40
|
imp.textureType = TextureImporterType.Sprite;
|
|
41
41
|
imp.spriteImportMode = SpriteImportMode.Single;
|
|
42
42
|
imp.isReadable = true;
|
|
@@ -61,13 +61,13 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
61
61
|
|
|
62
62
|
string dst = (Root + "/Cropped_pad_src.png").Replace('\\', '/');
|
|
63
63
|
Texture2D tex = AssetDatabase.LoadAssetAtPath<Texture2D>(dst);
|
|
64
|
-
Assert.
|
|
64
|
+
Assert.IsTrue(tex != null);
|
|
65
65
|
// Expected size: (10 + 2 + 1) x (10 + 3 + 0) = 13x13
|
|
66
66
|
Assert.That(tex.width, Is.EqualTo(13));
|
|
67
67
|
Assert.That(tex.height, Is.EqualTo(13));
|
|
68
68
|
|
|
69
69
|
TextureImporter newImp = AssetImporter.GetAtPath(dst) as TextureImporter;
|
|
70
|
-
Assert.
|
|
70
|
+
Assert.IsTrue(newImp != null);
|
|
71
71
|
Vector2 pivot = newImp.spritePivot;
|
|
72
72
|
// Expected pivot in pixels = (10-3, 10-2) = (7,8) → normalized (7/13, 8/13)
|
|
73
73
|
Assert.That(pivot.x, Is.InRange(7f / 13f - 1e-3f, 7f / 13f + 1e-3f));
|
|
@@ -83,7 +83,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
83
83
|
AssetDatabase.Refresh();
|
|
84
84
|
|
|
85
85
|
TextureImporter imp = AssetImporter.GetAtPath(src) as TextureImporter;
|
|
86
|
-
Assert.
|
|
86
|
+
Assert.IsTrue(imp != null);
|
|
87
87
|
imp.textureType = TextureImporterType.Sprite;
|
|
88
88
|
imp.spriteImportMode = SpriteImportMode.Single;
|
|
89
89
|
imp.isReadable = true;
|
|
@@ -117,7 +117,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
117
117
|
AssetDatabase.Refresh();
|
|
118
118
|
|
|
119
119
|
TextureImporter imp = AssetImporter.GetAtPath(src) as TextureImporter;
|
|
120
|
-
Assert.
|
|
120
|
+
Assert.IsTrue(imp != null);
|
|
121
121
|
imp.textureType = TextureImporterType.Sprite;
|
|
122
122
|
imp.spriteImportMode = SpriteImportMode.Single;
|
|
123
123
|
imp.isReadable = false; // start unreadable
|
|
@@ -137,12 +137,12 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
137
137
|
|
|
138
138
|
// Original should be restored to unreadable
|
|
139
139
|
imp = AssetImporter.GetAtPath(src) as TextureImporter;
|
|
140
|
-
Assert.
|
|
140
|
+
Assert.IsTrue(imp != null);
|
|
141
141
|
Assert.That(imp.isReadable, Is.False);
|
|
142
142
|
|
|
143
143
|
string dst = (Root + "/Cropped_readable_toggle.png").Replace('\\', '/');
|
|
144
144
|
TextureImporter newImp = AssetImporter.GetAtPath(dst) as TextureImporter;
|
|
145
|
-
Assert.
|
|
145
|
+
Assert.IsTrue(newImp != null);
|
|
146
146
|
Assert.That(
|
|
147
147
|
newImp.isReadable,
|
|
148
148
|
Is.False,
|
|
@@ -165,7 +165,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
165
165
|
|
|
166
166
|
string dst2 = (Root + "/Cropped_readable_toggle.png").Replace('\\', '/');
|
|
167
167
|
newImp = AssetImporter.GetAtPath(dst2) as TextureImporter;
|
|
168
|
-
Assert.
|
|
168
|
+
Assert.IsTrue(newImp != null);
|
|
169
169
|
Assert.That(newImp.isReadable, Is.True);
|
|
170
170
|
}
|
|
171
171
|
|
|
@@ -194,12 +194,12 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
194
194
|
AssetDatabase.Refresh();
|
|
195
195
|
string dst = (Root + "/Cropped_all_transparent.png").Replace('\\', '/');
|
|
196
196
|
Texture2D tex = AssetDatabase.LoadAssetAtPath<Texture2D>(dst);
|
|
197
|
-
Assert.
|
|
197
|
+
Assert.IsTrue(tex != null);
|
|
198
198
|
Assert.That(tex.width, Is.EqualTo(1));
|
|
199
199
|
Assert.That(tex.height, Is.EqualTo(1));
|
|
200
200
|
|
|
201
201
|
TextureImporter newImp = AssetImporter.GetAtPath(dst) as TextureImporter;
|
|
202
|
-
Assert.
|
|
202
|
+
Assert.IsTrue(newImp != null);
|
|
203
203
|
Vector2 pivot = newImp.spritePivot;
|
|
204
204
|
Assert.That(pivot.x, Is.InRange(0.49f, 0.51f));
|
|
205
205
|
Assert.That(pivot.y, Is.InRange(0.49f, 0.51f));
|
|
@@ -213,7 +213,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
213
213
|
AssetDatabase.Refresh();
|
|
214
214
|
|
|
215
215
|
TextureImporter imp = AssetImporter.GetAtPath(src) as TextureImporter;
|
|
216
|
-
Assert.
|
|
216
|
+
Assert.IsTrue(imp != null);
|
|
217
217
|
imp.textureType = TextureImporterType.Sprite;
|
|
218
218
|
imp.spriteImportMode = SpriteImportMode.Multiple;
|
|
219
219
|
imp.SaveAndReimport();
|
|
@@ -232,7 +232,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
232
232
|
string dst = (Root + "/Cropped_multi.png").Replace('\\', '/');
|
|
233
233
|
Assert.That(File.Exists(RelToFull(dst)), Is.False);
|
|
234
234
|
Texture2D tex = AssetDatabase.LoadAssetAtPath<Texture2D>(src);
|
|
235
|
-
Assert.
|
|
235
|
+
Assert.IsTrue(tex != null);
|
|
236
236
|
Assert.That(tex.width, Is.EqualTo(16));
|
|
237
237
|
Assert.That(tex.height, Is.EqualTo(16));
|
|
238
238
|
}
|
|
@@ -36,7 +36,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
36
36
|
|
|
37
37
|
// Ensure sprite importer single + readable
|
|
38
38
|
TextureImporter imp = AssetImporter.GetAtPath(src) as TextureImporter;
|
|
39
|
-
Assert.
|
|
39
|
+
Assert.IsTrue(imp != null);
|
|
40
40
|
imp.textureType = TextureImporterType.Sprite;
|
|
41
41
|
imp.spriteImportMode = SpriteImportMode.Single;
|
|
42
42
|
imp.spritePivot = new Vector2(0.5f, 0.5f); // center
|
|
@@ -45,9 +45,9 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
45
45
|
|
|
46
46
|
SpriteCropper window = Track(ScriptableObject.CreateInstance<SpriteCropper>());
|
|
47
47
|
window._overwriteOriginals = true;
|
|
48
|
-
window._inputDirectories = new System.Collections.Generic.List<
|
|
48
|
+
window._inputDirectories = new System.Collections.Generic.List<Object>
|
|
49
49
|
{
|
|
50
|
-
AssetDatabase.LoadAssetAtPath<
|
|
50
|
+
AssetDatabase.LoadAssetAtPath<Object>(Root),
|
|
51
51
|
};
|
|
52
52
|
window.FindFilesToProcess();
|
|
53
53
|
window.ProcessFoundSprites();
|
|
@@ -56,13 +56,13 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
56
56
|
|
|
57
57
|
// Source should be overwritten and cropped to 10x10
|
|
58
58
|
Texture2D tex = AssetDatabase.LoadAssetAtPath<Texture2D>(src);
|
|
59
|
-
Assert.
|
|
59
|
+
Assert.IsTrue(tex != null);
|
|
60
60
|
Assert.That(tex.width, Is.EqualTo(10));
|
|
61
61
|
Assert.That(tex.height, Is.EqualTo(10));
|
|
62
62
|
|
|
63
63
|
// Pivot should remain effectively center after crop
|
|
64
64
|
imp = AssetImporter.GetAtPath(src) as TextureImporter;
|
|
65
|
-
Assert.
|
|
65
|
+
Assert.IsTrue(imp != null);
|
|
66
66
|
Assert.That(imp.spriteImportMode, Is.EqualTo(SpriteImportMode.Single));
|
|
67
67
|
Vector2 pivot = imp.spritePivot;
|
|
68
68
|
Assert.That(pivot.x, Is.InRange(0.49f, 0.51f));
|
|
@@ -86,10 +86,10 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
86
86
|
|
|
87
87
|
SpriteCropper window = Track(ScriptableObject.CreateInstance<SpriteCropper>());
|
|
88
88
|
window._overwriteOriginals = false;
|
|
89
|
-
window._outputDirectory = AssetDatabase.LoadAssetAtPath<
|
|
90
|
-
window._inputDirectories = new System.Collections.Generic.List<
|
|
89
|
+
window._outputDirectory = AssetDatabase.LoadAssetAtPath<Object>(outDir);
|
|
90
|
+
window._inputDirectories = new System.Collections.Generic.List<Object>
|
|
91
91
|
{
|
|
92
|
-
AssetDatabase.LoadAssetAtPath<
|
|
92
|
+
AssetDatabase.LoadAssetAtPath<Object>(Root),
|
|
93
93
|
};
|
|
94
94
|
window.FindFilesToProcess();
|
|
95
95
|
window.ProcessFoundSprites();
|
|
@@ -100,7 +100,7 @@ namespace WallstopStudios.UnityHelpers.Tests.Editor.Sprites
|
|
|
100
100
|
Assert.That(File.Exists(RelToFull(dst)), Is.True, "Cropped output should exist");
|
|
101
101
|
|
|
102
102
|
Texture2D tex = AssetDatabase.LoadAssetAtPath<Texture2D>(dst);
|
|
103
|
-
Assert.
|
|
103
|
+
Assert.IsTrue(tex != null);
|
|
104
104
|
Assert.That(tex.width, Is.EqualTo(4));
|
|
105
105
|
Assert.That(tex.height, Is.EqualTo(4));
|
|
106
106
|
}
|