From bbadcf57b2bf5b55ee11f3d4eef0883d9158a817 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 16 Aug 2022 11:09:24 +0200 Subject: [PATCH] Fixed memory leaks in libslic3r_tests --- tests/libslic3r/test_arachne.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/libslic3r/test_arachne.cpp b/tests/libslic3r/test_arachne.cpp index a675c8f72..e952695e9 100644 --- a/tests/libslic3r/test_arachne.cpp +++ b/tests/libslic3r/test_arachne.cpp @@ -109,9 +109,10 @@ TEST_CASE("Arachne - #8593 - Missing a part of the extrusion", "[ArachneMissingP coord_t inset_count = 3; PrintObjectConfig print_object_config = PrintObjectConfig::defaults(); - print_object_config.min_bead_width.set(new ConfigOptionFloatOrPercent(0.315, false)); - print_object_config.wall_transition_angle.set(new ConfigOptionFloat(40.)); - print_object_config.wall_transition_length.set(new ConfigOptionFloatOrPercent(1., false)); + print_object_config.min_bead_width = ConfigOptionFloatOrPercent(0.315, false); + print_object_config.wall_transition_angle = ConfigOptionFloat(40.); + print_object_config.wall_transition_length = ConfigOptionFloatOrPercent(1., false); + // This behavior seems to be related to the rotation of the input polygon. // There are specific angles in which this behavior is always triggered. @@ -155,7 +156,7 @@ TEST_CASE("Arachne - #8573 - A gap in the perimeter - 1", "[ArachneGapInPerimete coord_t inset_count = 2; PrintObjectConfig print_object_config = PrintObjectConfig::defaults(); -// print_object_config.wall_transition_angle.set(new ConfigOptionFloat(20.)); +// print_object_config.wall_transition_angle = ConfigOptionFloat(20.); Arachne::WallToolPaths wallToolPaths(polygons, spacing, spacing, inset_count, 0, 0.2, print_object_config, PrintConfig::defaults()); wallToolPaths.generate(); @@ -198,7 +199,7 @@ TEST_CASE("Arachne - #8444 - A gap in the perimeter - 2", "[ArachneGapInPerimete coord_t inset_count = 2; PrintObjectConfig print_object_config = PrintObjectConfig::defaults(); - // print_object_config.wall_transition_angle.set(new ConfigOptionFloat(20.)); + // print_object_config.wall_transition_angle = ConfigOptionFloat(20.); Arachne::WallToolPaths wallToolPaths(polygons, spacing, spacing, inset_count, 0, 0.4, print_object_config, PrintConfig::defaults()); wallToolPaths.generate(); @@ -237,10 +238,10 @@ TEST_CASE("Arachne - #8528 - A hole when number of perimeters is changing", "[Ar coord_t inset_count = 5; PrintObjectConfig print_object_config = PrintObjectConfig::defaults(); - print_object_config.min_bead_width.set(new ConfigOptionFloatOrPercent(0.68, false)); + print_object_config.min_bead_width = ConfigOptionFloatOrPercent(0.68, false); // Changing min_bead_width to 0.66 seems that resolve this issue, at least in this case. - print_object_config.min_bead_width.set(new ConfigOptionFloatOrPercent(0.66, false)); + print_object_config.min_bead_width = ConfigOptionFloatOrPercent(0.66, false); Arachne::WallToolPaths wallToolPaths(polygons, spacing, spacing, inset_count, 0, 0.4, print_object_config, PrintConfig::defaults()); wallToolPaths.generate(); @@ -363,9 +364,9 @@ TEST_CASE("Arachne - #8633 - Shorter open perimeter", "[ArachneShorterOpenPerime coord_t inset_count = 1; PrintObjectConfig print_object_config = PrintObjectConfig::defaults(); - print_object_config.min_bead_width.set(new ConfigOptionFloatOrPercent(0.51, false)); - print_object_config.min_feature_size.set(new ConfigOptionFloatOrPercent(0.15, false)); - print_object_config.wall_transition_length.set(new ConfigOptionFloatOrPercent(0.6, false)); + print_object_config.min_bead_width = ConfigOptionFloatOrPercent(0.51, false); + print_object_config.min_feature_size = ConfigOptionFloatOrPercent(0.15, false); + print_object_config.wall_transition_length = ConfigOptionFloatOrPercent(0.6, false); for (size_t poly_idx = 0; poly_idx < polygons.size(); ++poly_idx) { Polygons input_polygons{polygons[poly_idx]}; @@ -412,4 +413,4 @@ TEST_CASE("Arachne - #8597 - removeSmallAreas", "[ArachneRemoveSmallAreas8597]") #endif REQUIRE(perimeters.size() == 1); -} \ No newline at end of file +}