From 3b061eaa5f631a4ff1dad6179ddf89a9df0143b5 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Mon, 22 Nov 2021 19:12:18 +0100 Subject: [PATCH] [unity][csharp] Moved automated tests out of the spine-unity Assets directory to a UPM package (to prevent potential compile errors upon incomplete setup). Updated spine-csharp tests to be usable as a UPM package. --- .../tests/assets.meta | 2 +- spine-csharp/tests/assets/test.json | 2 +- spine-csharp/tests/assets/test.json.meta | 7 ++++ spine-csharp/tests/package.json | 33 ++++++++++++++++ spine-csharp/tests/package.json.meta | 7 ++++ spine-csharp/tests/spine-csharp-tests.asmdef | 4 ++ .../tests/spine-csharp-tests.asmdef.meta | 7 ++++ spine-csharp/tests/src.meta | 8 ++++ .../tests/src/AnimationStateTests.cs.meta | 11 ++++++ .../Assets/SpineTests/SpineTests.asmdef | 13 ------- .../add spine-csharp-tests here.txt | 1 - .../SpineTests/src/RunAnimationStateTests.cs | 24 ------------ .../Tests.meta} | 0 .../Tests/RunAnimationStateTests.cs | 38 +++++++++++++++++++ .../Tests}/RunAnimationStateTests.cs.meta | 0 .../spine-unity-tests.EditorTests.asmdef | 26 +++++++++++++ ...spine-unity-tests.EditorTests.asmdef.meta} | 0 .../package.json | 36 ++++++++++++++++++ .../package.json.meta | 7 ++++ .../spine-csharp-tests.meta | 0 .../add spine-csharp-tests here.txt | 1 + .../add spine-csharp-tests here.txt.meta | 0 22 files changed, 187 insertions(+), 40 deletions(-) rename spine-unity/Assets/SpineTests.meta => spine-csharp/tests/assets.meta (77%) create mode 100644 spine-csharp/tests/assets/test.json.meta create mode 100644 spine-csharp/tests/package.json create mode 100644 spine-csharp/tests/package.json.meta create mode 100644 spine-csharp/tests/spine-csharp-tests.asmdef create mode 100644 spine-csharp/tests/spine-csharp-tests.asmdef.meta create mode 100644 spine-csharp/tests/src.meta create mode 100644 spine-csharp/tests/src/AnimationStateTests.cs.meta delete mode 100644 spine-unity/Assets/SpineTests/SpineTests.asmdef delete mode 100644 spine-unity/Assets/SpineTests/spine-csharp-tests/add spine-csharp-tests here.txt delete mode 100644 spine-unity/Assets/SpineTests/src/RunAnimationStateTests.cs rename spine-unity/{Assets/SpineTests/src.meta => Modules/com.esotericsoftware.spine.spine-unity-tests/Tests.meta} (100%) create mode 100644 spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/Tests/RunAnimationStateTests.cs rename spine-unity/{Assets/SpineTests/src => Modules/com.esotericsoftware.spine.spine-unity-tests/Tests}/RunAnimationStateTests.cs.meta (100%) create mode 100644 spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/Tests/spine-unity-tests.EditorTests.asmdef rename spine-unity/{Assets/SpineTests/SpineTests.asmdef.meta => Modules/com.esotericsoftware.spine.spine-unity-tests/Tests/spine-unity-tests.EditorTests.asmdef.meta} (100%) create mode 100644 spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/package.json create mode 100644 spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/package.json.meta rename spine-unity/{Assets/SpineTests => Modules/com.esotericsoftware.spine.spine-unity-tests}/spine-csharp-tests.meta (100%) create mode 100644 spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/spine-csharp-tests/add spine-csharp-tests here.txt rename spine-unity/{Assets/SpineTests => Modules/com.esotericsoftware.spine.spine-unity-tests}/spine-csharp-tests/add spine-csharp-tests here.txt.meta (100%) diff --git a/spine-unity/Assets/SpineTests.meta b/spine-csharp/tests/assets.meta similarity index 77% rename from spine-unity/Assets/SpineTests.meta rename to spine-csharp/tests/assets.meta index a08f759cb..8ba1adff2 100644 --- a/spine-unity/Assets/SpineTests.meta +++ b/spine-csharp/tests/assets.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f5588a995395d7d428bb39ca0bfb7bd8 +guid: 1a1ea245fb673db4ba7bda20b0ed06e7 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/spine-csharp/tests/assets/test.json b/spine-csharp/tests/assets/test.json index c95671028..f2199fdb3 100644 --- a/spine-csharp/tests/assets/test.json +++ b/spine-csharp/tests/assets/test.json @@ -1,5 +1,5 @@ { -"skeleton": { "hash": "hj8P+t8L2OIWCj7RHV1Nzql4Y5E", "spine": "3.8.95", "images": "", "audio": "" }, +"skeleton": { "hash": "hj8P+t8L2OIWCj7RHV1Nzql4Y5E", "spine": "4.0.49", "images": "", "audio": "" }, "bones": [ { "name": "root" } ], diff --git a/spine-csharp/tests/assets/test.json.meta b/spine-csharp/tests/assets/test.json.meta new file mode 100644 index 000000000..777152fc3 --- /dev/null +++ b/spine-csharp/tests/assets/test.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c75b8f7aac7429e4ea6031cf0903cea1 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-csharp/tests/package.json b/spine-csharp/tests/package.json new file mode 100644 index 000000000..549486c07 --- /dev/null +++ b/spine-csharp/tests/package.json @@ -0,0 +1,33 @@ +{ + "name": "com.esotericsoftware.spine.spine-csharp-tests", + "displayName": "spine-csharp Runtime Tests", + "description": "This plugin provides tests for the spine-csharp core runtime.", + "version": "4.0.0", + "unity": "2018.3", + "author": { + "name": "Esoteric Software", + "email": "contact@esotericsoftware.com", + "url": "http://esotericsoftware.com/" + }, + "dependencies": { + "com.esotericsoftware.spine.spine-csharp": "4.0.0" + }, + "repository": { + "type": "git", + "url": "git@github.com:EsotericSoftware/spine-runtimes.git" + }, + "keywords": [ + "spine", + "spine-csharp", + "runtimes", + "tests", + "2d", + "skeletal", + "animation" + ], + "license": "SEE LICENSE IN LICENSE", + "bugs": { + "url": "https://github.com/EsotericSoftware/spine-runtimes/issues" + }, + "homepage": "https://github.com/EsotericSoftware/spine-runtimes#readme" +} diff --git a/spine-csharp/tests/package.json.meta b/spine-csharp/tests/package.json.meta new file mode 100644 index 000000000..cbf70fb88 --- /dev/null +++ b/spine-csharp/tests/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4b249db0e1f4b8d428a050fcc092099e +PackageManifestImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-csharp/tests/spine-csharp-tests.asmdef b/spine-csharp/tests/spine-csharp-tests.asmdef new file mode 100644 index 000000000..cbf0114c9 --- /dev/null +++ b/spine-csharp/tests/spine-csharp-tests.asmdef @@ -0,0 +1,4 @@ +{ + "name": "spine-csharp-tests", + "references": [ "spine-csharp" ] +} diff --git a/spine-csharp/tests/spine-csharp-tests.asmdef.meta b/spine-csharp/tests/spine-csharp-tests.asmdef.meta new file mode 100644 index 000000000..9915500d3 --- /dev/null +++ b/spine-csharp/tests/spine-csharp-tests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 55c3c2e44e0ce38458817aeb64482f91 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-csharp/tests/src.meta b/spine-csharp/tests/src.meta new file mode 100644 index 000000000..03cc98be4 --- /dev/null +++ b/spine-csharp/tests/src.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 65e2134dba09ce14b99b93184153067f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-csharp/tests/src/AnimationStateTests.cs.meta b/spine-csharp/tests/src/AnimationStateTests.cs.meta new file mode 100644 index 000000000..a067e2b4d --- /dev/null +++ b/spine-csharp/tests/src/AnimationStateTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1ba84adcd3d667744bdac5d92c451668 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/SpineTests/SpineTests.asmdef b/spine-unity/Assets/SpineTests/SpineTests.asmdef deleted file mode 100644 index ef4d60bd4..000000000 --- a/spine-unity/Assets/SpineTests/SpineTests.asmdef +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "SpineTests", - "optionalUnityReferences": [ - "TestAssemblies" - ], - "references" : [ - "spine-unity", - "spine-csharp" - ], - "includePlatforms": [ - "Editor" - ] -} \ No newline at end of file diff --git a/spine-unity/Assets/SpineTests/spine-csharp-tests/add spine-csharp-tests here.txt b/spine-unity/Assets/SpineTests/spine-csharp-tests/add spine-csharp-tests here.txt deleted file mode 100644 index 7e3e69d38..000000000 --- a/spine-unity/Assets/SpineTests/spine-csharp-tests/add spine-csharp-tests here.txt +++ /dev/null @@ -1 +0,0 @@ -Add the directory content of 'spine-csharp/tests' as 'tests' here (e.g. using a symlink). \ No newline at end of file diff --git a/spine-unity/Assets/SpineTests/src/RunAnimationStateTests.cs b/spine-unity/Assets/SpineTests/src/RunAnimationStateTests.cs deleted file mode 100644 index c6348a87b..000000000 --- a/spine-unity/Assets/SpineTests/src/RunAnimationStateTests.cs +++ /dev/null @@ -1,24 +0,0 @@ -using NUnit.Framework; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.TestTools; - -namespace Spine.Unity.Tests { - public class RunAnimationStateTests { - [Test] - public void RunAnimationStateTestsSimplePasses () { - AnimationStateTests.logImplementation += Log; - AnimationStateTests.failImplementation += Fail; - AnimationStateTests.Main("Assets/SpineTests/spine-csharp-tests/tests/assets/test.json"); - } - - public void Log (string message) { - UnityEngine.Debug.Log(message); - } - - public void Fail (string message) { - Assert.Fail(message); - } - } -} diff --git a/spine-unity/Assets/SpineTests/src.meta b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/Tests.meta similarity index 100% rename from spine-unity/Assets/SpineTests/src.meta rename to spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/Tests.meta diff --git a/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/Tests/RunAnimationStateTests.cs b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/Tests/RunAnimationStateTests.cs new file mode 100644 index 000000000..57c510991 --- /dev/null +++ b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/Tests/RunAnimationStateTests.cs @@ -0,0 +1,38 @@ +using NUnit.Framework; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.TestTools; + +namespace Spine.Unity.Tests { + public class RunAnimationStateTests { + [Test] + public void RunAnimationStateTestsSimplePasses () { + AnimationStateTests.logImplementation += Log; + AnimationStateTests.failImplementation += Fail; + //AnimationStateTests.Main("Assets/SpineTests/spine-csharp-tests/tests/assets/test.json"); + + string testJsonFilename = "test"; + string testJsonPathEnd = "tests/assets/" + testJsonFilename + ".json"; + var guids = UnityEditor.AssetDatabase.FindAssets(testJsonFilename + " t:textasset"); + if (guids.Length <= 0) Fail(testJsonFilename + ".json asset not found."); + + foreach (var guid in guids) { + string assetPath = UnityEditor.AssetDatabase.GUIDToAssetPath(guid); + if (assetPath.EndsWith(testJsonPathEnd)) { + AnimationStateTests.Main(assetPath); + return; + } + } + Fail(testJsonPathEnd + " not found."); + } + + public void Log (string message) { + UnityEngine.Debug.Log(message); + } + + public void Fail (string message) { + Assert.Fail(message); + } + } +} diff --git a/spine-unity/Assets/SpineTests/src/RunAnimationStateTests.cs.meta b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/Tests/RunAnimationStateTests.cs.meta similarity index 100% rename from spine-unity/Assets/SpineTests/src/RunAnimationStateTests.cs.meta rename to spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/Tests/RunAnimationStateTests.cs.meta diff --git a/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/Tests/spine-unity-tests.EditorTests.asmdef b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/Tests/spine-unity-tests.EditorTests.asmdef new file mode 100644 index 000000000..d9c87c005 --- /dev/null +++ b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/Tests/spine-unity-tests.EditorTests.asmdef @@ -0,0 +1,26 @@ +{ + "name": "spine-unity-tests.Editor.Tests", + "rootNamespace": "", + "references": [ + "spine-unity", + "spine-csharp", + "spine-csharp-tests", + "UnityEngine.TestRunner", + "UnityEditor.TestRunner" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/spine-unity/Assets/SpineTests/SpineTests.asmdef.meta b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/Tests/spine-unity-tests.EditorTests.asmdef.meta similarity index 100% rename from spine-unity/Assets/SpineTests/SpineTests.asmdef.meta rename to spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/Tests/spine-unity-tests.EditorTests.asmdef.meta diff --git a/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/package.json b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/package.json new file mode 100644 index 000000000..2b251e3a9 --- /dev/null +++ b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/package.json @@ -0,0 +1,36 @@ +{ + "name": "com.esotericsoftware.spine.spine-unity-tests", + "displayName": "spine-unity Runtime Tests", + "description": "This plugin provides tests for the spine-unity runtime.", + "version": "4.0.0", + "unity": "2018.3", + "author": { + "name": "Esoteric Software", + "email": "contact@esotericsoftware.com", + "url": "http://esotericsoftware.com/" + }, + "dependencies": { + "com.esotericsoftware.spine.spine-csharp-tests": "4.0.0", + "com.esotericsoftware.spine.spine-csharp": "4.0.0", + "com.esotericsoftware.spine.spine-unity": "4.0.0" + }, + "repository": { + "type": "git", + "url": "git@github.com:EsotericSoftware/spine-runtimes.git" + }, + "keywords": [ + "spine", + "spine-unity", + "runtimes", + "tests", + "2d", + "skeletal", + "animation" + ], + "license": "SEE LICENSE IN LICENSE", + "bugs": { + "url": "https://github.com/EsotericSoftware/spine-runtimes/issues" + }, + "homepage": "https://github.com/EsotericSoftware/spine-runtimes#readme", + "type": "tests" +} \ No newline at end of file diff --git a/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/package.json.meta b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/package.json.meta new file mode 100644 index 000000000..415b37e27 --- /dev/null +++ b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 11052e5422ef2be4eae7b875ba449c31 +PackageManifestImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/SpineTests/spine-csharp-tests.meta b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/spine-csharp-tests.meta similarity index 100% rename from spine-unity/Assets/SpineTests/spine-csharp-tests.meta rename to spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/spine-csharp-tests.meta diff --git a/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/spine-csharp-tests/add spine-csharp-tests here.txt b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/spine-csharp-tests/add spine-csharp-tests here.txt new file mode 100644 index 000000000..509f17ba8 --- /dev/null +++ b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/spine-csharp-tests/add spine-csharp-tests here.txt @@ -0,0 +1 @@ +Add the directory content of 'spine-csharp/tests' as 'tests' here (e.g. using a symlink), or import the package via the `package.json` file located in `spine-csharp/tests`. \ No newline at end of file diff --git a/spine-unity/Assets/SpineTests/spine-csharp-tests/add spine-csharp-tests here.txt.meta b/spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/spine-csharp-tests/add spine-csharp-tests here.txt.meta similarity index 100% rename from spine-unity/Assets/SpineTests/spine-csharp-tests/add spine-csharp-tests here.txt.meta rename to spine-unity/Modules/com.esotericsoftware.spine.spine-unity-tests/spine-csharp-tests/add spine-csharp-tests here.txt.meta