Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAras Pranckevicius <aras@nesnausk.org>2022-04-08 15:08:50 +0300
committerFabian Schempp <fabianschempp@googlemail.com>2022-04-11 01:32:00 +0300
commit740a721deac4ec595f668087c82da73019ea7fdb (patch)
tree99fc9712be707d5060045c9ba2b637c4b6fb34f5 /source
parent133fa9cb7fa371c322d3c907b78254a48d26f940 (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')
-rw-r--r--source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc28
-rw-r--r--source/blender/io/wavefront_obj/tests/obj_importer_tests.cc8
2 files changed, 14 insertions, 22 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 99e9543a461..61699c78ace 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 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. */
diff --git a/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc b/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc
index 0a70a03dc65..9dd9e7c1a37 100644
--- a/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc
+++ b/source/blender/io/wavefront_obj/tests/obj_importer_tests.cc
@@ -387,15 +387,15 @@ TEST_F(obj_importer_test, import_all_objects)
float3(28, 1, -1),
float3(26, 1, 1),
float3(-1, 0, 0)},
- {"OBSubSurfCube",
+ {"OBTaperCube",
OB_MESH,
106,
208,
104,
416,
- float3(24.444445f, 0.444444f, -0.666667f),
- float3(23.790743f, 0.490725f, -0.816819f),
- float3(0.1697f, 0.1697f, 0.9708f)},
+ float3(24.444445f, 0.502543f, -0.753814f),
+ float3(23.790743f, 0.460522f, -0.766546f),
+ float3(-0.0546f, 0.1716f, 0.9837f)},
{"OBParticleCube",
OB_MESH,
8,