Correctly insert attribute after built-in D2D attributes

このコミットが含まれているのは:
Sergio Pedri committed 2023-10-03 21:14:24 +02:00
1 親 1013cfb6f3
コミット 112a4af860
4ファイル変更
+138 -3

検索条件に一致するファイルはありません

@@ -294,4 +294,68 @@ public class Test_MissingPixelShaderDescriptorOnPixelShaderCodeFixer
await test.RunAsync();
}
[TestMethod]
public async Task InsertsAttributeAfterAllOtherD2DAttributes_WithFakeAttributes()
{
string original = """
using System;
using ComputeSharp.D2D1;
[D2DInputCount(2)]
[D2DInputSimple(0)]
[ComputeSharp.D2D1.D2DInputSimple(1)]
[D2DFake]
[Test]
partial struct {|CMPSD2D0065:MyShader|} : ID2D1PixelShader
{
public ComputeSharp.Float4 Execute() => 0;
}
public class TestAttribute : Attribute
{
}
public class D2DFakeAttribute : Attribute
{
}
""";
string @fixed = """
using System;
using ComputeSharp.D2D1;
[D2DInputCount(2)]
[D2DInputSimple(0)]
[ComputeSharp.D2D1.D2DInputSimple(1)]
[D2DGeneratedPixelShaderDescriptor]
[D2DFake]
[Test]
partial struct {|CMPSD2D0065:MyShader|} : ID2D1PixelShader
{
public ComputeSharp.Float4 Execute() => 0;
}
public class TestAttribute : Attribute
{
}
public class D2DFakeAttribute : Attribute
{
}
""";
CSharpCodeFixTest test = new()
{
TestCode = original,
FixedCode = @fixed,
ReferenceAssemblies = ReferenceAssemblies.Net.Net60
};
test.TestState.AdditionalReferences.Add(typeof(Core::ComputeSharp.Float4).Assembly);
test.TestState.AdditionalReferences.Add(typeof(D2D1::ComputeSharp.D2D1.ID2D1PixelShader).Assembly);
test.TestState.AnalyzerConfigFiles.Add(("/.editorconfig", "[*]\nend_of_line = lf"));
await test.RunAsync();
}
}