Page MenuHome

Autotests for nodes API and node editor operators
Needs ReviewPublic

Authored by Maxim Vasiliev (qmax) on Dec 16 2019, 10:49 PM.
This revision needs review, but there are no reviewers specified.

Details

Summary

The tests cover new/remove api for nodes and nodetrees and some operators of creating/deleting/copying nodes/groups/materials.
The tests check availability of affected nodes/trees, methods init, copy, free being called, and resulting user counters for trees.

Operation 'make single user' is not covered, because it's not accessible from python.
Calling to 'update' is not checked, because it's purpose is not quite clear.

Tests are modeled for 2 kinds of nodes: simple node just creates nodetree in init and do not care about it further, complex node creates/duplicates/deletes its nodetree.

Diff Detail

Event Timeline

Fixed op_material_clone and op_material_copypaste

@Jacques Lucke (JacquesLucke) does that conflict with any of the work you are doing in the nodes branch?

Also adding Brecht as cc although he won't be able to see this until mid January or so. But I know he has a very specific view on how we should handle these unittests, how granular they should be, ...

This does not seem to conflict with anything I've done yet.

For copypaste scenario assumtion is based on add-on developer's logic: api method copy is called when node is copied and the argument is a real source node being copied.

The logic of api is inverse: the copy should be called when destination (self) is a real node. This quite makes sense, although in this case the argument is some unlinked structure in clipboard.

Changed checks of calls to copy to fit API logic.

@Miguel Porces (cmporces), the node copypasting case that you have mentioned is covered by the tests, and they pass.
Am I doing something wrong?

Removed excessive nested node checks, sanity checks.

Made asserts to check all the nodes/trees to do not miss anything, and for more clear fail reports.

Refactored assertions to check total calls.

Maxim Vasiliev (qmax) edited the summary of this revision. (Show Details)

Fixed ungrouping test again.
the copy api chould be called and/or user counters incremented.

Added tests for ID.copy applied to a tree, Nodes.clear and BlendDataNodeTrees.remove

I'm sorry for flooding in mail. This is the last update in this year.