浏览代码

Fix TestFrameworkTools (relative scenes path issue)

/main
Remy 7 年前
当前提交
4008da43
共有 6 个文件被更改,包括 60 次插入10 次删除
  1. 2
      Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/EditorPlayModeTests.asset
  2. 14
      Tests/Scripts/Editor/GraphicTests/Framework/EditorPlayModeTests_Editor.cs
  3. 8
      Tests/Scripts/GraphicTests/Framework/TestFrameworkPlayMode.cs
  4. 24
      Tests/Scripts/GraphicTests/Framework/TestFrameworkTools.cs
  5. 14
      Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/EditorPlayModeTests.asset
  6. 8
      Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/EditorPlayModeTests.asset.meta

2
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/EditorPlayModeTests.asset


m_Name: EditorPlayModeTests
m_EditorClassIdentifier:
scenesPath:
- Assets/Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/3xxx_DebugView/3002_ObjectMotionVector.unity
- 3xxx_DebugView/3002_ObjectMotionVector.unity

14
Tests/Scripts/Editor/GraphicTests/Framework/EditorPlayModeTests_Editor.cs


using UnityEngine;
using UnityEditor;
using System;
using System.IO;
[DisallowMultipleComponent]
[CustomEditor(typeof(EditorPlayModeTests))]
class EditorPlayModeTests_Editor : Editor
{

if (newScene != null)
{
string newPath = AssetDatabase.GetAssetPath(newScene);
Debug.Log("New Path : " + newPath);
string listPath = AssetDatabase.GetAssetPath(target);
listPath = listPath.Remove(listPath.Length - 25, 25);
//Debug.Log("List path: " + listPath);
// Get scene path relative to the list file
newPath = newPath.Replace(listPath, "");
//Debug.Log("New Path : " + newPath);
if (newPath.EndsWith("unity"))
{
Debug.Log("Add the scene to the list");

8
Tests/Scripts/GraphicTests/Framework/TestFrameworkPlayMode.cs


var prjRelativeGraphsPath = TestFrameworkTools.s_Path.Aggregate(TestFrameworkTools.s_RootPath, Path.Combine);
var filePath = Path.Combine(prjRelativeGraphsPath, testInfo.relativePath);
for (int i = 0; i < UnityEngine.SceneManagement.SceneManager.sceneCountInBuildSettings; ++i)
{
UnityEngine.SceneManagement.Scene scene = UnityEngine.SceneManagement.SceneManager.GetSceneByBuildIndex(i);
Debug.Log("build index "+i+" : "+scene.name);
}
UnityEngine.SceneManagement.SceneManager.LoadScene( testInfo.relativePath , UnityEngine.SceneManagement.LoadSceneMode.Single);
UnityEngine.SceneManagement.SceneManager.LoadScene( testInfo.sceneListIndex , UnityEngine.SceneManagement.LoadSceneMode.Single);
yield return null; // wait one "frame" to let the scene load

24
Tests/Scripts/GraphicTests/Framework/TestFrameworkTools.cs


public static Dictionary<string, string> renderPipelineScenesFolder = new Dictionary<string, string>()
{
{ "HDRP", "HDRenderPipeline/Scenes" },
{ "LWRP", "LightweightPipeline" }
{ "LWRP", "LightweightPipeline/Scenes" }
};
// info that gets generated for use

public string relativePath;
public string templatePath;
public int frameWait;
public int sceneListIndex;
public override string ToString()
{

public static IEnumerable GetScenesForPipeline(string _pipelinePath, bool fixtureParam = false)
{
#if UNITY_EDITOR
var absoluteScenesPath = s_Path.Aggregate("Assets", Path.Combine);
string absoluteScenesPath = s_Path.Aggregate(s_RootPath, Path.Combine);
var filesPath = Path.Combine(absoluteScenesPath, _pipelinePath);
string assetScenesPath = absoluteScenesPath.Replace(Application.dataPath, "");
assetScenesPath = Path.Combine("Assets", assetScenesPath.Remove(0, 1));
string filesPath = Path.Combine(assetScenesPath, _pipelinePath);
string listFilePath = Path.Combine(filesPath, "EditorPlayModeTests.asset");

AssetDatabase.CreateAsset(ScriptableObject.CreateInstance<EditorPlayModeTests>(), listFilePath);
AssetDatabase.Refresh();
foreach (string path in listFile.scenesPath)
for ( int i=0 ; i<listFile.scenesPath.Length ; ++i)
var p = new FileInfo(path);
string path = listFile.scenesPath[i];
var p = new FileInfo( Path.Combine(filesPath, path ) );
var split = s_Path.Aggregate("", Path.Combine);
split = string.Format("{0}{1}", split, Path.DirectorySeparatorChar);
var splitPaths = p.FullName.Split(new[] { split }, StringSplitOptions.RemoveEmptyEntries);

name = p.Name,
relativePath = path,
relativePath = p.ToString(),
frameWait = 100
frameWait = 100,
sceneListIndex = i
};
if (fixtureParam)

14
Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/EditorPlayModeTests.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0baa057a399734241b8f30441a73b429, type: 3}
m_Name: EditorPlayModeTests
m_EditorClassIdentifier:
scenesPath: []

8
Tests/GraphicsTests/RenderPipeline/LightweightPipeline/Scenes/EditorPlayModeTests.asset.meta


fileFormatVersion: 2
guid: 538fb100057717544bdaac8705d4a015
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存