浏览代码

Fix paths for integration tests

/main
Peter Bay Bastian 7 年前
当前提交
8af999a0
共有 16 个文件被更改,包括 212 次插入15 次删除
  1. 21
      com.unity.shadergraph/Editor/Testing/IntegrationTests/ShaderGenerationTest.cs
  2. 8
      Testing.meta
  3. 8
      Testing/IntegrationTests.meta
  4. 8
      Testing/IntegrationTests/Graphs.meta
  5. 57
      Testing/IntegrationTests/Graphs/Add.ShaderGraph
  6. 7
      Testing/IntegrationTests/Graphs/Add.ShaderGraph.meta
  7. 8
      Testing/IntegrationTests/ShaderTemplates.meta
  8. 18
      Testing/IntegrationTests/ShaderTemplates/Add.ShaderGraph.png
  9. 83
      Testing/IntegrationTests/ShaderTemplates/Add.ShaderGraph.png.meta
  10. 0
      Testing/IntegrationTests/ShaderTemplates/Add.ShaderGraph.shader
  11. 9
      Testing/IntegrationTests/ShaderTemplates/Add.ShaderGraph.shader.meta

21
com.unity.shadergraph/Editor/Testing/IntegrationTests/ShaderGenerationTest.cs


{
public class ShaderGenerationTest
{
private static readonly string[] s_Path =
{
"UnityShaderEditor",
"Editor",
"Testing",
"IntegrationTests",
"Graphs"
};
static readonly string s_Path = Path.Combine(Path.Combine(Path.Combine(DefaultShaderIncludes.GetRepositoryPath(), "Testing"), "IntegrationTests"), "Graphs");
public struct TestInfo
{

{
get
{
var absoluteGraphsPath = s_Path.Aggregate(Application.dataPath, Path.Combine);
var filePaths = Directory.GetFiles(absoluteGraphsPath).Select(x => new FileInfo(x))
var filePaths = Directory.GetFiles(s_Path).Select(x => new FileInfo(x))
.Where(x => x.Extension == ".ShaderGraph");
foreach (var p in filePaths)

public void ShaderGeneratorOutput(TestInfo testInfo)
{
var file = testInfo.info;
var prjRelativeGraphsPath = s_Path.Aggregate("Assets", Path.Combine);
var filePath = Path.Combine(prjRelativeGraphsPath, file.Name);
var filePath = Path.Combine(s_Path, file.Name);
var textGraph = File.ReadAllText(filePath, Encoding.UTF8);
var graph = JsonUtility.FromJson<ShaderGraph.MaterialGraph>(textGraph);

var shaderString = String.Empty;
//graph.masterNode.GetFullShader(GenerationMode.ForReals, Path.GetFileNameWithoutExtension(filePath), out configuredTextures);
var rootPath = Directory.GetParent(Directory.GetParent(Application.dataPath).ToString());
var shaderTemplatePath = Path.Combine(rootPath.ToString(), "ShaderTemplates");
var rootPath = Path.Combine(Path.Combine(DefaultShaderIncludes.GetRepositoryPath(), "Testing"), "IntegrationTests");
var shaderTemplatePath = Path.Combine(rootPath, "ShaderTemplates");
Directory.CreateDirectory(shaderTemplatePath);
var textTemplateFilePath = Path.Combine(shaderTemplatePath, string.Format("{0}.{1}", file.Name, "shader"));

if (0 != textsAreEqual)
{
var failedPath = Path.Combine(rootPath.ToString(), "Failed");
var failedPath = Path.Combine(rootPath, "Failed");
Directory.CreateDirectory(failedPath);
var misMatchLocationResult = Path.Combine(failedPath, string.Format("{0}.{1}", file.Name, "shader"));
var misMatchLocationTemplate = Path.Combine(failedPath, string.Format("{0}.template.{1}", file.Name, "shader"));

8
Testing.meta


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

8
Testing/IntegrationTests.meta


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

8
Testing/IntegrationTests/Graphs.meta


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

57
Testing/IntegrationTests/Graphs/Add.ShaderGraph


{
"m_SerializedProperties": [],
"m_GUID": {
"m_GuidSerialized": "17176d7a-f8ae-444e-b467-368306d9740e"
},
"m_SerializableNodes": [
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.UnlitMasterNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"d6f5f404-9428-4ff8-8bac-c3aad434ee94\",\n \"m_Name\": \"Unlit Master\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 0.0,\n \"y\": 0.0,\n \"width\": 0.0,\n \"height\": 0.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.ColorRGBMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Color\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Color\\\",\\n \\\"m_ShaderStage\\\": 2,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.5,\\n \\\"y\\\": 0.5,\\n \\\"z\\\": 0.5\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"Alpha\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Alpha\\\",\\n \\\"m_ShaderStage\\\": 2,\\n \\\"m_Value\\\": 1.0,\\n \\\"m_DefaultValue\\\": 1.0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 8,\\n \\\"m_DisplayName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_ShaderStage\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_SerializableSubShaders\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.LightWeightUnlitSubShader\"\n },\n \"JSONnodeData\": \"{}\"\n }\n ],\n \"m_AlphaMode\": 0\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.AddNode"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"3d7cb8e2-9a91-47ae-980c-60f5d74b1f29\",\n \"m_Name\": \"Add\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -359.5,\n \"y\": 1.0,\n \"width\": 208.0,\n \"height\": 302.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_ShaderStage\\\": 0,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_ShaderStage\\\": 0,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_ShaderStage\\\": 0,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.Vector2Node"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"371aea6f-8280-4d19-8182-006228b43fb1\",\n \"m_Name\": \"Vector 2\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -532.5,\n \"y\": -28.0,\n \"width\": 104.0,\n \"height\": 114.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector2MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_ShaderStage\\\": 0,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_Value\": {\n \"x\": 0.20000000298023225,\n \"y\": 0.4000000059604645\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.ShaderGraph.Vector4Node"
},
"JSONnodeData": "{\n \"m_GuidSerialized\": \"d33350e2-ae0f-43c2-8639-55adc4252c52\",\n \"m_Name\": \"Vector 4\",\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -615.5,\n \"y\": 89.0,\n \"width\": 188.0,\n \"height\": 114.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector4MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_ShaderStage\\\": 0,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_PreviewExpanded\": true,\n \"m_Value\": {\n \"x\": 0.6000000238418579,\n \"y\": 0.5,\n \"z\": 0.699999988079071,\n \"w\": 1.0\n }\n}"
}
],
"m_SerializableEdges": [
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"3d7cb8e2-9a91-47ae-980c-60f5d74b1f29\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"d6f5f404-9428-4ff8-8bac-c3aad434ee94\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"371aea6f-8280-4d19-8182-006228b43fb1\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"3d7cb8e2-9a91-47ae-980c-60f5d74b1f29\"\n }\n}"
},
{
"typeInfo": {
"fullName": "UnityEditor.Graphing.Edge"
},
"JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"d33350e2-ae0f-43c2-8639-55adc4252c52\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"3d7cb8e2-9a91-47ae-980c-60f5d74b1f29\"\n }\n}"
}
],
"m_PreviewData": {
"serializedMesh": {
"m_SerializedMesh": ""
}
}
}

7
Testing/IntegrationTests/Graphs/Add.ShaderGraph.meta


fileFormatVersion: 2
guid: 5afb17f32b499314c8744c5ee1859a0d
ScriptedImporter:
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

8
Testing/IntegrationTests/ShaderTemplates.meta


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

18
Testing/IntegrationTests/ShaderTemplates/Add.ShaderGraph.png

之前 之后
宽度: 256  |  高度: 256  |  大小: 3.8 KiB

83
Testing/IntegrationTests/ShaderTemplates/Add.ShaderGraph.png.meta


fileFormatVersion: 2
guid: fb9b3c4c65118764aba1c1aa90df4b56
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

0
Testing/IntegrationTests/ShaderTemplates/Add.ShaderGraph.shader

9
Testing/IntegrationTests/ShaderTemplates/Add.ShaderGraph.shader.meta


fileFormatVersion: 2
guid: 77af32e86de29534d8a9e7f227a27569
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存