An open API service indexing awesome lists of open source software.

https://github.com/verifytests/verify.xaml

Extends Verify to allow verification of Xaml UIs
https://github.com/verifytests/verify.xaml

Last synced: 11 months ago
JSON representation

Extends Verify to allow verification of Xaml UIs

Awesome Lists containing this project

README

          

# Verify.Xaml

[![Discussions](https://img.shields.io/badge/Verify-Discussions-yellow?svg=true&label=)](https://github.com/orgs/VerifyTests/discussions)
[![Build status](https://ci.appveyor.com/api/projects/status/o2iy3b7k9le0ntps?svg=true)](https://ci.appveyor.com/project/SimonCropp/verify-xaml)
[![NuGet Status](https://img.shields.io/nuget/v/Verify.Xaml.svg)](https://www.nuget.org/packages/Verify.Xaml/)

Extends [Verify](https://github.com/VerifyTests/Verify) to allow verification of Xaml UIs.

**See [Milestones](../../milestones?state=closed) for release notes.**

## NuGet

* https://nuget.org/packages/Verify.Xaml

## Usage


```cs
[ModuleInitializer]
public static void Init() =>
VerifyXaml.Initialize();
```
snippet source | anchor

A visual element (Window/Page/Control etc) can then be verified as follows:


```cs
[Test]
public async Task WindowUsage()
{
var window = new MyWindow();
await Verify(window);
}
```
snippet source | anchor

With the state of the element being rendered as a verified files:

[TheTests.WindowUsage.verified.xml](/src/Tests/TheTests.WindowUsage.verified.xml):


```xml

































7
8
9
4
5
6
1
2
3
0
.
+/-
/
*
-
+
Sqrt
%
1/X
=
C
CE
MC
MR
MS
M+




```
snippet source | anchor

[TheTests.WindowUsage.verified.png](/src/Tests/TheTests.WindowUsage.verified.png):

## OS specific rendering

The rendering of XAML elements can very slightly between different OS versions. This can make verification on different machines (eg CI) problematic. There are several approaches to mitigate this:

* [Forcing elements to use a specific theme](https://arbel.net/2006/11/03/forcing-wpf-to-use-a-specific-windows-theme/)
* Using a [custom comparer](https://github.com/VerifyTests/Verify/blob/master/docs/comparer.md)

## Icon

[Gem](https://thenounproject.com/term/gem/2247823/) designed by [Adnen Kadri](https://thenounproject.com/adnen.kadri/) from [The Noun Project](https://thenounproject.com).