Skip to content

Commit 0ebed49

Browse files
committed
Tests: fix interactive mode and added more settings to force image save (which would also capture RenderDoc)
1 parent 130d14a commit 0ebed49

File tree

19 files changed

+64
-15
lines changed

19 files changed

+64
-15
lines changed

sources/engine/Stride.Audio.Tests/Stride.Audio.Tests.Windows.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<StrideBuildTags>*</StrideBuildTags>
1010
<StrideCompileAssets>true</StrideCompileAssets>
1111
<StrideGraphicsApiDependent>true</StrideGraphicsApiDependent>
12+
<StrideGraphicsRegression>true</StrideGraphicsRegression>
1213
<!-- Test this project only on D3D11 since it is graphics API independent -->
1314
<StrideCompilerTargetsEnable Condition="'$(StrideGraphicsApi)' != 'Direct3D11'">false</StrideCompilerTargetsEnable>
1415
<!-- Force msbuild to check to rebuild this assembly instead of letting VS IDE guess -->

sources/engine/Stride.BepuPhysics/Stride.BepuPhysics.Tests/Stride.BepuPhysics.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<StrideBuildTags>*</StrideBuildTags>
99
<StrideCompileAssets>true</StrideCompileAssets>
1010
<StrideGraphicsApiDependent>true</StrideGraphicsApiDependent>
11+
<StrideGraphicsRegression>true</StrideGraphicsRegression>
1112
<!-- Force msbuild to check to rebuild this assembly instead of letting VS IDE guess -->
1213
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
1314
<Nullable>enable</Nullable>

sources/engine/Stride.Engine.NoAssets.Tests/Stride.Engine.NoAssets.Tests.Windows.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<StrideBuildTags>*</StrideBuildTags>
99
<StrideCompileAssets>false</StrideCompileAssets>
1010
<StrideGraphicsApiDependent>true</StrideGraphicsApiDependent>
11+
<StrideGraphicsRegression>true</StrideGraphicsRegression>
1112
</PropertyGroup>
1213
<PropertyGroup>
1314
<StartupObject>xunit.runner.stride.Program</StartupObject>

sources/engine/Stride.Engine.Tests/Stride.Engine.Tests.Windows.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<StrideBuildTags>*</StrideBuildTags>
1010
<StrideCompileAssets>true</StrideCompileAssets>
1111
<StrideGraphicsApiDependent>true</StrideGraphicsApiDependent>
12+
<StrideGraphicsRegression>true</StrideGraphicsRegression>
1213
<!-- Force msbuild to check to rebuild this assembly instead of letting VS IDE guess -->
1314
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
1415
</PropertyGroup>

sources/engine/Stride.Graphics.Regression/GameTestBase.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public abstract class GameTestBase : Game
5454
/// </summary>
5555
public static bool ForceInteractiveMode { get; set; }
5656

57+
/// <summary>
58+
/// Force image to be saved even if image comparison was a success and no error during the test.
59+
/// </summary>
60+
public static bool ForceSaveImageOnSuccess { get; set; }
61+
5762

5863
/// <summary>
5964
/// Gets the instance of the <see cref="FrameGameSystem"/> where the tests
@@ -98,6 +103,11 @@ public abstract class GameTestBase : Game
98103
private BackBufferSizeMode backBufferSizeMode;
99104

100105
#if STRIDE_PLATFORM_DESKTOP
106+
/// <summary>
107+
/// Forces render doc capture even if test didn't fail. This can be used only when <see cref="CaptureRenderDocOnError"/> is set.
108+
/// </summary>
109+
public static bool ForceCaptureRenderDocOnSuccess = false;
110+
101111
/// <summary>
102112
/// Gets or sets a value indicating whether RenderDoc should capture a frame when an error occurs
103113
/// or a test fails.
@@ -594,7 +604,8 @@ protected static void RunGameTest(GameTestBase game)
594604
// If no comparison errors, and no test errors, discard the capture
595605
if (game.comparisonFailedMessages.Count == 0 &&
596606
game.comparisonMissingMessages.Count == 0 &&
597-
exceptionOrFailedAssert is null)
607+
exceptionOrFailedAssert is null &&
608+
!ForceCaptureRenderDocOnSuccess)
598609
{
599610
game.DiscardFrameCapture();
600611
}
@@ -697,6 +708,8 @@ public void SendImage(Image image, string? testName)
697708
}
698709
}
699710

