浏览代码

Unit tests: Lazy load shell as needed

Michael Ragazzon 1 年之前
父节点
当前提交
16dcbcbaea
共有 2 个文件被更改,包括 9 次插入3 次删除
  1. 5 1
      Tests/Source/Common/TestsInterface.cpp
  2. 4 2
      Tests/Source/Common/TestsShell.cpp

+ 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)
 	{