diff options
author | Aras Pranckevicius <aras@nesnausk.org> | 2022-04-08 15:08:50 +0300 |
---|---|---|
committer | Aras Pranckevicius <aras@nesnausk.org> | 2022-04-08 15:09:22 +0300 |
commit | 9439ac41eb5dd11397cd9ff4d0379dd49b2c2194 (patch) | |
tree | b8d4658d8d19ca497636c65671252338e2b04055 /source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc | |
parent | aa1e8bb9ab925a436fd832bdb958bef8dbcf3164 (diff) |
I/O tests: change all_geometry scene to not have subd surface, and always print obj failure output diff details
The all_objects.blend test scene (in subversion tests repo) contained an
object with a subdivision surface. Which changes vertex positions
slightly, depending on used OpenSubDiv version and the compile flags. It
seems that the intent of the test was "test export of meshes that use
modifiers", so I changed that object to be a cube with a simple "taper"
modifier instead.
While at it, changed OBJ exporter test code to always print the
"expected and what we got" text difference details, when a test fails.
Much easier to see than just "the files are different" output. The code
to print that was behind an off by default flag for some reason.
This diff should get comitted together with updated all_objects templates
in subversion tests repo.
Reviewed By: Sebastian Parborg
Differential Revision: https://developer.blender.org/D14597
Diffstat (limited to 'source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc')
-rw-r--r-- | source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc index a3512595fa7..8599b38d55b 100644 --- a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc +++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc @@ -273,34 +273,26 @@ parm u 0.0 /* Return true if string #a and string #b are equal after their first newline. */ static bool strings_equal_after_first_lines(const std::string &a, const std::string &b) { - /* If `dbg_level` is true then a failing test will print context around the first mismatch. */ - const bool dbg_level = false; const size_t a_len = a.size(); const size_t b_len = b.size(); const size_t a_next = a.find_first_of('\n'); const size_t b_next = b.find_first_of('\n'); if (a_next == std::string::npos || b_next == std::string::npos) { - if (dbg_level) { - std::cout << "Couldn't find newline in one of args\n"; - } + std::cout << "Couldn't find newline in one of args\n"; return false; } - if (dbg_level) { - if (a.compare(a_next, a_len - a_next, b, b_next, b_len - b_next) != 0) { - for (int i = 0; i < a_len - a_next && i < b_len - b_next; ++i) { - if (a[a_next + i] != b[b_next + i]) { - std::cout << "Difference found at pos " << a_next + i << " of a\n"; - std::cout << "a: " << a.substr(a_next + i, 100) << " ...\n"; - std::cout << "b: " << b.substr(b_next + i, 100) << " ... \n"; - return false; - } + if (a.compare(a_next, a_len - a_next, b, b_next, b_len - b_next) != 0) { + for (int i = 0; i < a_len - a_next && i < b_len - b_next; ++i) { + if (a[a_next + i] != b[b_next + i]) { + std::cout << "Difference found at pos " << a_next + i << " of a\n"; + std::cout << "a: " << a.substr(a_next + i, 100) << " ...\n"; + std::cout << "b: " << b.substr(b_next + i, 100) << " ... \n"; + return false; } } - else { - return true; - } + return false; } - return a.compare(a_next, a_len - a_next, b, b_next, b_len - b_next) == 0; + return true; } /* From here on, tests are whole file tests, testing for golden output. */ |