711+
comparisonFailedMessages.Add($"* {testLocalFileName} (current)");
712+
700713
if (testFileNames.Count == 0)
701714
{
702715
// No source image, save this one so that user can later copy it to validated folder
@@ -711,6 +724,10 @@ public void SendImage(Image image, string? testName)
711724
foreach (var file in testFileNames)
712725
comparisonFailedMessages.Add($" {file} ({ (matchingImage ? "reference" : "different platform/device") })");
713726
}
727+
else if (ForceSaveImageOnSuccess)
728+
{
729+
ImageTester.SaveImage(image, testLocalFileName);
730+
}
714731
else
715732
{
716733
// If test is a success, let's delete the local file if it was previously generated

sources/engine/Stride.Graphics.Tests.10_0/Stride.Graphics.Tests.10_0.Windows.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<StrideBuildTags>*</StrideBuildTags>
99
<StrideCompileAssets>true</StrideCompileAssets>
1010
<StrideGraphicsApiDependent>true</StrideGraphicsApiDependent>
11+
<StrideGraphicsRegression>true</StrideGraphicsRegression>
1112
<!-- Force msbuild to check to rebuild this assembly instead of letting VS IDE guess -->
1213
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
1314
</PropertyGroup>

sources/engine/Stride.Graphics.Tests.11_0/Stride.Graphics.Tests.11_0.Windows.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<StrideBuildTags>*</StrideBuildTags>
99
<StrideCompileAssets>true</StrideCompileAssets>
1010
<StrideGraphicsApiDependent>true</StrideGraphicsApiDependent>
11+
<StrideGraphicsRegression>true</StrideGraphicsRegression>
1112
<!-- Force msbuild to check to rebuild this assembly instead of letting VS IDE guess -->
1213
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
1314
</PropertyGroup>

sources/engine/Stride.Graphics.Tests/Stride.Graphics.Tests.Windows.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<StrideBuildTags>*</StrideBuildTags>
99
<StrideCompileAssets>true</StrideCompileAssets>
1010
<StrideGraphicsApiDependent>true</StrideGraphicsApiDependent>
11+
<StrideGraphicsRegression>true</StrideGraphicsRegression>
1112
<!-- Force msbuild to check to rebuild this assembly instead of letting VS IDE guess -->
1213
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
1314
</PropertyGroup>

sources/engine/Stride.Input.Tests/Stride.Input.Tests.Windows.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<StrideBuildTags>*</StrideBuildTags>
1010
<StrideCompileAssets>true</StrideCompileAssets>
1111
<StrideGraphicsApiDependent>true</StrideGraphicsApiDependent>
12+
<StrideGraphicsRegression>true</StrideGraphicsRegression>
1213
<!-- Force msbuild to check to rebuild this assembly instead of letting VS IDE guess -->
1314
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
1415
</PropertyGroup>

sources/engine/Stride.Navigation.Tests/Stride.Navigation.Tests.Windows.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<StrideBuildTags>*</StrideBuildTags>
1010
<StrideCompileAssets>true</StrideCompileAssets>
1111
<StrideGraphicsApiDependent>true</StrideGraphicsApiDependent>
12+
<StrideGraphicsRegression>true</StrideGraphicsRegression>
1213
<!-- Force msbuild to check to rebuild this assembly instead of letting VS IDE guess -->
1314
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
1415
</PropertyGroup>

0 commit comments

Comments
 (0)