| 241 | } |
| 242 | |
| 243 | void Baseline::TearDown() { |
| 244 | #ifdef UPDATE_BASELINE |
| 245 | if (!TGFXTest::HasFailure()) { |
| 246 | #ifdef GENERATE_BASELINE_IMAGES |
| 247 | auto outPath = ProjectPath::Absolute("test/out/"); |
| 248 | std::filesystem::remove_all(outPath); |
| 249 | if (std::filesystem::exists(OUT_ROOT)) { |
| 250 | std::filesystem::rename(OUT_ROOT, outPath); |
| 251 | } |
| 252 | #endif |
| 253 | CreateFolder(CACHE_MD5_PATH); |
| 254 | std::ofstream outMD5File(CACHE_MD5_PATH); |
| 255 | outMD5File << std::setw(4) << OutputMD5 << std::endl; |
| 256 | outMD5File.close(); |
| 257 | CreateFolder(CACHE_VERSION_PATH); |
| 258 | std::filesystem::copy(BASELINE_VERSION_PATH, CACHE_VERSION_PATH, |
| 259 | std::filesystem::copy_options::overwrite_existing); |
| 260 | } else { |
| 261 | std::filesystem::remove_all(OUT_ROOT); |
| 262 | } |
| 263 | USE(RemoveEmptyFolder); |
| 264 | #else |
| 265 | std::filesystem::remove(OUT_MD5_PATH); |
| 266 | if (!OutputMD5.empty()) { |
| 267 | CreateFolder(OUT_MD5_PATH); |
| 268 | std::ofstream outMD5File(OUT_MD5_PATH); |
| 269 | outMD5File << std::setw(4) << OutputMD5 << std::endl; |
| 270 | outMD5File.close(); |
| 271 | } |
| 272 | CreateFolder(OUT_VERSION_PATH); |
| 273 | std::ofstream versionFile(OUT_VERSION_PATH); |
| 274 | versionFile << std::setw(4) << OutputVersion << std::endl; |
| 275 | versionFile.close(); |
| 276 | RemoveEmptyFolder(OUT_ROOT); |
| 277 | #endif |
| 278 | } |
| 279 | } // namespace tgfx |
nothing calls this directly
no test coverage detected