test for tool.Blender.copy_node_graph #3876

This commit is contained in:
Andrej730
2023-12-08 16:57:05 +05:00
parent f9fef4f5f6
commit cabc06821f
2 changed files with 30 additions and 1 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ VIEWPORT_ATTRIBUTES = [
]
class Blender:
class Blender(blenderbim.core.tool.Blender):
OBJECT_TYPES_THAT_SUPPORT_EDIT_MODE = ("MESH", "CURVE", "SURFACE", "META", "FONT", "LATTICE", "ARMATURE")
OBJECT_TYPES_THAT_SUPPORT_EDIT_GPENCIL_MODE = ("GPENCIL",)
+29
View File
@@ -15,3 +15,32 @@
#
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import ifcopenshell
import blenderbim.core.tool
import blenderbim.tool as tool
from test.bim.bootstrap import NewFile
from blenderbim.tool.blender import Blender as subject
class TestImplementsTool(NewFile):
def test_run(self):
assert isinstance(subject(), blenderbim.core.tool.Blender)
class TestCopyNodeGraph(NewFile):
def test_run(self):
material_to = bpy.data.materials.new("material_to")
material_to.use_nodes = True
material_to_nodes = material_to.node_tree.nodes
assert len(material_to_nodes) == 2
for node in material_to_nodes:
material_to_nodes.remove(node)
assert len(material_to_nodes) == 0
material_from = bpy.data.materials.new("material_from")
material_from.use_nodes = True
subject.copy_node_graph(material_to, material_from)
assert len(material_to_nodes) == 2