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
diff options
context:
space:
mode:
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.cc95
1 files changed, 34 insertions, 61 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 8599b38d55b..f74bfc155dd 100644
--- a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
+++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.cc
@@ -48,7 +48,6 @@ class obj_exporter_test : public BlendfileLoadingBaseTest {
};
const std::string all_objects_file = "io_tests/blend_scene/all_objects.blend";
-const std::string all_curve_objects_file = "io_tests/blend_scene/all_curves.blend";
TEST_F(obj_exporter_test, filter_objects_curves_as_mesh)
{
@@ -58,7 +57,7 @@ TEST_F(obj_exporter_test, filter_objects_curves_as_mesh)
return;
}
auto [objmeshes, objcurves]{filter_supported_objects(depsgraph, _export.params)};
- EXPECT_EQ(objmeshes.size(), 19);
+ EXPECT_EQ(objmeshes.size(), 20);
EXPECT_EQ(objcurves.size(), 0);
}
@@ -72,7 +71,7 @@ TEST_F(obj_exporter_test, filter_objects_curves_as_nurbs)
_export.params.export_curves_as_nurbs = true;
auto [objmeshes, objcurves]{filter_supported_objects(depsgraph, _export.params)};
EXPECT_EQ(objmeshes.size(), 18);
- EXPECT_EQ(objcurves.size(), 2);
+ EXPECT_EQ(objcurves.size(), 3);
}
TEST_F(obj_exporter_test, filter_objects_selected)
@@ -111,64 +110,6 @@ TEST(obj_exporter_utils, append_positive_frame_to_filename)
EXPECT_EQ_ARRAY(path_with_frame, path_truth, BLI_strlen_utf8(path_truth));
}
-TEST_F(obj_exporter_test, curve_nurbs_points)
-{
- if (!load_file_and_depsgraph(all_curve_objects_file)) {
- ADD_FAILURE();
- return;
- }
-
- OBJExportParamsDefault _export;
- _export.params.export_curves_as_nurbs = true;
- auto [objmeshes_unused, objcurves]{filter_supported_objects(depsgraph, _export.params)};
-
- for (auto &objcurve : objcurves) {
- if (all_nurbs_truth.count(objcurve->get_curve_name()) != 1) {
- ADD_FAILURE();
- return;
- }
- const NurbsObject *const nurbs_truth = all_nurbs_truth.at(objcurve->get_curve_name()).get();
- EXPECT_EQ(objcurve->total_splines(), nurbs_truth->total_splines());
- for (int spline_index : IndexRange(objcurve->total_splines())) {
- EXPECT_EQ(objcurve->total_spline_vertices(spline_index),
- nurbs_truth->total_spline_vertices(spline_index));
- EXPECT_EQ(objcurve->get_nurbs_degree(spline_index),
- nurbs_truth->get_nurbs_degree(spline_index));
- EXPECT_EQ(objcurve->total_spline_control_points(spline_index),
- nurbs_truth->total_spline_control_points(spline_index));
- }
- }
-}
-
-TEST_F(obj_exporter_test, curve_coordinates)
-{
- if (!load_file_and_depsgraph(all_curve_objects_file)) {
- ADD_FAILURE();
- return;
- }
-
- OBJExportParamsDefault _export;
- _export.params.export_curves_as_nurbs = true;
- auto [objmeshes_unused, objcurves]{filter_supported_objects(depsgraph, _export.params)};
-
- for (auto &objcurve : objcurves) {
- if (all_nurbs_truth.count(objcurve->get_curve_name()) != 1) {
- ADD_FAILURE();
- return;
- }
- const NurbsObject *const nurbs_truth = all_nurbs_truth.at(objcurve->get_curve_name()).get();
- EXPECT_EQ(objcurve->total_splines(), nurbs_truth->total_splines());
- for (int spline_index : IndexRange(objcurve->total_splines())) {
- for (int vertex_index : IndexRange(objcurve->total_spline_vertices(spline_index))) {
- EXPECT_V3_NEAR(objcurve->vertex_coordinates(
- spline_index, vertex_index, _export.params.scaling_factor),
- nurbs_truth->vertex_coordinates(spline_index, vertex_index),
- 0.000001f);
- }
- }
- }
-}
-
static std::unique_ptr<OBJWriter> init_writer(const OBJExportParams &params,
const std::string out_filepath)
{
@@ -467,6 +408,19 @@ TEST_F(obj_exporter_regression_test, cube_normal_edit)
_export.params);
}
+TEST_F(obj_exporter_regression_test, cube_vertex_groups)
+{
+ OBJExportParamsDefault _export;
+ _export.params.export_materials = false;
+ _export.params.export_normals = false;
+ _export.params.export_uv = false;
+ _export.params.export_vertex_groups = true;
+ compare_obj_export_to_golden("io_tests/blend_geometry/cube_vertex_groups.blend",
+ "io_tests/obj/cube_vertex_groups.obj",
+ "",
+ _export.params);
+}
+
TEST_F(obj_exporter_regression_test, cubes_positioned)
{
OBJExportParamsDefault _export;
@@ -504,6 +458,25 @@ TEST_F(obj_exporter_regression_test, suzanne_all_data)
_export.params);
}
+TEST_F(obj_exporter_regression_test, all_curves)
+{
+ OBJExportParamsDefault _export;
+ _export.params.export_materials = false;
+ compare_obj_export_to_golden(
+ "io_tests/blend_scene/all_curves.blend", "io_tests/obj/all_curves.obj", "", _export.params);
+}
+
+TEST_F(obj_exporter_regression_test, all_curves_as_nurbs)
+{
+ OBJExportParamsDefault _export;
+ _export.params.export_materials = false;
+ _export.params.export_curves_as_nurbs = true;
+ compare_obj_export_to_golden("io_tests/blend_scene/all_curves.blend",
+ "io_tests/obj/all_curves_as_nurbs.obj",
+ "",
+ _export.params);
+}
+
TEST_F(obj_exporter_regression_test, all_objects)
{
OBJExportParamsDefault _export;