[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.

This commit is contained in:
Harald Csaszar 2021-11-22 19:12:18 +01:00
parent 506a1abf53
commit 3b061eaa5f
22 changed files with 187 additions and 40 deletions

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f5588a995395d7d428bb39ca0bfb7bd8
guid: 1a1ea245fb673db4ba7bda20b0ed06e7
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -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" }
],

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c75b8f7aac7429e4ea6031cf0903cea1
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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"
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4b249db0e1f4b8d428a050fcc092099e
PackageManifestImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,4 @@
{
"name": "spine-csharp-tests",
"references": [ "spine-csharp" ]
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 55c3c2e44e0ce38458817aeb64482f91
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 65e2134dba09ce14b99b93184153067f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1ba84adcd3d667744bdac5d92c451668
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,13 +0,0 @@
{
"name": "SpineTests",
"optionalUnityReferences": [
"TestAssemblies"
],
"references" : [
"spine-unity",
"spine-csharp"
],
"includePlatforms": [
"Editor"
]
}

View File

@ -1 +0,0 @@
Add the directory content of 'spine-csharp/tests' as 'tests' here (e.g. using a symlink).

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}

View File

@ -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
}

View File

@ -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"
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 11052e5422ef2be4eae7b875ba449c31
PackageManifestImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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`.