MCPcopy Create free account
hub / github.com/carbonengine/trinity / MakeTestScreenShot

Method MakeTestScreenShot

trinityal/tests/WithValidRenderContextFixture.cpp:300–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298
299
300void WithValidRenderContext::MakeTestScreenShot()
301{
302#if TRINITY_PLATFORM == TRINITY_STUB
303 return;
304#endif
305
306 extern bool g_makeScreenShots;
307 extern bool g_compareScreenShots;
308 extern std::string g_screenshotFolder;
309
310 if( ( !g_makeScreenShots && !g_compareScreenShots ) || m_madeScreenshot )
311 {
312 return;
313 }
314 m_madeScreenshot = true;
315
316 const ::testing::TestInfo* const test_info = ::testing::UnitTest::GetInstance()->current_test_info();
317
318 std::string path = g_screenshotFolder;
319 path += std::string( "/" ) + test_info->test_case_name();
320 MkDirs( path.c_str() );
321 path += std::string( "/" ) + test_info->name() + ".dds";
322
323 if( g_makeScreenShots )
324 {
325 MakeScreenShot( path.c_str() );
326 }
327 else
328 {
329 auto rt = GetReadableBackBuffer( *renderContext );
330 ASSERT_TRUE( rt.IsValid() );
331 ASSERT_TRUE( CompareWithBitmap( path.c_str(), rt, *renderContext ) );
332 }
333}
334
335Tr2PresentParametersAL WithValidRenderContext::presentParameters;
336Tr2PrimaryRenderContextAL* WithValidRenderContext::renderContext = nullptr;

Callers

nothing calls this directly

Calls 7

MkDirsFunction · 0.85
GetReadableBackBufferFunction · 0.85
CompareWithBitmapFunction · 0.85
current_test_infoMethod · 0.80
test_case_nameMethod · 0.80
nameMethod · 0.80
IsValidMethod · 0.45

Tested by

no test coverage detected