Skip to content

Commit

Permalink
Add tests to ensure default EffectId-s are stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Sep 27, 2023
1 parent fd62b28 commit c2386eb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderEffectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,14 @@ public unsafe void DefaultEffectId_MatchesValue()
using ComPtr<ID2D1DeviceContext> d2D1DeviceContext = D2D1Helper.CreateD2D1DeviceContext(d2D1Device.Get());

D2D1PixelShaderEffect.RegisterForD2D1Factory1<ShaderWithDefaultEffectId>(d2D1Factory2.Get(), out Guid effectId);
D2D1PixelShaderEffect.RegisterForD2D1Factory1<ShaderWithDefaultEffectId2>(d2D1Factory2.Get(), out Guid effectId2);

// Ensure that the dynamically generated GUIDs are deterministic and stable
Assert.AreEqual(Guid.Parse("F5287184-0EC7-0BC6-3942-8BFB70E77C4B"), effectId);
Assert.AreEqual(Guid.Parse("96310279-E716-D336-5097-BE516792CBF0"), effectId2);

Assert.AreEqual(D2D1PixelShaderEffect.GetEffectId<ShaderWithDefaultEffectId>(), effectId);
Assert.AreNotEqual(D2D1PixelShaderEffect.GetEffectId<ShaderWithDefaultEffectId2>(), effectId);
Assert.AreEqual(D2D1PixelShaderEffect.GetEffectId<ShaderWithDefaultEffectId2>(), effectId2);
}

[D2DInputCount(0)]
Expand Down

0 comments on commit c2386eb

Please sign in to comment.