Update unit tests for new custom metadata
このコミットが含まれているのは:
1 親
308eab5fbc
コミット
4407d78c91
2ファイル変更
+120
-20
検索条件に一致するファイルはありません
@@ -14,6 +14,7 @@ public partial class D2D1EffectRegistrationDataTests
|
||||
ReadOnlyMemory<byte> blob = D2D1PixelShaderEffect.GetRegistrationBlob<TestRegistrationBlobShader>(out Guid effectId);
|
||||
D2D1EffectRegistrationData.V1 data = D2D1EffectRegistrationData.V1.Load(blob);
|
||||
|
||||
Assert.AreEqual(Guid.Parse("8AA3BDF3-5EC8-34D9-CFBC-97A2B4068FFD"), effectId);
|
||||
Assert.AreEqual(effectId, data.ClassId);
|
||||
Assert.AreEqual(2, data.NumberOfInputs);
|
||||
Assert.IsTrue(data.EffectFactory is not null);
|
||||
@@ -47,9 +48,9 @@ public partial class D2D1EffectRegistrationDataTests
|
||||
<?xml version='1.0'?>
|
||||
<Effect>
|
||||
<Property name='DisplayName' type='string' value=''/>
|
||||
<Property name='Author' type='string' value='ComputeSharp.D2D1'/>
|
||||
<Property name='Category' type='string' value='Stylize'/>
|
||||
<Property name='Description' type='string' value='A custom D2D1 effect using a pixel shader'/>
|
||||
<Property name='Description' type='string' value=''/>
|
||||
<Property name='Category' type='string' value=''/>
|
||||
<Property name='Author' type='string' value=''/>
|
||||
<Inputs>
|
||||
<Input name='Source0'/>
|
||||
<Input name='Source1'/>
|
||||
@@ -124,4 +125,97 @@ public partial class D2D1EffectRegistrationDataTests
|
||||
return this.a;
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public unsafe void EffectRegistrationData_WithCustomMetadata_Validate()
|
||||
{
|
||||
ReadOnlyMemory<byte> blob = D2D1PixelShaderEffect.GetRegistrationBlob<TestRegistrationBlobWithCustomMetadataShader>(out Guid effectId);
|
||||
D2D1EffectRegistrationData.V1 data = D2D1EffectRegistrationData.V1.Load(blob);
|
||||
|
||||
Assert.AreEqual(Guid.Parse("ABF58390-91D2-4F58-AA2B-22D0F6AC069C"), effectId);
|
||||
Assert.AreEqual("""
|
||||
<?xml version='1.0'?>
|
||||
<Effect>
|
||||
<Property name='DisplayName' type='string' value='EffectWithCustomMetadata'/>
|
||||
<Property name='Description' type='string' value='A test effect with some custom metadata'/>
|
||||
<Property name='Category' type='string' value='Test effects'/>
|
||||
<Property name='Author' type='string' value='Bob Ross'/>
|
||||
<Inputs>
|
||||
<Input name='Source0'/>
|
||||
<Input name='Source1'/>
|
||||
</Inputs>
|
||||
<Property name='ConstantBuffer' type='blob'>
|
||||
<Property name='DisplayName' type='string' value='ConstantBuffer'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager0' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager0'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager1' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager1'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager2' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager2'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager3' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager3'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager4' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager4'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager5' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager5'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager6' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager6'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager7' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager7'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager8' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager8'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager9' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager9'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager10' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager10'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager11' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager11'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager12' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager12'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager13' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager13'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager14' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager14'/>
|
||||
</Property>
|
||||
<Property name='ResourceTextureManager15' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='ResourceTextureManager15'/>
|
||||
</Property>
|
||||
<Property name='TransformMapper' type='iunknown'>
|
||||
<Property name='DisplayName' type='string' value='TransformMapper'/>
|
||||
</Property>
|
||||
</Effect>
|
||||
""", data.PropertyXml);
|
||||
}
|
||||
|
||||
[D2DInputCount(2)]
|
||||
[D2DEffectId("ABF58390-91D2-4F58-AA2B-22D0F6AC069C")]
|
||||
[D2DEffectDisplayName("EffectWithCustomMetadata")]
|
||||
[D2DEffectDescription("A test effect with some custom metadata")]
|
||||
[D2DEffectCategory("Test effects")]
|
||||
[D2DEffectAuthor("Bob Ross")]
|
||||
[AutoConstructor]
|
||||
private readonly partial struct TestRegistrationBlobWithCustomMetadataShader : ID2D1PixelShader
|
||||
{
|
||||
private readonly float a;
|
||||
|
||||
public float4 Execute()
|
||||
{
|
||||
return this.a;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -226,9 +226,12 @@ public partial class D2D1PixelShaderEffectTests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public unsafe void DefaultEffectDisplayName_MatchesValue()
|
||||
public unsafe void DefaultEffectMetadata_MatchesValue()
|
||||
{
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectDisplayName<ShaderWithDefaultEffectDisplayName>(), null);
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectDisplayName<ShaderWithDefaultEffectDisplayName>(), null);
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectDisplayName<ShaderWithDefaultEffectDisplayName>(), null);
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectDisplayName<ShaderWithDefaultEffectDisplayName>(), null);
|
||||
}
|
||||
|
||||
[D2DInputCount(0)]
|
||||
@@ -241,16 +244,17 @@ public partial class D2D1PixelShaderEffectTests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public unsafe void ExplicitEffectDisplayName_MatchesValue()
|
||||
public unsafe void ExplicitEffectMetadata1_MatchesValue()
|
||||
{
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectDisplayName<ShaderWithExplicitEffectDisplayName>(), "Fancy blur");
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectDisplayName<ShaderWithExplicitEffectDisplayName2>(), "Fancy"<");
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectDisplayName<ShaderWithExplicitEffectDisplayName3>(), "FancyBlurEffect");
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectDisplayName<ShaderWithExplicitEffectDisplayName1>(), "Fancy blur");
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectDescription<ShaderWithExplicitEffectDisplayName1>(), null);
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectCategory<ShaderWithExplicitEffectDisplayName1>(), null);
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectAuthor<ShaderWithExplicitEffectDisplayName1>(), null);
|
||||
}
|
||||
|
||||
[D2DInputCount(0)]
|
||||
[D2DEffectDisplayName("Fancy blur")]
|
||||
private partial struct ShaderWithExplicitEffectDisplayName : ID2D1PixelShader
|
||||
private partial struct ShaderWithExplicitEffectDisplayName1 : ID2D1PixelShader
|
||||
{
|
||||
public float4 Execute()
|
||||
{
|
||||
@@ -258,8 +262,20 @@ public partial class D2D1PixelShaderEffectTests
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public unsafe void ExplicitEffectMetadata2_MatchesValue()
|
||||
{
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectDisplayName<ShaderWithExplicitEffectDisplayName2>(), "Fancy"<");
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectDescription<ShaderWithExplicitEffectDisplayName2>(), "A test effect with some custom metadata");
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectCategory<ShaderWithExplicitEffectDisplayName2>(), "Test effects!");
|
||||
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectAuthor<ShaderWithExplicitEffectDisplayName2>(), "Bob Ross");
|
||||
}
|
||||
|
||||
[D2DInputCount(0)]
|
||||
[D2DEffectDisplayName("Fancy\"<")]
|
||||
[D2DEffectDisplayName("F\r\na\nncy\"<")]
|
||||
[D2DEffectDescription("A test effect with \nsome custom metadata")]
|
||||
[D2DEffectCategory("Test effects!")]
|
||||
[D2DEffectAuthor("Bob \r\nRoss")]
|
||||
private partial struct ShaderWithExplicitEffectDisplayName2 : ID2D1PixelShader
|
||||
{
|
||||
public float4 Execute()
|
||||
@@ -267,14 +283,4 @@ public partial class D2D1PixelShaderEffectTests
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
[D2DInputCount(0)]
|
||||
[D2DEffectDisplayName("Fancy\r\nBlur\nEffect")]
|
||||
private partial struct ShaderWithExplicitEffectDisplayName3 : ID2D1PixelShader
|
||||
{
|
||||
public float4 Execute()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする