Prechádzať zdrojové kódy

Unit tests: Lazy load shell as needed

Michael Ragazzon 1 rok pred
rodič
commit
16dcbcbaea

+ 5 - 1
Tests/Source/Common/TestsInterface.cpp

@@ -226,5 +226,9 @@ void TestsRenderInterface::Reset()
 }
 void TestsRenderInterface::VerifyMeshes()
 {
-	REQUIRE_MESSAGE(meshes.empty(), "CompileGeometry: Expected meshes not passed to us");
+	if (!meshes.empty())
+	{
+		// Use FAIL instead of REQUIRE here as this may be executed outside the context of a doctest test case.
+		FAIL("CompileGeometry: Expected meshes not passed to us");
+	}
 }

+ 4 - 2
Tests/Source/Common/TestsShell.cpp

@@ -73,7 +73,8 @@ TestsRenderInterface shell_render_interface;
 
 static void InitializeShell(bool allow_debugger)
 {
-	REQUIRE(!shell_initialized);
+	if (shell_initialized)
+		return;
 
 	// Initialize shell and create context.
 	shell_initialized = true;
@@ -154,7 +155,8 @@ void TestsShell::RenderLoop()
 
 void TestsShell::ShutdownShell()
 {
-	REQUIRE(shell_initialized);
+	if (!shell_initialized)
+		return;
 
 	if (debugger_allowed)
 	{