mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
New feature to conveniently add a default material in a blank project when none exists.
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
@material
|
||||
Feature: Material
|
||||
|
||||
Scenario: Add default material
|
||||
Given an empty IFC project
|
||||
When I press "bim.add_default_material"
|
||||
Then the material "Default" exists
|
||||
|
||||
Scenario: Unlink object
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
|
||||
@@ -24,3 +24,11 @@ class TestUnlinkMaterial:
|
||||
def test_run(self, material):
|
||||
material.unlink("obj").should_be_called()
|
||||
subject.unlink_material(material, obj="obj")
|
||||
|
||||
|
||||
class TestAddDefaultMaterial:
|
||||
def test_run(self, ifc, material):
|
||||
material.add_default_material_object().should_be_called().will_return("obj")
|
||||
ifc.run("material.add_material", name="Default").should_be_called().will_return("material")
|
||||
material.link("material", "obj").should_be_called()
|
||||
assert subject.add_default_material(ifc, material) == "obj"
|
||||
|
||||
@@ -24,6 +24,18 @@ from test.bim.bootstrap import NewFile
|
||||
from blenderbim.tool.material import Material as subject
|
||||
|
||||
|
||||
class TestImplementsTool(NewFile):
|
||||
def test_run(self):
|
||||
assert isinstance(subject(), blenderbim.core.tool.Material)
|
||||
|
||||
|
||||
class TestAddDefaultMaterialObject(NewFile):
|
||||
def test_run(self):
|
||||
material = subject.add_default_material_object()
|
||||
assert isinstance(material, bpy.types.Material)
|
||||
assert material.name == "Default"
|
||||
|
||||
|
||||
class TestLink(NewFile):
|
||||
def test_run(self):
|
||||
obj = bpy.data.materials.new("Material")
|
||||
|
||||
Reference in New Issue
Block a user