Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public Task VerifyPowerpointStream()
return Verify(stream, "pptx");
}
```
<sup><a href='/src/Tests/Samples.cs#L99-L108' title='Snippet source file'>snippet source</a> | <a href='#snippet-VerifyPowerpointStream' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/Samples.cs#L127-L136' title='Snippet source file'>snippet source</a> | <a href='#snippet-VerifyPowerpointStream' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -335,5 +335,24 @@ public async Task VerifyPresentationDocument()
await Verify(reader);
}
```
<sup><a href='/src/Tests/Samples.cs#L87-L97' title='Snippet source file'>snippet source</a> | <a href='#snippet-PresentationDocument' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/Samples.cs#L115-L125' title='Snippet source file'>snippet source</a> | <a href='#snippet-PresentationDocument' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


## Exclude the document

The source document is included in the snapshot as a `.verified.xlsx`, `.verified.docx`, or `.verified.pptx`. Building the deterministic package is expensive, and committing it is not always wanted. [`ExcludeTargets`](https://github.com/VerifyTests/Verify/blob/main/docs/converter.md#excluding-targets) drops it from a verification and skips the build, while the info, text, csv, and rendered pages still verify:

<!-- snippet: ExcludeExcel -->
<a id='snippet-ExcludeExcel'></a>
```cs
// Skips the .verified.xlsx (and building it), keeping the info and csv sheets.
[Test]
public Task ExcludeExcel() =>
VerifyFile("sample.xlsx")
.ExcludeTargets("xlsx");
```
<sup><a href='/src/Tests/Samples.cs#L87-L95' title='Snippet source file'>snippet source</a> | <a href='#snippet-ExcludeExcel' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

The same applies to `docx` and `pptx`. To exclude for every test, call `VerifierSettings.ExcludeTargets("xlsx")` at initialization.
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<PropertyGroup>
<NoWarn>CS1591;CS0649;CA1416;NU1608;NU1109;SC023</NoWarn>
<Version>1.22.0</Version>
<Version>1.23.0</Version>
<LangVersion>14.0</LangVersion>
<AssemblyVersion>1.0.0</AssemblyVersion>
<PackageTags>OpenXML, Verify</PackageTags>
Expand Down
6 changes: 3 additions & 3 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
<PackageVersion Include="NUnit3TestAdapter" Version="6.2.0" />
<PackageVersion Include="Polyfill" Version="10.11.2" />
<PackageVersion Include="ProjectDefaults" Version="1.0.174" />
<PackageVersion Include="Verify" Version="31.22.0" />
<PackageVersion Include="Verify" Version="31.24.0" />
<PackageVersion Include="Verify.DiffPlex" Version="3.3.0" />
<PackageVersion Include="Verify.NUnit" Version="31.22.0" />
<PackageVersion Include="Verify.NUnit" Version="31.24.0" />
<PackageVersion Include="Microsoft.Sbom.Targets" Version="4.1.5" />
<PackageVersion Include="Argon" Version="0.35.0" />
<PackageVersion Include="DiffEngine" Version="19.3.1" />
<PackageVersion Include="DiffEngine" Version="19.3.2" />
<PackageVersion Include="EmptyFiles" Version="8.18.2" />
<PackageVersion Include="SimpleInfoName" Version="3.2.0" />
</ItemGroup>
Expand Down
7 changes: 7 additions & 0 deletions src/Tests.ImageSharp/Samples.ExcludeExcel.verified.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
0,First Name,Last Name,Gender,Country,Date,Age,Id,Formula
1,Dulce,Abril,Female,United States,2017-10-15,32,1562,G2+H21594 (G2+H2)
2,Mara,Hashimoto,Female,Great Britain,2016-08-16,25,1582,1607
3,Philip,Gent,Male,France,2015-05-21,36,2587,2623
4,Kathleen,Hanner,Female,United States,2017-10-15,25,3549,3574
5,Nereida,Magwood,Female,United States,2016-08-16,58,2468,2526
6,Gaston,Brumm,Male,United States,2015-05-21,24,2554,2578
65 changes: 65 additions & 0 deletions src/Tests.ImageSharp/Samples.ExcludeExcel.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
Sheets: [
{
Name: Sheet1,
Columns: [
{
Name: 0,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: First Name,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Last Name,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Gender,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Country,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Date,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Age,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Id,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Formula,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
}
]
}
],
WorksheetCount: 1,
Title: The Title
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
Properties: {
Title: Sample Presentation
},
SlideCount: 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello, PowerPoint!
6 changes: 6 additions & 0 deletions src/Tests.ImageSharp/Samples.ExcludeWord#00.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
Properties: {
Subject: Test Subject,
Title: Sample Document
}
}
2 changes: 2 additions & 0 deletions src/Tests.ImageSharp/Samples.ExcludeWord#01.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Hello World! This is a sample Word document.
This is the second paragraph with some more text.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/Tests.Skia/Samples.ExcludeExcel.verified.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
0,First Name,Last Name,Gender,Country,Date,Age,Id,Formula
1,Dulce,Abril,Female,United States,2017-10-15,32,1562,G2+H21594 (G2+H2)
2,Mara,Hashimoto,Female,Great Britain,2016-08-16,25,1582,1607
3,Philip,Gent,Male,France,2015-05-21,36,2587,2623
4,Kathleen,Hanner,Female,United States,2017-10-15,25,3549,3574
5,Nereida,Magwood,Female,United States,2016-08-16,58,2468,2526
6,Gaston,Brumm,Male,United States,2015-05-21,24,2554,2578
65 changes: 65 additions & 0 deletions src/Tests.Skia/Samples.ExcludeExcel.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
Sheets: [
{
Name: Sheet1,
Columns: [
{
Name: 0,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: First Name,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Last Name,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Gender,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Country,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Date,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Age,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Id,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Formula,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
}
]
}
],
WorksheetCount: 1,
Title: The Title
}
6 changes: 6 additions & 0 deletions src/Tests.Skia/Samples.ExcludePowerpoint#00.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
Properties: {
Title: Sample Presentation
},
SlideCount: 1
}
1 change: 1 addition & 0 deletions src/Tests.Skia/Samples.ExcludePowerpoint#01.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello, PowerPoint!
6 changes: 6 additions & 0 deletions src/Tests.Skia/Samples.ExcludeWord#00.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
Properties: {
Subject: Test Subject,
Title: Sample Document
}
}
2 changes: 2 additions & 0 deletions src/Tests.Skia/Samples.ExcludeWord#01.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Hello World! This is a sample Word document.
This is the second paragraph with some more text.
Binary file added src/Tests.Skia/Samples.ExcludeWord.verified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/Tests/Samples.ExcludeExcel.verified.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
0,First Name,Last Name,Gender,Country,Date,Age,Id,Formula
1,Dulce,Abril,Female,United States,2017-10-15,32,1562,G2+H21594 (G2+H2)
2,Mara,Hashimoto,Female,Great Britain,2016-08-16,25,1582,1607
3,Philip,Gent,Male,France,2015-05-21,36,2587,2623
4,Kathleen,Hanner,Female,United States,2017-10-15,25,3549,3574
5,Nereida,Magwood,Female,United States,2016-08-16,58,2468,2526
6,Gaston,Brumm,Male,United States,2015-05-21,24,2554,2578
65 changes: 65 additions & 0 deletions src/Tests/Samples.ExcludeExcel.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
Sheets: [
{
Name: Sheet1,
Columns: [
{
Name: 0,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: First Name,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Last Name,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Gender,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Country,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Date,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Age,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Id,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
},
{
Name: Formula,
Width: 11.4,
ContainsRichText: false,
RequiredHighlight: false
}
]
}
],
WorksheetCount: 1,
Title: The Title
}
6 changes: 6 additions & 0 deletions src/Tests/Samples.ExcludePowerpoint#00.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
Properties: {
Title: Sample Presentation
},
SlideCount: 1
}
1 change: 1 addition & 0 deletions src/Tests/Samples.ExcludePowerpoint#01.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello, PowerPoint!
6 changes: 6 additions & 0 deletions src/Tests/Samples.ExcludeWord#00.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
Properties: {
Subject: Test Subject,
Title: Sample Document
}
}
2 changes: 2 additions & 0 deletions src/Tests/Samples.ExcludeWord#01.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Hello World! This is a sample Word document.
This is the second paragraph with some more text.
28 changes: 28 additions & 0 deletions src/Tests/Samples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,34 @@ public Task VerifyPowerpoint() =>

#endregion

#region ExcludeExcel

// Skips the .verified.xlsx (and building it), keeping the info and csv sheets.
[Test]
public Task ExcludeExcel() =>
VerifyFile("sample.xlsx")
.ExcludeTargets("xlsx");

#endregion

#region ExcludeWord

[Test]
public Task ExcludeWord() =>
VerifyFile("sample.docx")
.ExcludeTargets("docx");

#endregion

#region ExcludePowerpoint

[Test]
public Task ExcludePowerpoint() =>
VerifyFile("sample.pptx")
.ExcludeTargets("pptx");

#endregion

#region PresentationDocument

[Test]
Expand Down
Loading
Loading