Add 'Test_CanvasEffectPropertyGenerator'
このコミットが含まれているのは:
1 親
269bc77dab
コミット
2c2fea61c2
1ファイル変更
+500
+500
@@ -0,0 +1,500 @@
|
||||
using System.Threading.Tasks;
|
||||
using ComputeSharp.D2D1.WinUI.SourceGenerators;
|
||||
using ComputeSharp.Tests.SourceGenerators.Helpers;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace ComputeSharp.D2D1.WinUI.Tests.SourceGenerators;
|
||||
|
||||
[TestClass]
|
||||
public class Test_CanvasEffectPropertyGenerator
|
||||
{
|
||||
[TestMethod]
|
||||
public async Task SingleProperty()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp.D2D1.WinUI;
|
||||
|
||||
namespace MyNamespace;
|
||||
|
||||
public abstract partial class MyEffect : CanvasEffect
|
||||
{
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public int Number { get; set; }
|
||||
}
|
||||
""";
|
||||
|
||||
const string result = """"
|
||||
// <auto-generated/>
|
||||
#pragma warning disable
|
||||
|
||||
namespace MyNamespace
|
||||
{
|
||||
/// <inheritdoc cref="MyEffect"/>
|
||||
partial class MyEffect
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public partial int Number
|
||||
{
|
||||
get => field;
|
||||
set
|
||||
{
|
||||
if (global::System.Collections.Generic.EqualityComparer<int>.Default.Equals(field, value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int oldValue = field;
|
||||
|
||||
OnNumberChanging(value);
|
||||
OnNumberChanging(oldValue, value);
|
||||
|
||||
field = value;
|
||||
|
||||
OnNumberChanged(value);
|
||||
OnNumberChanged(oldValue, value);
|
||||
|
||||
InvalidateEffectGraph(global::ComputeSharp.D2D1.WinUI.CanvasEffectInvalidationType.Update);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> is changing.</summary>
|
||||
/// <param name="value">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnNumberChanging(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> is changing.</summary>
|
||||
/// <param name="oldValue">The previous property value that is being replaced.</param>
|
||||
/// <param name="newValue">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnNumberChanging(int oldValue, int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> has just changed.</summary>
|
||||
/// <param name="value">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnNumberChanged(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> has just changed.</summary>
|
||||
/// <param name="oldValue">The previous property value that has been replaced.</param>
|
||||
/// <param name="newValue">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnNumberChanged(int oldValue, int newValue);
|
||||
}
|
||||
}
|
||||
"""";
|
||||
|
||||
await VerifyGeneratedDiagnosticsAsync(source, ("MyNamespace.MyEffect.g.cs", result));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task SingleProperty_WithNullabilityAnnotations()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp.D2D1.WinUI;
|
||||
|
||||
namespace MyNamespace;
|
||||
|
||||
public abstract partial class MyEffect : CanvasEffect
|
||||
{
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public object? Instance { get; set; }
|
||||
}
|
||||
""";
|
||||
|
||||
const string result = """"
|
||||
// <auto-generated/>
|
||||
#pragma warning disable
|
||||
|
||||
namespace MyNamespace
|
||||
{
|
||||
/// <inheritdoc cref="MyEffect"/>
|
||||
partial class MyEffect
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public partial object? Instance
|
||||
{
|
||||
get => field;
|
||||
set
|
||||
{
|
||||
if (global::System.Collections.Generic.EqualityComparer<object?>.Default.Equals(field, value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
object? oldValue = field;
|
||||
|
||||
OnInstanceChanging(value);
|
||||
OnInstanceChanging(oldValue, value);
|
||||
|
||||
field = value;
|
||||
|
||||
OnInstanceChanged(value);
|
||||
OnInstanceChanged(oldValue, value);
|
||||
|
||||
InvalidateEffectGraph(global::ComputeSharp.D2D1.WinUI.CanvasEffectInvalidationType.Update);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> is changing.</summary>
|
||||
/// <param name="value">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnInstanceChanging(object? newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> is changing.</summary>
|
||||
/// <param name="oldValue">The previous property value that is being replaced.</param>
|
||||
/// <param name="newValue">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnInstanceChanging(object? oldValue, object? newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> has just changed.</summary>
|
||||
/// <param name="value">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnInstanceChanged(object? newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> has just changed.</summary>
|
||||
/// <param name="oldValue">The previous property value that has been replaced.</param>
|
||||
/// <param name="newValue">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnInstanceChanged(object? oldValue, object? newValue);
|
||||
}
|
||||
}
|
||||
"""";
|
||||
|
||||
await VerifyGeneratedDiagnosticsAsync(source, ("MyNamespace.MyEffect.g.cs", result));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task SingleProperty_WithNotNullableReferenceType()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp.D2D1.WinUI;
|
||||
|
||||
namespace MyNamespace;
|
||||
|
||||
public abstract partial class MyEffect : CanvasEffect
|
||||
{
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public object Instance { get; set; }
|
||||
}
|
||||
""";
|
||||
|
||||
const string result = """"
|
||||
// <auto-generated/>
|
||||
#pragma warning disable
|
||||
|
||||
namespace MyNamespace
|
||||
{
|
||||
/// <inheritdoc cref="MyEffect"/>
|
||||
partial class MyEffect
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public partial object Instance
|
||||
{
|
||||
get => field;
|
||||
set
|
||||
{
|
||||
if (global::System.Collections.Generic.EqualityComparer<object?>.Default.Equals(field, value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
object? oldValue = field;
|
||||
|
||||
OnInstanceChanging(value);
|
||||
OnInstanceChanging(oldValue, value);
|
||||
|
||||
field = value;
|
||||
|
||||
OnInstanceChanged(value);
|
||||
OnInstanceChanged(oldValue, value);
|
||||
|
||||
InvalidateEffectGraph(global::ComputeSharp.D2D1.WinUI.CanvasEffectInvalidationType.Update);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> is changing.</summary>
|
||||
/// <param name="value">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnInstanceChanging(object newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> is changing.</summary>
|
||||
/// <param name="oldValue">The previous property value that is being replaced.</param>
|
||||
/// <param name="newValue">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnInstanceChanging(object? oldValue, object newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> has just changed.</summary>
|
||||
/// <param name="value">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnInstanceChanged(object newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Instance"/> has just changed.</summary>
|
||||
/// <param name="oldValue">The previous property value that has been replaced.</param>
|
||||
/// <param name="newValue">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Instance"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnInstanceChanged(object? oldValue, object newValue);
|
||||
}
|
||||
}
|
||||
"""";
|
||||
|
||||
await VerifyGeneratedDiagnosticsAsync(source, ("MyNamespace.MyEffect.g.cs", result));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task SingleProperty_WithCustomAccessorVisibility()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp.D2D1.WinUI;
|
||||
|
||||
namespace MyNamespace;
|
||||
|
||||
public abstract partial class MyEffect : CanvasEffect
|
||||
{
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public int Number { get; private set; }
|
||||
}
|
||||
""";
|
||||
|
||||
const string result = """"
|
||||
// <auto-generated/>
|
||||
#pragma warning disable
|
||||
|
||||
namespace MyNamespace
|
||||
{
|
||||
/// <inheritdoc cref="MyEffect"/>
|
||||
partial class MyEffect
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public partial int Number
|
||||
{
|
||||
get => field;
|
||||
private set
|
||||
{
|
||||
if (global::System.Collections.Generic.EqualityComparer<int>.Default.Equals(field, value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int oldValue = field;
|
||||
|
||||
OnNumberChanging(value);
|
||||
OnNumberChanging(oldValue, value);
|
||||
|
||||
field = value;
|
||||
|
||||
OnNumberChanged(value);
|
||||
OnNumberChanged(oldValue, value);
|
||||
|
||||
InvalidateEffectGraph(global::ComputeSharp.D2D1.WinUI.CanvasEffectInvalidationType.Update);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> is changing.</summary>
|
||||
/// <param name="value">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnNumberChanging(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> is changing.</summary>
|
||||
/// <param name="oldValue">The previous property value that is being replaced.</param>
|
||||
/// <param name="newValue">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnNumberChanging(int oldValue, int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> has just changed.</summary>
|
||||
/// <param name="value">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnNumberChanged(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Number"/> has just changed.</summary>
|
||||
/// <param name="oldValue">The previous property value that has been replaced.</param>
|
||||
/// <param name="newValue">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Number"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnNumberChanged(int oldValue, int newValue);
|
||||
}
|
||||
}
|
||||
"""";
|
||||
|
||||
await VerifyGeneratedDiagnosticsAsync(source, ("MyNamespace.MyEffect.g.cs", result));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task MultipleProperties()
|
||||
{
|
||||
const string source = """
|
||||
using ComputeSharp.D2D1.WinUI;
|
||||
|
||||
namespace MyNamespace;
|
||||
|
||||
public abstract partial class MyEffect : CanvasEffect
|
||||
{
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public int X { get; set; }
|
||||
|
||||
[GeneratedCanvasEffectProperty]
|
||||
public int Y { get; set; }
|
||||
}
|
||||
""";
|
||||
|
||||
const string result = """"
|
||||
// <auto-generated/>
|
||||
#pragma warning disable
|
||||
|
||||
namespace MyNamespace
|
||||
{
|
||||
/// <inheritdoc cref="MyEffect"/>
|
||||
partial class MyEffect
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public partial int X
|
||||
{
|
||||
get => field;
|
||||
set
|
||||
{
|
||||
if (global::System.Collections.Generic.EqualityComparer<int>.Default.Equals(field, value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int oldValue = field;
|
||||
|
||||
OnXChanging(value);
|
||||
OnXChanging(oldValue, value);
|
||||
|
||||
field = value;
|
||||
|
||||
OnXChanged(value);
|
||||
OnXChanged(oldValue, value);
|
||||
|
||||
InvalidateEffectGraph(global::ComputeSharp.D2D1.WinUI.CanvasEffectInvalidationType.Update);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCode]
|
||||
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public partial int Y
|
||||
{
|
||||
get => field;
|
||||
set
|
||||
{
|
||||
if (global::System.Collections.Generic.EqualityComparer<int>.Default.Equals(field, value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int oldValue = field;
|
||||
|
||||
OnYChanging(value);
|
||||
OnYChanging(oldValue, value);
|
||||
|
||||
field = value;
|
||||
|
||||
OnYChanged(value);
|
||||
OnYChanged(oldValue, value);
|
||||
|
||||
InvalidateEffectGraph(global::ComputeSharp.D2D1.WinUI.CanvasEffectInvalidationType.Update);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="X"/> is changing.</summary>
|
||||
/// <param name="value">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="X"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnXChanging(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="X"/> is changing.</summary>
|
||||
/// <param name="oldValue">The previous property value that is being replaced.</param>
|
||||
/// <param name="newValue">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="X"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnXChanging(int oldValue, int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="X"/> has just changed.</summary>
|
||||
/// <param name="value">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="X"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnXChanged(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="X"/> has just changed.</summary>
|
||||
/// <param name="oldValue">The previous property value that has been replaced.</param>
|
||||
/// <param name="newValue">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="X"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnXChanged(int oldValue, int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Y"/> is changing.</summary>
|
||||
/// <param name="value">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Y"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnYChanging(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Y"/> is changing.</summary>
|
||||
/// <param name="oldValue">The previous property value that is being replaced.</param>
|
||||
/// <param name="newValue">The new property value being set.</param>
|
||||
/// <remarks>This method is invoked right before the value of <see cref="Y"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnYChanging(int oldValue, int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Y"/> has just changed.</summary>
|
||||
/// <param name="value">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Y"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnYChanged(int newValue);
|
||||
|
||||
/// <summary>Executes the logic for when <see cref="Y"/> has just changed.</summary>
|
||||
/// <param name="oldValue">The previous property value that has been replaced.</param>
|
||||
/// <param name="newValue">The new property value that has been set.</param>
|
||||
/// <remarks>This method is invoked right after the value of <see cref="Y"/> is changed.</remarks>
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.D2D1.WinUI.CanvasEffectPropertyGenerator", "3.0.0.0")]
|
||||
partial void OnYChanged(int oldValue, int newValue);
|
||||
}
|
||||
}
|
||||
"""";
|
||||
|
||||
await VerifyGeneratedDiagnosticsAsync(source, ("MyNamespace.MyEffect.g.cs", result));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies the output of a source generator.
|
||||
/// </summary>
|
||||
/// <param name="source">The input source to process.</param>
|
||||
/// <param name="result">The expected source to be generated.</param>
|
||||
/// <returns>The task for the operation.</returns>
|
||||
private static async Task VerifyGeneratedDiagnosticsAsync(string source, (string Filename, string Source) result)
|
||||
{
|
||||
await CSharpAnalyzerWithLanguageVersionTest<InvalidGeneratedCanvasEffectPropertyContainingTypeAnalyzer>.VerifyAnalyzerAsync(source);
|
||||
|
||||
CSharpGeneratorTest<CanvasEffectPropertyGenerator>.VerifySources(source, result);
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする