浏览代码

Start adding LW tests.

/main
Tim Cooper 6 年前
当前提交
6b1a7a0b
共有 20 个文件被更改,包括 186 次插入10 次删除
  1. 7
      TestProjects/LWGraphicsTest/Packages/manifest.json
  2. 2
      TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/LWGraphicsTestSettings.cs.meta
  3. 8
      TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts.meta
  4. 6
      TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/LWGraphicsTestSettings.cs
  5. 12
      TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/LWGraphicsTests.asmdef
  6. 7
      TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/LWGraphicsTests.asmdef.meta
  7. 37
      TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/LWGraphicsTests.cs
  8. 11
      TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/LWGraphicsTests.cs.meta
  9. 8
      TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/Setup.meta
  10. 14
      TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/Setup/LWEditorTests.asmdef
  11. 7
      TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/Setup/LWEditorTests.asmdef.meta
  12. 12
      TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/Setup/SetupGraphicsTestCases.cs
  13. 11
      TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/Setup/SetupGraphicsTestCases.cs.meta
  14. 35
      TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/Setup/SetupProject.cs
  15. 11
      TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/Setup/SetupProject.cs.meta
  16. 8
      TestProjects/LWGraphicsTest/Assets/PlayModeTests.meta
  17. 0
      /TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/LWGraphicsTestSettings.cs.meta

7
TestProjects/LWGraphicsTest/Packages/manifest.json


"com.unity.analytics": "2.0.16",
"com.unity.collab-proxy": "1.2.4-preview",
"com.unity.package-manager-ui": "2.0.0-preview.2",
"com.unity.testframework.graphics": "file:../../../com.unity.testframework.graphics",
"com.unity.postprocessing": "file:../../../com.unity.postprocessing",
"com.unity.purchasing": "2.0.1",
"com.unity.render-pipelines.core": "file:../../../com.unity.render-pipelines.core",

"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
}
},
"testables": [
"com.unity.render-pipelines.lightweight",
"com.unity.testframework.graphics"
]
}

2
TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/LWGraphicsTestSettings.cs.meta


fileFormatVersion: 2
guid: 7a6d45fa38de27845a764df7e9186fec
guid: 73231aa468d81ea49bc3d914080de185
MonoImporter:
externalObjects: {}
serializedVersion: 2

8
TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts.meta


fileFormatVersion: 2
guid: 0b04b118a94d0d942820245c6ffd79ed
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

6
TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/LWGraphicsTestSettings.cs


using UnityEngine.TestTools.Graphics;
public class LWGraphicsTestSettings : GraphicsTestSettings
{
public int WaitFrames = 0;
}

12
TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/LWGraphicsTests.asmdef


{
"name": "LWGraphicsTests",
"references": [
"UnityEngine.TestTools.Graphics"
],
"optionalUnityReferences": [
"TestAssemblies"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false
}

7
TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/LWGraphicsTests.asmdef.meta


fileFormatVersion: 2
guid: c30d5ade4e19e114ba605fbd1faa5512
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

37
TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/LWGraphicsTests.cs


using System.Collections;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
using UnityEngine.TestTools.Graphics;
using UnityEngine.SceneManagement;
public class LWGraphicsTests
{
[UnityTest, Category("LightWeightRP")]
[PrebuildSetup("SetupGraphicsTestCases")]
[UseGraphicsTestCases]
public IEnumerator Run(GraphicsTestCase testCase)
{
SceneManager.LoadScene(testCase.ScenePath);
// Always wait one frame for scene load
yield return null;
var camera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();
var settings = Object.FindObjectOfType<LWGraphicsTestSettings>();
Assert.IsNotNull(settings, "Invalid test scene, couldn't find PostProcessingGraphicsTestSettings");
for (int i = 0; i < settings.WaitFrames; i++)
yield return null;
ImageAssert.AreEqual(testCase.ReferenceImage, camera, settings.ImageComparisonSettings);
}
#if UNITY_EDITOR
[TearDown]
public void DumpImagesInEditor()
{
UnityEditor.TestTools.Graphics.ResultsUtility.ExtractImagesFromTestProperties(TestContext.CurrentContext.Test);
}
#endif
}

11
TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/LWGraphicsTests.cs.meta


fileFormatVersion: 2
guid: 52da4b5c062caa34a980de1d467b3a58
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/Setup.meta


fileFormatVersion: 2
guid: 4392d3aa76b386b49b33f5e708432cc8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

14
TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/Setup/LWEditorTests.asmdef


{
"name": "LWEditorTests",
"references": [
"UnityEditor.TestTools.Graphics"
],
"optionalUnityReferences": [
"TestAssemblies"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false
}

7
TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/Setup/LWEditorTests.asmdef.meta


fileFormatVersion: 2
guid: 55aba1c6f9cf8e949aa77aaeccd46083
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

12
TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/Setup/SetupGraphicsTestCases.cs


using UnityEngine.TestTools;
// Work around case #1033694, unable to use PrebuildSetup types directly from assemblies that don't have special names.
// Once that's fixed, this class can be deleted and the SetupGraphicsTestCases class in Unity.TestFramework.Graphics.Editor
// can be used directly instead.
public class SetupGraphicsTestCases : IPrebuildSetup
{
public void Setup()
{
new UnityEditor.TestTools.Graphics.SetupGraphicsTestCases().Setup();
}
}

11
TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/Setup/SetupGraphicsTestCases.cs.meta


fileFormatVersion: 2
guid: 0f6fc80695ba0bc48b4edeb2ce544600
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

35
TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/Setup/SetupProject.cs


using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
public static class SetupProject
{
public static void ApplySettings()
{
var options = new Dictionary<string, Action>
{
{ "gamma", () => PlayerSettings.colorSpace = ColorSpace.Gamma },
{ "linear", () => PlayerSettings.colorSpace = ColorSpace.Linear },
{ "glcore", () => SetGraphicsAPI(GraphicsDeviceType.OpenGLCore) },
{ "d3d11", () => SetGraphicsAPI(GraphicsDeviceType.Direct3D11) },
{ "d3d12", () => SetGraphicsAPI(GraphicsDeviceType.Direct3D12) },
{ "vulkan", () => SetGraphicsAPI(GraphicsDeviceType.Vulkan) }
};
var args = Environment.GetCommandLineArgs();
foreach (var arg in args)
{
Action action;
if (options.TryGetValue(arg, out action))
action();
}
}
static void SetGraphicsAPI(GraphicsDeviceType api)
{
var currentTarget = EditorUserBuildSettings.activeBuildTarget;
PlayerSettings.SetGraphicsAPIs(currentTarget, new [] { api } );
}
}

11
TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/Setup/SetupProject.cs.meta


fileFormatVersion: 2
guid: e3ca42651cb9072459e086f0544a388c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
TestProjects/LWGraphicsTest/Assets/PlayModeTests.meta


fileFormatVersion: 2
guid: c8e0de851db46554abf9dad715d23d3e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

/TestProjects/LWGraphicsTest/Assets/PlayModeTests/NewTestScript.cs.meta → /TestProjects/LWGraphicsTest/Assets/CommonAssets/Scripts/LWGraphicsTestSettings.cs.meta

正在加载...
取消
保存