您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
32 行
1.3 KiB
32 行
1.3 KiB
using System.Collections.Generic;
|
|
using System.IO;
|
|
|
|
namespace UnityEngine.TestTools.Graphics
|
|
{
|
|
internal class RuntimeGraphicsTestCaseProvider : IGraphicsTestCaseProvider
|
|
{
|
|
public IEnumerable<GraphicsTestCase> GetTestCases()
|
|
{
|
|
AssetBundle referenceImagesBundle = null;
|
|
|
|
var referenceImagesBundlePath = string.Format("{0}/referenceimages-{1}-{2}-{3}", Application.streamingAssetsPath, UseGraphicsTestCasesAttribute.ColorSpace, UseGraphicsTestCasesAttribute.Platform, UseGraphicsTestCasesAttribute.GraphicsDevice);
|
|
if (File.Exists(referenceImagesBundlePath))
|
|
referenceImagesBundle = AssetBundle.LoadFromFile(referenceImagesBundlePath);
|
|
|
|
foreach (var scenePath in File.ReadAllLines(Application.streamingAssetsPath + "/SceneList.txt"))
|
|
{
|
|
var imagePath = Path.GetFileNameWithoutExtension(scenePath);
|
|
|
|
Texture2D referenceImage = null;
|
|
|
|
// The bundle might not exist if there are no reference images for this configuration yet
|
|
if (referenceImagesBundle != null)
|
|
referenceImage = referenceImagesBundle.LoadAsset<Texture2D>(imagePath);
|
|
|
|
yield return new GraphicsTestCase(scenePath, referenceImage);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|