├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── feature_request.md │ └── bug_report.md ├── dependabot.yml └── workflows │ ├── merge-dependabot.yml │ └── on-push-do-docs.yml ├── docs ├── zzz.png ├── intro.include.md └── zzz.include.md ├── src ├── icon.png ├── key.snk ├── global.json ├── XUnitTests │ ├── Tests.Recursive.verified.png │ ├── MyUserControlTests.Render.verified.png │ ├── CalculatorTests.Should_Add_Numbers.verified.png │ ├── MyUserControlTests.cs │ ├── GlobalUsings.cs │ ├── ModuleInit.cs │ ├── Tests.cs │ ├── Tests.Recursive.verified.txt │ ├── TestAppBuilder.cs │ ├── MyUserControlTests.Render.verified.txt │ ├── CalculatorTests.cs │ ├── XUnitTests.csproj │ └── CalculatorTests.Should_Add_Numbers.verified.txt ├── NUnitTests │ ├── MyUserControlTests.Render.verified.png │ ├── CalculatorTests.Should_Add_Numbers.verified.png │ ├── GlobalUsings.cs │ ├── MyUserControlTests.cs │ ├── TestAppBuilder.cs │ ├── ModuleInit.cs │ ├── MyUserControlTests.Render.verified.txt │ ├── CalculatorTests.cs │ ├── NUnitTests.csproj │ └── CalculatorTests.Should_Add_Numbers.verified.txt ├── StandaloneExampleTest.XUnit │ ├── Tests.Test.verified.png │ ├── GlobalUsings.cs │ ├── Tests.Test.verified.txt │ ├── Tests.cs │ ├── VerifyAvaloniaSetupApplication.cs │ └── StandaloneExampleTest.XUnit.csproj ├── IncludeThemeVariantTests │ ├── GlobalUsings.cs │ ├── CalculatorTests.Render#dark.verified.png │ ├── CalculatorTests.Render#light.verified.png │ ├── ModuleInit.cs │ ├── CalculatorTests.cs │ ├── IncludeThemeVariantTests.csproj │ └── CalculatorTests.Render.verified.txt ├── FluentAvaloniaTests │ ├── CalculatorTests.Render.verified.png │ ├── GlobalUsings.cs │ ├── CalculatorTests.cs │ ├── ModuleInit.cs │ ├── FluentAvaloniaControlTests.RenderNavigationView.verified.txt │ ├── FluentAvaloniaControlTests.RenderNavigationViewWithItemsSource.verified.txt │ ├── FluentAvaloniaControlTests.RenderNavigationViewWithBinding.verified.txt │ ├── TestAppBuilder.cs │ ├── FluentAvaloniaTests.csproj │ ├── CalculatorTests.Render.verified.txt │ └── FluentAvaloniaControlTests.cs ├── TestableApp │ ├── MainWindow.axaml.cs │ ├── MyUserControl.axaml.cs │ ├── GlobalUsings.cs │ ├── RecursiveWindow.axaml.cs │ ├── App.axaml │ ├── Program.cs │ ├── MyUserControl.axaml │ ├── RecursiveWindow.axaml │ ├── MainWindowViewModel.cs │ ├── App.axaml.cs │ ├── TestableApp.csproj │ └── MainWindow.axaml ├── Verify.Avalonia │ ├── Converters │ │ ├── FontFamilyConverter.cs │ │ ├── CornerRadiusConverter.cs │ │ ├── ThicknessConverter.cs │ │ └── AvaloniaConverter.cs │ ├── GlobalUsings.cs │ ├── Extensions.cs │ ├── Verify.Avalonia.csproj │ ├── VerifyAvalonia.cs │ └── VerifyAvalonia_Converters.cs ├── mdsnippets.json ├── Directory.Build.props ├── nuget.md ├── Verify.Avalonia.slnx.DotSettings ├── Verify.Avalonia.slnx ├── nuget.config ├── appveyor.yml ├── Directory.Packages.props └── Shared.sln.DotSettings ├── .gitignore ├── code_of_conduct.md ├── .gitattributes ├── license.txt ├── readme.md └── .editorconfig /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: VerifyTests 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false -------------------------------------------------------------------------------- /docs/zzz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VerifyTests/Verify.Avalonia/HEAD/docs/zzz.png -------------------------------------------------------------------------------- /src/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VerifyTests/Verify.Avalonia/HEAD/src/icon.png -------------------------------------------------------------------------------- /src/key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VerifyTests/Verify.Avalonia/HEAD/src/key.snk -------------------------------------------------------------------------------- /docs/intro.include.md: -------------------------------------------------------------------------------- 1 | Extends [Verify](https://github.com/VerifyTests/Verify) to allow verification of [Avalonia UIs](https://avaloniaui.net/). -------------------------------------------------------------------------------- /src/global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "10.0.101", 4 | "allowPrerelease": true, 5 | "rollForward": "latestFeature" 6 | } 7 | } -------------------------------------------------------------------------------- /src/XUnitTests/Tests.Recursive.verified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VerifyTests/Verify.Avalonia/HEAD/src/XUnitTests/Tests.Recursive.verified.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | *.user 3 | bin/ 4 | obj/ 5 | .vs/ 6 | *.DotSettings.user 7 | .idea/ 8 | *.received.* 9 | nugets/ 10 | nul 11 | .claude/settings.local.json 12 | -------------------------------------------------------------------------------- /src/NUnitTests/MyUserControlTests.Render.verified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VerifyTests/Verify.Avalonia/HEAD/src/NUnitTests/MyUserControlTests.Render.verified.png -------------------------------------------------------------------------------- /src/StandaloneExampleTest.XUnit/Tests.Test.verified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VerifyTests/Verify.Avalonia/HEAD/src/StandaloneExampleTest.XUnit/Tests.Test.verified.png -------------------------------------------------------------------------------- /src/XUnitTests/MyUserControlTests.Render.verified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VerifyTests/Verify.Avalonia/HEAD/src/XUnitTests/MyUserControlTests.Render.verified.png -------------------------------------------------------------------------------- /src/IncludeThemeVariantTests/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Avalonia; 2 | global using Avalonia.Headless; 3 | global using Avalonia.Headless.NUnit; 4 | global using TestableApp; -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: nuget 4 | directory: "/src" 5 | schedule: 6 | interval: daily 7 | open-pull-requests-limit: 10 8 | -------------------------------------------------------------------------------- /src/FluentAvaloniaTests/CalculatorTests.Render.verified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VerifyTests/Verify.Avalonia/HEAD/src/FluentAvaloniaTests/CalculatorTests.Render.verified.png -------------------------------------------------------------------------------- /src/NUnitTests/CalculatorTests.Should_Add_Numbers.verified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VerifyTests/Verify.Avalonia/HEAD/src/NUnitTests/CalculatorTests.Should_Add_Numbers.verified.png -------------------------------------------------------------------------------- /src/TestableApp/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | namespace TestableApp; 2 | 3 | public partial class MainWindow : Window 4 | { 5 | public MainWindow() => 6 | InitializeComponent(); 7 | } -------------------------------------------------------------------------------- /src/XUnitTests/CalculatorTests.Should_Add_Numbers.verified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VerifyTests/Verify.Avalonia/HEAD/src/XUnitTests/CalculatorTests.Should_Add_Numbers.verified.png -------------------------------------------------------------------------------- /src/NUnitTests/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Avalonia; 2 | global using Avalonia.Headless; 3 | global using Avalonia.Headless.NUnit; 4 | global using Avalonia.Input; 5 | global using TestableApp; 6 | -------------------------------------------------------------------------------- /src/IncludeThemeVariantTests/CalculatorTests.Render#dark.verified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VerifyTests/Verify.Avalonia/HEAD/src/IncludeThemeVariantTests/CalculatorTests.Render#dark.verified.png -------------------------------------------------------------------------------- /src/IncludeThemeVariantTests/CalculatorTests.Render#light.verified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VerifyTests/Verify.Avalonia/HEAD/src/IncludeThemeVariantTests/CalculatorTests.Render#light.verified.png -------------------------------------------------------------------------------- /src/TestableApp/MyUserControl.axaml.cs: -------------------------------------------------------------------------------- 1 | namespace TestableApp; 2 | 3 | public partial class MyUserControl : UserControl 4 | { 5 | public MyUserControl() => 6 | InitializeComponent(); 7 | } -------------------------------------------------------------------------------- /src/XUnitTests/MyUserControlTests.cs: -------------------------------------------------------------------------------- 1 | public class MyUserControlTests 2 | { 3 | [AvaloniaFact] 4 | public Task Render() 5 | { 6 | var control = new MyUserControl(); 7 | return Verify(control); 8 | } 9 | } -------------------------------------------------------------------------------- /src/XUnitTests/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Diagnostics.CodeAnalysis; 2 | global using Avalonia; 3 | global using Avalonia.Headless; 4 | global using Avalonia.Headless.XUnit; 5 | global using Avalonia.Input; 6 | global using TestableApp; -------------------------------------------------------------------------------- /src/NUnitTests/MyUserControlTests.cs: -------------------------------------------------------------------------------- 1 | [TestFixture] 2 | public class MyUserControlTests 3 | { 4 | [AvaloniaTest] 5 | public Task Render() 6 | { 7 | var control = new MyUserControl(); 8 | return Verify(control); 9 | } 10 | } -------------------------------------------------------------------------------- /src/TestableApp/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Avalonia; 2 | global using Avalonia.Controls; 3 | global using Avalonia.Markup.Xaml; 4 | global using CommunityToolkit.Mvvm.ComponentModel; 5 | global using CommunityToolkit.Mvvm.Input; 6 | global using TestableApp; -------------------------------------------------------------------------------- /src/TestableApp/RecursiveWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | namespace TestableApp; 2 | 3 | public partial class RecursiveWindow : Window 4 | { 5 | public RecursiveWindow() 6 | { 7 | InitializeComponent(); 8 | DataContext = this; 9 | } 10 | } -------------------------------------------------------------------------------- /src/Verify.Avalonia/Converters/FontFamilyConverter.cs: -------------------------------------------------------------------------------- 1 | class FontFamilyConverter : 2 | WriteOnlyJsonConverter 3 | { 4 | public override void Write(VerifyJsonWriter writer, FontFamily value) => 5 | writer.WriteValue(value.Name); 6 | } -------------------------------------------------------------------------------- /src/XUnitTests/ModuleInit.cs: -------------------------------------------------------------------------------- 1 | public static class ModuleInit 2 | { 3 | [ModuleInitializer] 4 | public static void InitOther() 5 | { 6 | VerifyImageMagick.RegisterComparers(0.17); 7 | VerifierSettings.InitializePlugins(); 8 | } 9 | } -------------------------------------------------------------------------------- /src/Verify.Avalonia/Converters/CornerRadiusConverter.cs: -------------------------------------------------------------------------------- 1 | class CornerRadiusConverter : 2 | WriteOnlyJsonConverter 3 | { 4 | public override void Write(VerifyJsonWriter writer, CornerRadius value) => 5 | writer.WriteValue(value.ToString()); 6 | } -------------------------------------------------------------------------------- /src/StandaloneExampleTest.XUnit/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Diagnostics.CodeAnalysis; 2 | global using Avalonia; 3 | global using Avalonia.Controls; 4 | global using Avalonia.Headless; 5 | global using Avalonia.Headless.XUnit; 6 | global using Avalonia.Themes.Fluent; 7 | -------------------------------------------------------------------------------- /src/TestableApp/App.axaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/mdsnippets.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/schema.json", 3 | "TocExcludes": [ "NuGet package", "Release Notes", "Icon" ], 4 | "MaxWidth": 80, 5 | "ValidateContent": true, 6 | "Convention": "InPlaceOverwrite" 7 | } -------------------------------------------------------------------------------- /src/XUnitTests/Tests.cs: -------------------------------------------------------------------------------- 1 | [SuppressMessage("Performance", "CA1822:Mark members as static")] 2 | public class Tests 3 | { 4 | [AvaloniaFact] 5 | public Task Recursive() 6 | { 7 | var window = new RecursiveWindow(); 8 | 9 | return Verify(window); 10 | } 11 | } -------------------------------------------------------------------------------- /code_of_conduct.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | This project has adopted the code of conduct defined by the Contributor Covenant 4 | to clarify expected behavior in our community. 5 | For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/about/code-of-conduct). 6 | -------------------------------------------------------------------------------- /src/StandaloneExampleTest.XUnit/Tests.Test.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Type: Window, 3 | SizeToContent: WidthAndHeight, 4 | Content: { 5 | Type: Button, 6 | Content: Click me!, 7 | Width: 75.0, 8 | Height: 32.0 9 | }, 10 | Width: 75.0, 11 | Height: 32.0, 12 | IsVisible: true 13 | } -------------------------------------------------------------------------------- /src/FluentAvaloniaTests/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Avalonia; 2 | global using Avalonia.Controls; 3 | global using Avalonia.Data; 4 | global using Avalonia.Headless; 5 | global using Avalonia.Headless.NUnit; 6 | global using FluentAvalonia.Styling; 7 | global using FluentAvalonia.UI.Controls; 8 | global using TestableApp; 9 | -------------------------------------------------------------------------------- /src/Verify.Avalonia/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using System.Globalization; 2 | global using Argon; 3 | global using Avalonia; 4 | global using Avalonia.Controls; 5 | global using Avalonia.Data; 6 | global using Avalonia.Diagnostics; 7 | global using Avalonia.Headless; 8 | global using Avalonia.Input; 9 | global using Avalonia.Media; -------------------------------------------------------------------------------- /src/TestableApp/Program.cs: -------------------------------------------------------------------------------- 1 | static class Program 2 | { 3 | [STAThread] 4 | public static void Main(string[] args) => 5 | AppBuilder.Configure() 6 | .UsePlatformDetect() 7 | .WithInterFont() 8 | .LogToTrace() 9 | .StartWithClassicDesktopLifetime(args); 10 | } -------------------------------------------------------------------------------- /src/FluentAvaloniaTests/CalculatorTests.cs: -------------------------------------------------------------------------------- 1 | [TestFixture] 2 | public class CalculatorTests 3 | { 4 | [AvaloniaTest] 5 | public Task Render() 6 | { 7 | var window = new MainWindow 8 | { 9 | DataContext = new MainWindowViewModel() 10 | }; 11 | 12 | return Verify(window); 13 | } 14 | } -------------------------------------------------------------------------------- /src/IncludeThemeVariantTests/ModuleInit.cs: -------------------------------------------------------------------------------- 1 | public static class ModuleInit 2 | { 3 | #region EnableIncludeThemeVariant 4 | 5 | [ModuleInitializer] 6 | public static void Init() 7 | { 8 | VerifyAvalonia.IncludeThemeVariant(); 9 | VerifierSettings.InitializePlugins(); 10 | } 11 | 12 | #endregion 13 | } -------------------------------------------------------------------------------- /src/IncludeThemeVariantTests/CalculatorTests.cs: -------------------------------------------------------------------------------- 1 | [TestFixture] 2 | public class CalculatorTests 3 | { 4 | [AvaloniaTest] 5 | public Task Render() 6 | { 7 | var window = new MainWindow 8 | { 9 | DataContext = new MainWindowViewModel() 10 | }; 11 | 12 | return Verify(window); 13 | } 14 | } -------------------------------------------------------------------------------- /src/XUnitTests/Tests.Recursive.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Type: RecursiveWindow, 3 | SizeToContent: WidthAndHeight, 4 | Title: RecursiveWindow, 5 | CanResize: false, 6 | Content: { 7 | Type: StackPanel, 8 | Spacing: 10.0, 9 | Margin: 10, 10 | HorizontalAlignment: Left 11 | }, 12 | Background: LightGray, 13 | Width: 20.0, 14 | Height: 20.0, 15 | IsVisible: true 16 | } -------------------------------------------------------------------------------- /src/NUnitTests/TestAppBuilder.cs: -------------------------------------------------------------------------------- 1 | [assembly: AvaloniaTestApplication(typeof(TestAppBuilder))] 2 | 3 | public static class TestAppBuilder 4 | { 5 | public static AppBuilder BuildAvaloniaApp() => 6 | AppBuilder.Configure() 7 | .UseSkia() 8 | .UseHeadless( 9 | new() 10 | { 11 | UseHeadlessDrawing = false 12 | }); 13 | } -------------------------------------------------------------------------------- /src/XUnitTests/TestAppBuilder.cs: -------------------------------------------------------------------------------- 1 | [assembly: AvaloniaTestApplication(typeof(TestAppBuilder))] 2 | 3 | public static class TestAppBuilder 4 | { 5 | public static AppBuilder BuildAvaloniaApp() => 6 | AppBuilder.Configure() 7 | .UseSkia() 8 | .UseHeadless( 9 | new() 10 | { 11 | UseHeadlessDrawing = false 12 | }); 13 | } -------------------------------------------------------------------------------- /src/NUnitTests/ModuleInit.cs: -------------------------------------------------------------------------------- 1 | public static class ModuleInit 2 | { 3 | #region Enable 4 | 5 | [ModuleInitializer] 6 | public static void Init() 7 | { 8 | VerifyImageMagick.RegisterComparers(0.17); 9 | VerifyAvalonia.Initialize(); 10 | } 11 | 12 | #endregion 13 | 14 | [ModuleInitializer] 15 | public static void InitOther() => 16 | VerifierSettings.InitializePlugins(); 17 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | *.snk binary 3 | *.png binary 4 | 5 | *.verified.txt text eol=lf working-tree-encoding=UTF-8 6 | *.verified.xml text eol=lf working-tree-encoding=UTF-8 7 | *.verified.json text eol=lf working-tree-encoding=UTF-8 8 | 9 | .editorconfig text eol=lf working-tree-encoding=UTF-8 10 | *.sln.DotSettings text eol=lf working-tree-encoding=UTF-8 11 | *.slnx.DotSettings text eol=lf working-tree-encoding=UTF-8 -------------------------------------------------------------------------------- /src/Verify.Avalonia/Extensions.cs: -------------------------------------------------------------------------------- 1 | static class Extensions 2 | { 3 | public static MemoryStream ToImage(this TopLevel topLevel) 4 | { 5 | using var bitmap = topLevel.CaptureRenderedFrame(); 6 | if (bitmap == null) 7 | { 8 | throw new("No RenderedFrame"); 9 | } 10 | 11 | var stream = new MemoryStream(); 12 | bitmap.Save(stream); 13 | return stream; 14 | } 15 | } -------------------------------------------------------------------------------- /.github/workflows/merge-dependabot.yml: -------------------------------------------------------------------------------- 1 | name: merge-dependabot 2 | on: 3 | pull_request: 4 | jobs: 5 | automerge: 6 | runs-on: ubuntu-latest 7 | if: github.actor == 'dependabot[bot]' 8 | steps: 9 | - name: Dependabot Auto Merge 10 | uses: ahmadnassri/action-dependabot-auto-merge@v2.6.6 11 | with: 12 | target: minor 13 | github-token: ${{ secrets.dependabot }} 14 | command: squash and merge -------------------------------------------------------------------------------- /src/FluentAvaloniaTests/ModuleInit.cs: -------------------------------------------------------------------------------- 1 | public static class ModuleInit 2 | { 3 | #region InitAddAvaloniaConvertersForAssembly 4 | 5 | [ModuleInitializer] 6 | public static void Init() 7 | { 8 | // FluentAvalonia 9 | VerifyAvalonia.AddAvaloniaConvertersForAssemblyOfType(); 10 | VerifyImageMagick.RegisterComparers(0.17); 11 | VerifierSettings.InitializePlugins(); 12 | } 13 | 14 | #endregion 15 | } -------------------------------------------------------------------------------- /docs/zzz.include.md: -------------------------------------------------------------------------------- 1 | ### Entity Framework Extensions 2 | 3 | [Entity Framework Extensions](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.Avalonia) is a major sponsor and is proud to contribute to the development this project. 4 | 5 | [![Entity Framework Extensions](https://raw.githubusercontent.com/VerifyTests/Verify.Avalonia/refs/heads/main/docs/zzz.png)](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.Avalonia) -------------------------------------------------------------------------------- /src/NUnitTests/MyUserControlTests.Render.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Type: MyUserControl, 3 | Content: { 4 | Type: StackPanel, 5 | Spacing: 10.0, 6 | Orientation: Vertical, 7 | Margin: 10, 8 | HorizontalAlignment: Left, 9 | Children: [ 10 | { 11 | Type: TextBlock, 12 | Text: Welcome to Avalonia! 13 | }, 14 | { 15 | Type: Button, 16 | Content: Button 17 | } 18 | ] 19 | }, 20 | Background: LightGray, 21 | Width: 200.0, 22 | Height: 100.0 23 | } -------------------------------------------------------------------------------- /src/XUnitTests/MyUserControlTests.Render.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Type: MyUserControl, 3 | Content: { 4 | Type: StackPanel, 5 | Spacing: 10.0, 6 | Orientation: Vertical, 7 | Margin: 10, 8 | HorizontalAlignment: Left, 9 | Children: [ 10 | { 11 | Type: TextBlock, 12 | Text: Welcome to Avalonia! 13 | }, 14 | { 15 | Type: Button, 16 | Content: Button 17 | } 18 | ] 19 | }, 20 | Background: LightGray, 21 | Width: 200.0, 22 | Height: 100.0 23 | } -------------------------------------------------------------------------------- /src/TestableApp/MyUserControl.axaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 |