New feature to conveniently add a default material in a blank project when none exists.

This commit is contained in:
Dion Moult
2021-10-21 19:40:10 +11:00
parent a99df36351
commit 0bc849be5a
13 changed files with 54 additions and 11 deletions
@@ -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"
+12
View File
@@ -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")