added test helpers to write image to disk easily

This commit is contained in:
alexiscatnip
2022-01-20 23:43:11 +08:00
parent d9b9db64ca
commit 8b7b53a6f7
3 changed files with 25 additions and 11 deletions
+22
View File
@@ -0,0 +1,22 @@
using System.IO;
using UnityEngine;
namespace Raindrop.Tests
{
public class Helper
{
//easily write to a file
//filePath = fully-specified file path
public static void WriteToFile(byte[] outbytes, string filePath)
{
//create parent subfolders
var parentDir = Path.GetDirectoryName(filePath);
System.IO.Directory.CreateDirectory(parentDir);
//write file
System.IO.File.WriteAllBytes(filePath, outbytes);
Debug.Log($"write: {filePath} ");
}
}
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 651250a02e4a4314917e0f38c7b077a8
timeCreated: 1642607248
-11
View File
@@ -97,17 +97,6 @@ namespace Raindrop.Tests.ImagingTests
}
//filePath = fully-specified file path
private void WriteToFile(byte[] outbytes, string filePath)
{
//create parent subfolders
var parentDir = Path.GetDirectoryName(filePath);
System.IO.Directory.CreateDirectory(parentDir);
//write file
System.IO.File.WriteAllBytes(filePath, outbytes);
Debug.Log($"write: {filePath} ");
}
[Test]