Example #1
0
File: tests.py Project: theodox/sfx
 def test_connect(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     target = new_network.find_by_name('TotalAmbientAndOpacity')[0]
     new_network.connect(new_node, new_node.outputs.rgb, target, target.inputs.xyz)
     connections = new_network.get_inputs(target)
     assert new_node in connections.values()
Example #2
0
    def test_properties_dict(self):
        new_network = SFXNetwork.create('example')
        new_node = new_network.add(sfxnodes.Color, 'added')
        props = new_node.properties
        expected = {
            u'uigroup': 'string',
            u'socketdefaultvalue': 'string',
            u'semantic': 'string',
            u'color': 'float4',
            u'global': 'bool',
            u'activesocketlabel': 'string',
            u'compoundassignment': 'bool',
            u'exposetoui': 'bool',
            u'defineinheader': 'bool',
            u'group': 'int',
            u'uiorder': 'int',
            u'note': 'string',
            u'width': 'int',
            u'version': 'float',
            u'hasbeenedited': 'bool',
            u'collapsed': 'bool',
            u'helpaction': 'action',
            u'posx': 'float',
            u'posy': 'float',
            u'previewswatch': 'int',
            u'name': 'string',
            u'activesocket': 'int',
            u'socketswizzlevalue': 'string'
        }

        for k, v in props.items():
            assert expected[k] == v
Example #3
0
 def test_connect(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     target = new_network.find_by_name('TotalAmbientAndOpacity')[0]
     new_network.connect(new_node, new_node.outputs.rgb, target,
                         target.inputs.xyz)
     connections = new_network.get_inputs(target)
     assert new_node in connections.values()
Example #4
0
File: tests.py Project: theodox/sfx
    def test_properties_dict(self):
        new_network = SFXNetwork.create('example')
        new_node = new_network.add(sfxnodes.Color, 'added')
        props = new_node.properties
        expected = {u'uigroup': 'string', u'socketdefaultvalue': 'string', u'semantic': 'string', u'color': 'float4',
                    u'global': 'bool', u'activesocketlabel': 'string', u'compoundassignment': 'bool',
                    u'exposetoui': 'bool', u'defineinheader': 'bool', u'group': 'int', u'uiorder': 'int',
                    u'note': 'string', u'width': 'int', u'version': 'float', u'hasbeenedited': 'bool',
                    u'collapsed': 'bool', u'helpaction': 'action', u'posx': 'float', u'posy': 'float',
                    u'previewswatch': 'int', u'name': 'string', u'activesocket': 'int', u'socketswizzlevalue': 'string'}

        for k, v in props.items():
            assert expected[k] == v
Example #5
0
 def test_asserts_on_bad_property(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     example = lambda: new_node.fred
     self.assertRaises(SFXPropertyNotFound, example)
Example #6
0
 def test_properties_setter_1(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     new_node.uiorder = 10
     assert new_node.uiorder == 10
Example #7
0
 def test_cmd(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     result = new_node.cmd(help=True)
Example #8
0
File: tests.py Project: theodox/sfx
 def test_properties_setter_1(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     new_node.uiorder = 10
     assert new_node.uiorder == 10
Example #9
0
File: tests.py Project: theodox/sfx
 def test_sfx_create(self):
     new_network = SFXNetwork.create('example')
     assert cmds.ls('example') == ['example']
     assert cmds.nodeType('example') == 'ShaderfxShader'
     assert new_network.shader == 'example'
Example #10
0
 def test_find_by_name(self):
     new_network = SFXNetwork.create('example')
     assert len(new_network.find_by_name('SurfaceMaskCutoff')) == 1
     assert len(new_network.find_by_name('nonexistent')) == 0
     assert len(new_network.find_by_name('Color')) == 7
Example #11
0
 def test_node_dict(self):
     new_network = SFXNetwork.create('example')
     assert hasattr(new_network.nodes, 'keys')
     assert hasattr(new_network.nodes, 'values')
     assert hasattr(new_network.nodes, '__getitem__')
     assert hasattr(new_network.nodes, '__iter__')
Example #12
0
File: tests.py Project: theodox/sfx
 def test_cmd(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     result = new_node.cmd(help=True)
Example #13
0
File: tests.py Project: theodox/sfx
 def test_cmd(self):
     new_network = SFXNetwork.create('example')
     result = new_network.cmd(help=True)
Example #14
0
File: tests.py Project: theodox/sfx
 def test_node_dict(self):
     new_network = SFXNetwork.create('example')
     assert hasattr(new_network.nodes, 'keys')
     assert hasattr(new_network.nodes, 'values')
     assert hasattr(new_network.nodes, '__getitem__')
     assert hasattr(new_network.nodes, '__iter__')
Example #15
0
File: tests.py Project: theodox/sfx
 def test_new_node(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     assert new_node.nodetype == 'Color'
     assert new_network.find_by_name('added')
Example #16
0
File: tests.py Project: theodox/sfx
 def test_find_by_type(self):
     new_network = SFXNetwork.create('example')
     assert len(new_network.find_by_type(sfxnodes.Color)) == 26
     assert len(new_network.find_by_type(sfxnodes.DerivedNormalZMap)) == 0
Example #17
0
File: tests.py Project: theodox/sfx
 def test_find_by_name(self):
     new_network = SFXNetwork.create('example')
     assert len(new_network.find_by_name('SurfaceMaskCutoff')) == 1
     assert len(new_network.find_by_name('nonexistent')) == 0
     assert len(new_network.find_by_name('Color')) == 7
Example #18
0
File: tests.py Project: theodox/sfx
 def test_sfx_root(self):
     new_network = SFXNetwork.create('example')
     root_node = new_network.root
     assert root_node.nodetype == 'Hardware Shader'
Example #19
0
 def test_sfx_create(self):
     new_network = SFXNetwork.create('example')
     assert cmds.ls('example') == ['example']
     assert cmds.nodeType('example') == 'ShaderfxShader'
     assert new_network.shader == 'example'
Example #20
0
File: tests.py Project: theodox/sfx
 def test_node_name(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     assert new_node.name == 'added'
Example #21
0
 def test_sfx_root(self):
     new_network = SFXNetwork.create('example')
     root_node = new_network.root
     assert root_node.nodetype == 'Hardware Shader'
Example #22
0
 def test_node_name(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     assert new_node.name == 'added'
Example #23
0
 def test_find_by_type(self):
     new_network = SFXNetwork.create('example')
     assert len(new_network.find_by_type(sfxnodes.Color)) == 26
     assert len(new_network.find_by_type(sfxnodes.DerivedNormalZMap)) == 0
Example #24
0
File: tests.py Project: theodox/sfx
 def test_properties_setter_4(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     new_node.color = [1, 0, 1, 0]
     assert new_node.color == [1, 0, 1, 0]
Example #25
0
 def test_new_node(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     assert new_node.nodetype == 'Color'
     assert new_network.find_by_name('added')
Example #26
0
 def test_properties_setter_4(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     new_node.color = [1, 0, 1, 0]
     assert new_node.color == [1, 0, 1, 0]
Example #27
0
 def test_cmd(self):
     new_network = SFXNetwork.create('example')
     result = new_network.cmd(help=True)
Example #28
0
File: tests.py Project: theodox/sfx
 def test_asserts_on_bad_property(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     example = lambda: new_node.fred
     self.assertRaises(SFXPropertyNotFound, example)
Example #29
0
 def test_properties_getter_4(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     assert new_node.color == [0.5, 0.5, 0.5, 1.0]
Example #30
0
File: tests.py Project: theodox/sfx
 def test_properties_getter_4(self):
     new_network = SFXNetwork.create('example')
     new_node = new_network.add(sfxnodes.Color, 'added')
     assert new_node.color == [0.5, 0.5, 0.5, 1.0]