| 298 | |
| 299 | |
| 300 | void 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 | |
| 335 | Tr2PresentParametersAL WithValidRenderContext::presentParameters; |
| 336 | Tr2PrimaryRenderContextAL* WithValidRenderContext::renderContext = nullptr; |
nothing calls this directly
no test coverage detected