diff --git a/tests/libslic3r/test_indexed_triangle_set.cpp b/tests/libslic3r/test_indexed_triangle_set.cpp index bbb22e778c..7e2d511c77 100644 --- a/tests/libslic3r/test_indexed_triangle_set.cpp +++ b/tests/libslic3r/test_indexed_triangle_set.cpp @@ -279,14 +279,23 @@ TEST_CASE("Simplify mesh by Quadric edge collapse to 5%", "[its]") CHECK(is_similar(its, mesh.its, cfg)); } +bool exist_triangle_with_twice_vertices(const std::vector& indices) +{ + for (const auto &face : indices) + if (face[0] == face[1] || + face[0] == face[2] || + face[1] == face[2]) return true; + return false; +} + TEST_CASE("Simplify trouble case", "[its]") { TriangleMesh tm = load_model("simplification.obj"); REQUIRE_FALSE(tm.empty()); float max_error = std::numeric_limits::max(); - uint32_t wanted_count = 8; + uint32_t wanted_count = 0; its_quadric_edge_collapse(tm.its, wanted_count, &max_error); - CHECK(tm.its.indices.size() <= 8); + CHECK(!exist_triangle_with_twice_vertices(tm.its.indices)); } TEST_CASE("Simplified cube should not be empty.", "[its]")