Fixed test after c34a9c5

Also fixed bug in the sheeter
This commit is contained in:
Andrej730
2023-10-19 16:06:33 +05:00
parent 219a5bbcf7
commit 6297afa04c
2 changed files with 21 additions and 4 deletions
@@ -160,7 +160,8 @@ class SheetBuilder:
x = float(image.attrib["x"])
y = float(image.attrib["y"])
if image.attrib["data-type"] == "view-title":
image.attrib["x"] = str(x - readjust.x)
image.attrib["x"] = str(x + readjust.x)
# negate y offset because view-title comes AFTER foreground
image.attrib["y"] = str(y - readjust.y)
else:
image.attrib["x"] = str(x + readjust.x)
+19 -3
View File
@@ -677,6 +677,13 @@ class TestDrawingMaintainingSheetPosition(NewFile):
ifc = tool.Ifc.get()
sheet_path = Path.cwd() / "layouts" / "A00 - UNTITLED.svg"
bpy.ops.mesh.primitive_cube_add(size=10, location=(0, 0, 4))
obj = bpy.data.objects["Cube"]
bpy.ops.bim.assign_class(ifc_class="IfcActuator", predefined_type="ELECTRICACTUATOR", userdefined_type="")
def update_depsgraph():
obj.hide_render = obj.hide_render # hacky way to trigger depsgraph_update_pre
bpy.ops.bim.load_sheets()
bpy.ops.bim.add_sheet()
@@ -694,12 +701,21 @@ class TestDrawingMaintainingSheetPosition(NewFile):
bpy.ops.bim.add_drawing_to_sheet()
bpy.ops.bim.open_sheet()
# uncomment if debugging
# without `sleep` `bim.open_sheet` tend to open sheet in browser
# with PLAN_VIEW.svg that will be created only later
# from time import sleep
# sleep(0.1)
# check drawing default position
drawing_data = self.get_sheet_drawing_data(sheet_path)
assert drawing_data["foreground"] == (30.0, 30.0, 500.0, 500.0)
assert drawing_data["view-title"] == (30.0, 535.0, 50.22, 10.0)
bpy.context.scene.camera.data.BIMCameraProperties.raster_x = 1200
bpy.context.scene.camera.data.BIMCameraProperties.width = 25
bpy.context.scene.camera.data.BIMCameraProperties.height = 25
update_depsgraph()
bpy.ops.bim.create_drawing()
bpy.ops.bim.open_sheet()
@@ -707,8 +723,8 @@ class TestDrawingMaintainingSheetPosition(NewFile):
# check drawing position on the sheet
drawing_data = self.get_sheet_drawing_data(sheet_path)
assert drawing_data["foreground"] == (30.0, 71.67, 500.0, 416.67)
assert drawing_data["view-title"] == (30.0, 493.33, 50.22, 10.0)
assert drawing_data["foreground"] == (155.0, 155.0, 250.0, 250.0)
assert drawing_data["view-title"] == (155.0, 410.0, 50.22, 10.0)
class TestUpdateTextValue(NewFile):