From 15c0201325d4be1a16f299fe94368491627e7fa2 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 3 Sep 2022 23:35:06 +0200 Subject: [PATCH] Add test for CS0649 suppressor for D2D1 resource textures --- ...nitializedFieldDiagnosticSuppressorTests.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressorTests.cs diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressorTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressorTests.cs new file mode 100644 index 00000000..7a873e9a --- /dev/null +++ b/tests/ComputeSharp.D2D1.Tests/D2D1ResourceTextureUninitializedFieldDiagnosticSuppressorTests.cs @@ -0,0 +1,18 @@ +namespace ComputeSharp.D2D1.Tests; + +/// +/// A test class for the diagnostic suppressor for D2D1 resource texture fields being left uninitialized. +/// +internal sealed partial class D2D1ResourceTextureUninitializedFieldDiagnosticSuppressorTests +{ + public readonly partial struct MyShader : ID2D1PixelShader + { + // This test just needs to validate the project builds fine with this shader. + // If the diagnostic suppressor wasn't working, it'd fail to build because + // Roslyn would emit a CS0649 warning, which would be treated as an error. + [D2DResourceTextureIndex(0)] + private readonly D2D1ResourceTexture1D texture; + + public float4 Execute() => texture[0]; + } +}