Add some unhappy flow tests for rebuild

This commit is contained in:
Jaime van Kessel 2019-06-07 16:09:18 +02:00
parent 090b7ac225
commit 54740dd486
2 changed files with 23 additions and 1 deletions

View file

@ -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:

View file

@ -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