mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 08:45:22 +00:00
typing
This commit is contained in:
@@ -31,7 +31,7 @@ class TestImplementsTool(NewFile):
|
||||
|
||||
class TestClearEditingMode(NewFile):
|
||||
def test_run(self):
|
||||
props = bpy.context.scene.BIMLibraryProperties
|
||||
props = tool.Library.get_library_props()
|
||||
props.editing_mode = "LIBRARY"
|
||||
subject.clear_editing_mode()
|
||||
assert props.editing_mode == "NONE"
|
||||
@@ -78,7 +78,7 @@ class TestImportLibraryAttributes(NewFile):
|
||||
tool.Ifc.set(ifc := ifcopenshell.file())
|
||||
library = ifc.createIfcLibraryInformation("Name", "Version", None, "VersionDate", "Location", "Description")
|
||||
subject.import_library_attributes(library)
|
||||
props = bpy.context.scene.BIMLibraryProperties
|
||||
props = tool.Library.get_library_props()
|
||||
assert props.library_attributes.get("Name").string_value == "Name"
|
||||
assert props.library_attributes.get("Version").string_value == "Version"
|
||||
assert props.library_attributes.get("VersionDate").string_value == "VersionDate"
|
||||
@@ -91,7 +91,7 @@ class TestImportReferenceAttributes(NewFile):
|
||||
tool.Ifc.set(ifc := ifcopenshell.file())
|
||||
reference = ifc.createIfcLibraryReference("Location", "Identification", "Name", "Description", "Language")
|
||||
subject.import_reference_attributes(reference)
|
||||
props = bpy.context.scene.BIMLibraryProperties
|
||||
props = tool.Library.get_library_props()
|
||||
assert props.reference_attributes.get("Location").string_value == "Location"
|
||||
assert props.reference_attributes.get("Identification").string_value == "Identification"
|
||||
assert props.reference_attributes.get("Name").string_value == "Name"
|
||||
@@ -105,7 +105,7 @@ class TestImportReferences(NewFile):
|
||||
library = ifc.createIfcLibraryInformation()
|
||||
reference = ifc.createIfcLibraryReference(Name="Reference", ReferencedLibrary=library)
|
||||
subject.import_references(library)
|
||||
props = bpy.context.scene.BIMLibraryProperties
|
||||
props = tool.Library.get_library_props()
|
||||
assert props.references[0].ifc_definition_id == reference.id()
|
||||
assert props.references[0].name == "Reference"
|
||||
|
||||
@@ -116,7 +116,8 @@ class TestSetActiveLibrary(NewFile):
|
||||
tool.Ifc.set(ifc)
|
||||
library = ifc.createIfcLibraryInformation()
|
||||
subject.set_active_library(library)
|
||||
assert bpy.context.scene.BIMLibraryProperties.active_library_id == library.id()
|
||||
props = tool.Library.get_library_props()
|
||||
assert props.active_library_id == library.id()
|
||||
|
||||
|
||||
class TestSetActiveReference(NewFile):
|
||||
@@ -125,10 +126,12 @@ class TestSetActiveReference(NewFile):
|
||||
tool.Ifc.set(ifc)
|
||||
reference = ifc.createIfcLibraryReference()
|
||||
subject.set_active_reference(reference)
|
||||
assert bpy.context.scene.BIMLibraryProperties.active_reference_id == reference.id()
|
||||
props = tool.Library.get_library_props()
|
||||
assert props.active_reference_id == reference.id()
|
||||
|
||||
|
||||
class TestSetEditingMode(NewFile):
|
||||
def test_run(self):
|
||||
subject.set_editing_mode("LIBRARY")
|
||||
assert bpy.context.scene.BIMLibraryProperties.editing_mode == "LIBRARY"
|
||||
props = tool.Library.get_library_props()
|
||||
assert props.editing_mode == "LIBRARY"
|
||||
|
||||
@@ -35,25 +35,28 @@ class TestImplementsTool(NewFile):
|
||||
|
||||
class TestDisableEditingMaterials(NewFile):
|
||||
def test_run(self):
|
||||
bpy.context.scene.BIMMaterialProperties.is_editing = True
|
||||
props = tool.Material.get_material_props()
|
||||
props.is_editing = True
|
||||
subject.disable_editing_materials()
|
||||
assert bpy.context.scene.BIMMaterialProperties.is_editing is False
|
||||
assert props.is_editing is False
|
||||
|
||||
|
||||
class TestEnableEditingMaterials(NewFile):
|
||||
def test_run(self):
|
||||
bpy.context.scene.BIMMaterialProperties.is_editing = False
|
||||
props = tool.Material.get_material_props()
|
||||
props.is_editing = False
|
||||
subject.enable_editing_materials()
|
||||
assert bpy.context.scene.BIMMaterialProperties.is_editing is True
|
||||
assert props.is_editing is True
|
||||
|
||||
|
||||
class TestGetActiveMaterialType(NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.file()
|
||||
tool.Ifc.set(ifc)
|
||||
bpy.context.scene.BIMMaterialProperties.material_type = "IfcMaterial"
|
||||
props = tool.Material.get_material_props()
|
||||
props.material_type = "IfcMaterial"
|
||||
assert subject.get_active_material_type() == "IfcMaterial"
|
||||
bpy.context.scene.BIMMaterialProperties.material_type = "IfcMaterialLayerSet"
|
||||
props.material_type = "IfcMaterialLayerSet"
|
||||
assert subject.get_active_material_type() == "IfcMaterialLayerSet"
|
||||
|
||||
|
||||
@@ -73,7 +76,7 @@ class TestImportMaterialDefinitions(NewFile):
|
||||
tool.Ifc.set(ifc)
|
||||
material = ifc.createIfcMaterial(Name="Name", Category="Category")
|
||||
subject.import_material_definitions("IfcMaterial")
|
||||
props = bpy.context.scene.BIMMaterialProperties
|
||||
props = tool.Material.get_material_props()
|
||||
assert props.materials[0].ifc_definition_id == 0
|
||||
assert props.materials[0].name == "Category"
|
||||
assert props.materials[0].is_category is True
|
||||
@@ -85,7 +88,7 @@ class TestImportMaterialDefinitions(NewFile):
|
||||
tool.Ifc.set(ifc)
|
||||
material = ifc.createIfcMaterial(Name="Name", Category="Category")
|
||||
subject.import_material_definitions("IfcMaterial")
|
||||
props = bpy.context.scene.BIMMaterialProperties
|
||||
props = tool.Material.get_material_props()
|
||||
props.materials[0].is_expanded = True
|
||||
subject.import_material_definitions("IfcMaterial")
|
||||
assert len(props.materials) == 2
|
||||
@@ -98,7 +101,7 @@ class TestImportMaterialDefinitions(NewFile):
|
||||
tool.Ifc.set(ifc)
|
||||
material = ifc.createIfcMaterialLayerSet(LayerSetName="Name")
|
||||
subject.import_material_definitions("IfcMaterialLayerSet")
|
||||
props = bpy.context.scene.BIMMaterialProperties
|
||||
props = tool.Material.get_material_props()
|
||||
assert props.materials[0].ifc_definition_id == material.id()
|
||||
assert props.materials[0].name == "Name"
|
||||
assert props.materials[0].total_elements == 0
|
||||
@@ -108,7 +111,7 @@ class TestImportMaterialDefinitions(NewFile):
|
||||
tool.Ifc.set(ifc)
|
||||
material = ifc.createIfcMaterialProfileSet(Name="Name")
|
||||
subject.import_material_definitions("IfcMaterialProfileSet")
|
||||
props = bpy.context.scene.BIMMaterialProperties
|
||||
props = tool.Material.get_material_props()
|
||||
assert props.materials[0].ifc_definition_id == material.id()
|
||||
assert props.materials[0].name == "Name"
|
||||
assert props.materials[0].total_elements == 0
|
||||
@@ -118,7 +121,7 @@ class TestImportMaterialDefinitions(NewFile):
|
||||
tool.Ifc.set(ifc)
|
||||
material = ifc.createIfcMaterialConstituentSet(Name="Name")
|
||||
subject.import_material_definitions("IfcMaterialConstituentSet")
|
||||
props = bpy.context.scene.BIMMaterialProperties
|
||||
props = tool.Material.get_material_props()
|
||||
assert props.materials[0].ifc_definition_id == material.id()
|
||||
assert props.materials[0].name == "Name"
|
||||
assert props.materials[0].total_elements == 0
|
||||
@@ -128,7 +131,7 @@ class TestImportMaterialDefinitions(NewFile):
|
||||
tool.Ifc.set(ifc)
|
||||
material = ifc.createIfcMaterialList()
|
||||
subject.import_material_definitions("IfcMaterialList")
|
||||
props = bpy.context.scene.BIMMaterialProperties
|
||||
props = tool.Material.get_material_props()
|
||||
assert props.materials[0].ifc_definition_id == material.id()
|
||||
assert props.materials[0].name == "Unnamed"
|
||||
assert props.materials[0].total_elements == 0
|
||||
@@ -136,9 +139,10 @@ class TestImportMaterialDefinitions(NewFile):
|
||||
|
||||
class TestIsEditingMaterials(NewFile):
|
||||
def test_run(self):
|
||||
bpy.context.scene.BIMMaterialProperties.is_editing = False
|
||||
props = tool.Material.get_material_props()
|
||||
props.is_editing = False
|
||||
assert subject.is_editing_materials() is False
|
||||
bpy.context.scene.BIMMaterialProperties.is_editing = True
|
||||
props.is_editing = True
|
||||
assert subject.is_editing_materials() is True
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user