@@ -11,22 +11,30 @@ namespace AibisDream.FrameAnimation.Tests.EditMode
|
||||
{
|
||||
public sealed class FrameAnimationImportTests
|
||||
{
|
||||
private const string TestRoot = "Assets/Tests/FrameAnimation/GeneratedImportTests";
|
||||
private const string TexturePath = TestRoot + "/Atlas.png";
|
||||
private const string JsonPath = TestRoot + "/Atlas.json";
|
||||
private const string GraphPath = TestRoot + "/ImportGraph.asset";
|
||||
private string TestRoot { get; set; }
|
||||
private string TexturePath => TestRoot + "/Atlas.png";
|
||||
private string JsonPath => TestRoot + "/Atlas.json";
|
||||
private string GraphPath => TestRoot + "/ImportGraph.asset";
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
AssetDatabase.DeleteAsset(TestRoot);
|
||||
TestRoot =
|
||||
$"Assets/Tests/FrameAnimation/GeneratedImportTests_{Guid.NewGuid():N}";
|
||||
EnsureFolder(TestRoot);
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
AssetDatabase.DeleteAsset(TestRoot);
|
||||
if (!string.IsNullOrEmpty(TestRoot))
|
||||
{
|
||||
Assert.That(
|
||||
AssetDatabase.DeleteAsset(TestRoot),
|
||||
Is.True,
|
||||
$"Failed to delete test asset folder: {TestRoot}");
|
||||
}
|
||||
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
@@ -329,7 +337,7 @@ namespace AibisDream.FrameAnimation.Tests.EditMode
|
||||
Assert.That(graph.Clips, Is.Empty);
|
||||
}
|
||||
|
||||
private static FrameAnimationGraph CreateWritableGraph(string json)
|
||||
private FrameAnimationGraph CreateWritableGraph(string json)
|
||||
{
|
||||
CreateTexture();
|
||||
WriteJson(json);
|
||||
@@ -347,7 +355,7 @@ namespace AibisDream.FrameAnimation.Tests.EditMode
|
||||
return graph;
|
||||
}
|
||||
|
||||
private static void CreateTexture()
|
||||
private void CreateTexture()
|
||||
{
|
||||
var texture = new Texture2D(4, 2, TextureFormat.RGBA32, false);
|
||||
var pixels = Enumerable.Range(0, 8)
|
||||
@@ -360,7 +368,7 @@ namespace AibisDream.FrameAnimation.Tests.EditMode
|
||||
AssetDatabase.ImportAsset(TexturePath, ImportAssetOptions.ForceSynchronousImport);
|
||||
}
|
||||
|
||||
private static void WriteJson(string json)
|
||||
private void WriteJson(string json)
|
||||
{
|
||||
File.WriteAllText(JsonPath, json, new UTF8Encoding(false));
|
||||
AssetDatabase.ImportAsset(JsonPath, ImportAssetOptions.ForceSynchronousImport);
|
||||
|
||||
Reference in New Issue
Block a user