diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index 1f60e32a45..b077d100ba 100755 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -478,7 +478,6 @@ class BuildVolume(SceneNode): self._disallowed_area_size = max(size, self._disallowed_area_size) return mb.build() - ## Recalculates the build volume & disallowed areas. def rebuild(self) -> None: if not self._width or not self._height or not self._depth: diff --git a/tests/TestBuildVolume.py b/tests/TestBuildVolume.py index faae22dfad..59b94d0c6a 100644 --- a/tests/TestBuildVolume.py +++ b/tests/TestBuildVolume.py @@ -140,3 +140,26 @@ class TestComputeDisallowedAreasPrimeBlob: # In the The translation result is 25, -50 (due to the settings used) resulting_polygon = resulting_polygon.translate(25, -50) assert build_volume._computeDisallowedAreasPrimeBlob(12, [mocked_extruder_stack]) == {"0": [resulting_polygon]} + + +class TestRebuild: + def test_zeroWidthHeightDepth(self, build_volume: BuildVolume): + build_volume.rebuild() + assert build_volume.getMeshData() is None + + def test_engineIsNotRead(self, build_volume: BuildVolume): + build_volume.setWidth(10) + build_volume.setHeight(10) + build_volume.setDepth(10) + build_volume.rebuild() + assert build_volume.getMeshData() is None + + def test_noGlobalStack(self, build_volume: BuildVolume): + build_volume.setWidth(10) + build_volume.setHeight(10) + build_volume.setDepth(10) + # Fake the the "engine is created callback" + build_volume._onEngineCreated() + build_volume.rebuild() + assert build_volume.getMeshData() is None +