From ebe892a4656fa28d8389baaddc0b4a7d49f40f3e Mon Sep 17 00:00:00 2001 From: NiJingzhe <1448976235@qq.com> Date: Thu, 29 Oct 2026 02:05:58 +0800 Subject: [PATCH] test: restore test_rearchitecture_2_0_kernel_builders; record the old tests that do not apply The file was deleted by the C++ port; its 5 tests pass on native (one is in the known-failures list as an internal). DEVIATIONS.md lists the old tests of the removed VTK render pipeline and of the py-slvs default, each with the reason. Co-Authored-By: Claude Sonnet 5.5 --- src/cpp/docs/DEVIATIONS.md | 12 ++++ ...test_rearchitecture_2_0_kernel_builders.py | 62 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 test/test_rearchitecture_2_0_kernel_builders.py diff --git a/src/cpp/docs/DEVIATIONS.md b/src/cpp/docs/DEVIATIONS.md index 8505a5d1..ccd3f8fd 100644 --- a/src/cpp/docs/DEVIATIONS.md +++ b/src/cpp/docs/DEVIATIONS.md @@ -131,3 +131,15 @@ id, a 36-char rule id, an evidence Value: about 700 B per binding, 36 bindings p * The geometry-interface bounds of solids, shells and wires are the union of their faces' / edges' boxes (bitwise equal to `AddOptimal` on the whole shape on every arm6 shape); the fingerprint is memoised per OCCT shape identity. Neither changes a hash. + +## Old tests that do not run on the native build (and why) + +Each is a test of something 2.2.7b1 removed on purpose, not of behaviour a user can see. Listed here so that a missing +test is a decision on record, not a gap. + +| Old test | Why it does not apply | +|---|---| +| `tests/test_render_supersample.py` (2 tests) | patches `inspect.brep.render._write_window`, a VTK window writer; VTK is gone (the soft renderer supersamples in `render_scene(supersample=)`, covered by `tests/python/test_render_*`) | +| `test_inspect_brep_queries.py::test_render_worker_retries_crash_and_requires_clean_exit` | tests the crash-isolated VTK render worker subprocess and its retry policy; the soft renderer runs in-process | +| `test_render_screenshot_multiview.py` (3 tests: `..._grid_engine`, `..._multiview_engine_with_annotations`) | tests the routing between the VTK single-view engine and the grid engine; there is one engine | +| `test_sketch_api.py::...default_solver_backend_is_py_slvs...` (in `test/native_known_failures.json`) | the default sketch solver backend is `scad-native`; py-slvs (GPL) is not linked. A user-visible difference: the backend name in a sketch snapshot. See `sketch-solver.md` | diff --git a/test/test_rearchitecture_2_0_kernel_builders.py b/test/test_rearchitecture_2_0_kernel_builders.py new file mode 100644 index 00000000..f5eca768 --- /dev/null +++ b/test/test_rearchitecture_2_0_kernel_builders.py @@ -0,0 +1,62 @@ +"""TDD coverage for the OCP-native primitive solid slice.""" + +from __future__ import annotations + +import unittest +import simplecadapi as scad + + +class TestOcpPrimitiveBuilders(unittest.TestCase): + def test_kernel_ocp_builders_module_exposes_core_solid_builders(self): + from simplecadapi.kernel.ocp_builders import ( + make_box_solid, + make_cone_solid, + make_cylinder_solid, + make_sphere_solid, + ) + + box = scad.Solid(make_box_solid((0.0, 0.0, 0.0), 1.0, 2.0, 3.0)) + cylinder = scad.Solid( + make_cylinder_solid((0.0, 0.0, 0.0), (0.0, 0.0, 1.0), 1.0, 2.0) + ) + cone = scad.Solid( + make_cone_solid((0.0, 0.0, 0.0), (0.0, 0.0, 1.0), 1.0, 0.5, 2.0) + ) + sphere = scad.Solid(make_sphere_solid((1.0, 2.0, 3.0), 1.5)) + + self.assertAlmostEqual(box.get_volume(), 6.0, places=5) + self.assertGreater(cylinder.get_volume(), 0.0) + self.assertGreater(cone.get_volume(), 0.0) + self.assertGreater(sphere.get_volume(), 0.0) + + def test_make_box_rsolid_uses_ocp_wrapped_storage(self): + solid = scad.make_box_rsolid(1.0, 2.0, 3.0) + self.assertIsInstance(solid, scad.Solid) + self.assertTrue(hasattr(solid, "wrapped")) + self.assertFalse(hasattr(solid, "cq_solid")) + self.assertAlmostEqual(solid.get_volume(), 6.0, places=5) + + def test_make_cylinder_rsolid_uses_ocp_wrapped_storage(self): + solid = scad.make_cylinder_rsolid(1.0, 2.0) + self.assertIsInstance(solid, scad.Solid) + self.assertTrue(hasattr(solid, "wrapped")) + self.assertFalse(hasattr(solid, "cq_solid")) + self.assertGreater(solid.get_volume(), 0.0) + + def test_make_cone_rsolid_uses_ocp_wrapped_storage(self): + solid = scad.make_cone_rsolid(1.0, 2.0, top_radius=0.5) + self.assertIsInstance(solid, scad.Solid) + self.assertTrue(hasattr(solid, "wrapped")) + self.assertFalse(hasattr(solid, "cq_solid")) + self.assertGreater(solid.get_volume(), 0.0) + + def test_make_sphere_rsolid_uses_ocp_wrapped_storage(self): + solid = scad.make_sphere_rsolid(1.5, center=(1.0, 2.0, 3.0)) + self.assertIsInstance(solid, scad.Solid) + self.assertTrue(hasattr(solid, "wrapped")) + self.assertFalse(hasattr(solid, "cq_solid")) + self.assertGreater(solid.get_volume(), 0.0) + + +if __name__ == "__main__": + unittest.main()