mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-20 05:07:50 -06:00
Add boundingbox test for buildvolume
This commit is contained in:
parent
6136f5a2f2
commit
db3d6aae83
1 changed files with 21 additions and 2 deletions
|
@ -1,9 +1,9 @@
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
from UM.Math.AxisAlignedBox import AxisAlignedBox
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from UM.Math.Polygon import Polygon
|
from UM.Math.Polygon import Polygon
|
||||||
from UM.Settings.SettingInstance import InstanceState
|
from UM.Math.Vector import Vector
|
||||||
from cura.BuildVolume import BuildVolume, PRIME_CLEARANCE
|
from cura.BuildVolume import BuildVolume, PRIME_CLEARANCE
|
||||||
import numpy
|
import numpy
|
||||||
|
|
||||||
|
@ -304,6 +304,25 @@ class TestRebuild:
|
||||||
build_volume.rebuild()
|
build_volume.rebuild()
|
||||||
assert build_volume.getMeshData() is None
|
assert build_volume.getMeshData() is None
|
||||||
|
|
||||||
|
def test_updateBoundingBox(self, build_volume: BuildVolume):
|
||||||
|
build_volume.setWidth(10)
|
||||||
|
build_volume.setHeight(10)
|
||||||
|
build_volume.setDepth(10)
|
||||||
|
|
||||||
|
mocked_global_stack = MagicMock()
|
||||||
|
build_volume._global_container_stack = mocked_global_stack
|
||||||
|
build_volume.getEdgeDisallowedSize = MagicMock(return_value = 0)
|
||||||
|
build_volume.updateNodeBoundaryCheck = MagicMock()
|
||||||
|
|
||||||
|
# Fake the the "engine is created callback"
|
||||||
|
build_volume._onEngineCreated()
|
||||||
|
build_volume.rebuild()
|
||||||
|
|
||||||
|
bounding_box = build_volume.getBoundingBox()
|
||||||
|
assert bounding_box.minimum == Vector(-5.0, -1.0, -5.0)
|
||||||
|
assert bounding_box.maximum == Vector(5.0, 10.0, 5.0)
|
||||||
|
|
||||||
|
|
||||||
class TestUpdateMachineSizeProperties:
|
class TestUpdateMachineSizeProperties:
|
||||||
setting_property_dict = {"machine_width": {"value": 50},
|
setting_property_dict = {"machine_width": {"value": 50},
|
||||||
"machine_depth": {"value": 100},
|
"machine_depth": {"value": 100},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue