MCPcopy Create free account
hub / github.com/ImageEngine/cortex / testOverrides

Method testOverrides

test/IECoreGL/State.py:89–122  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

87 self.assertEqual( state2.get( IECoreGL.NameStateComponent.staticTypeId() ).name(), "bob" )
88
89 def testOverrides( self ) :
90
91 state1 = IECoreGL.State( True )
92 state1.add( IECoreGL.NameStateComponent( "billy" ) )
93
94 state2 = IECoreGL.State( False )
95 state2.add( IECoreGL.NameStateComponent( "bob" ), override = True )
96
97 state3 = IECoreGL.State( False )
98 state3.add( IECoreGL.NameStateComponent( "jane" ), override = False )
99
100 with IECoreGL.State.ScopedBinding( state2, state1 ) :
101
102 self.assertEqual( state1.get( IECoreGL.NameStateComponent.staticTypeId() ).name(), "bob" )
103
104 with IECoreGL.State.ScopedBinding( state3, state1 ) :
105
106 self.assertEqual( state1.get( IECoreGL.NameStateComponent.staticTypeId() ).name(), "bob" )
107
108 self.assertEqual( state1.get( IECoreGL.NameStateComponent.staticTypeId() ).name(), "bob" )
109
110 self.assertEqual( state1.get( IECoreGL.NameStateComponent.staticTypeId() ).name(), "billy" )
111
112 with IECoreGL.State.ScopedBinding( state3, state1 ) :
113
114 self.assertEqual( state1.get( IECoreGL.NameStateComponent.staticTypeId() ).name(), "jane" )
115
116 with IECoreGL.State.ScopedBinding( state2, state1 ) :
117
118 self.assertEqual( state1.get( IECoreGL.NameStateComponent.staticTypeId() ).name(), "bob" )
119
120 self.assertEqual( state1.get( IECoreGL.NameStateComponent.staticTypeId() ).name(), "jane" )
121
122 self.assertEqual( state1.get( IECoreGL.NameStateComponent.staticTypeId() ).name(), "billy" )
123
124if __name__ == "__main__":
125 unittest.main()

Callers

nothing calls this directly

Calls 7

addMethod · 0.95
getMethod · 0.95
StateMethod · 0.80
NameStateComponentMethod · 0.80
staticTypeIdMethod · 0.80
ScopedBindingMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected