浏览代码

HDRenderPipeline: Remove obsolete editor test

/main
Sebastien Lagarde 7 年前
当前提交
3446aaee
共有 2 个文件被更改,包括 0 次插入64 次删除
  1. 3
      Tests/Scripts/Editor/MaterialUpgraderTests.cs.meta
  2. 61
      Tests/Scripts/Editor/MaterialUpgraderTests.cs

3
Tests/Scripts/Editor/MaterialUpgraderTests.cs.meta


fileFormatVersion: 2
guid: 20d5442c0aea41919653fbc75ca174d1
timeCreated: 1512986339

61
Tests/Scripts/Editor/MaterialUpgraderTests.cs


using NUnit.Framework;
using UnityEditor.Experimental.Rendering;
using UnityEditor.Experimental.Rendering.HDPipeline;
using UnityEngine;
namespace ScriptableRenderPipeline.Tests.Editor
{
public class MaterialUpgraderTests
{
[Test]
public void UpgradeStandardSpecularToHDLitMaterial()
{
var newShader = Shader.Find("HDRenderPipeline/Lit");
var mat = new Material(Shader.Find("Standard (Specular setup)"));
var albedo = new Texture2D(1, 1);
var normals = new Texture2D(1, 1);
var baseScale = new Vector2(1, 1);
var color = Color.red;
mat.mainTexture = albedo;
mat.SetTexture("_BumpMap", normals);
mat.color = color;
mat.SetTextureScale("_MainTex", baseScale);
var upgrader = new StandardSpecularToHDLitMaterialUpgrader();
MaterialUpgrader.Upgrade(mat, upgrader, MaterialUpgrader.UpgradeFlags.CleanupNonUpgradedProperties);
Assert.AreEqual(newShader, mat.shader);
Assert.AreEqual(albedo, mat.GetTexture("_BaseColorMap"));
Assert.AreEqual(color, mat.GetColor("_BaseColor"));
Assert.AreEqual(baseScale, mat.GetTextureScale("_BaseColorMap"));
Assert.AreEqual(normals, mat.GetTexture("_NormalMap"));
Assert.IsTrue(mat.IsKeywordEnabled("_NORMALMAP"));
}
[Test]
public void UpgradeStandardToHDLitMaterialUpgrader()
{
var newShader = Shader.Find("HDRenderPipeline/Lit");
var mat = new Material(Shader.Find("Standard"));
var albedo = new Texture2D(1, 1);
var normals = new Texture2D(1, 1);
var baseScale = new Vector2(1, 1);
var color = Color.red;
mat.mainTexture = albedo;
mat.SetTexture("_BumpMap", normals);
mat.color = color;
mat.SetTextureScale("_MainTex", baseScale);
var upgrader = new StandardToHDLitMaterialUpgrader();
MaterialUpgrader.Upgrade(mat, upgrader, MaterialUpgrader.UpgradeFlags.CleanupNonUpgradedProperties);
Assert.AreEqual(newShader, mat.shader);
Assert.AreEqual(albedo, mat.GetTexture("_BaseColorMap"));
Assert.AreEqual(color, mat.GetColor("_BaseColor"));
Assert.AreEqual(baseScale, mat.GetTextureScale("_BaseColorMap"));
Assert.AreEqual(normals, mat.GetTexture("_NormalMap"));
Assert.IsTrue(mat.IsKeywordEnabled("_NORMALMAP"));
}
}
}
正在加载...
取消
保存