From 252d0777e5f6c901ddf512133a12e8ee553a297d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Dutheillet-Lamonth=C3=A9zie?= Date: Tue, 30 Jul 2024 22:48:25 +0200 Subject: [PATCH] #95: fix test logic --- tests/unit/render/test_render.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/unit/render/test_render.cc b/tests/unit/render/test_render.cc index e18fce5107..a350cfef0d 100644 --- a/tests/unit/render/test_render.cc +++ b/tests/unit/render/test_render.cc @@ -232,24 +232,23 @@ TEST_P(RenderTest, test_render_from_config_with_png) { uint64_t font_size = 50; std::string output_dir; + std::string output_file_stem = config["output"]["file_stem"].as(); // Render Render render = createRender(config, info, output_dir); std::filesystem::create_directories(output_dir); - auto object_jitter_dims_file = fmt::format("{}{}{}", output_dir, config_file.substr(0, config_file.size()-5), "jitter_dims.csv"); - if (std::filesystem::exists(object_jitter_dims_file)) { - render.setJitterDims(loadJitterDims(object_jitter_dims_file)); + auto object_jitter_dims_file_in = fmt::format("{}/tests/expected/{}/{}_{}", SRC_DIR, output_file_stem, output_file_stem, "jitter_dims.csv"); + auto object_jitter_dims_file_out = fmt::format("{}{}_{}", output_dir, output_file_stem, "jitter_dims.csv"); + if (std::filesystem::exists(object_jitter_dims_file_in)) { + render.setJitterDims(loadJitterDims(object_jitter_dims_file_in)); } else { - saveJitterDims(render.getJitterDims(), object_jitter_dims_file); + saveJitterDims(render.getJitterDims(), object_jitter_dims_file_out); } render.generate(font_size, win_size); - - // Check: that number of generated mesh files (*.vtp) correspond to the number of phases - std::string output_file_stem = config["output"]["file_stem"].as(); for (uint64_t i = 0; i