<s> import unittest <EOL> import IECore <EOL> import Gaffer <EOL> import GafferTest <EOL> import GafferScene <EOL> import GafferSceneTest <EOL> class PlaneTest ( GafferSceneTest . SceneTestCase ) : <EOL> def testConstruct ( self ) : <EOL> p = GafferScene . Plane ( ) <EOL> self . assertEqual ( p . getName ( ) , "<STR_LIT>" ) <EOL> def testCompute ( self ) : <EOL> p = GafferScene . Plane ( ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . object ( "<STR_LIT:/>" ) , IECore . NullObject ( ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . transform ( "<STR_LIT:/>" ) , IECore . M44f ( ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . bound ( "<STR_LIT:/>" ) , IECore . Box3f ( IECore . V3f ( - <NUM_LIT:0.5> , - <NUM_LIT:0.5> , <NUM_LIT:0> ) , IECore . V3f ( <NUM_LIT:0.5> , <NUM_LIT:0.5> , <NUM_LIT:0> ) ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . childNames ( "<STR_LIT:/>" ) , IECore . InternedStringVectorData ( [ "<STR_LIT>" ] ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . object ( "<STR_LIT>" ) , IECore . MeshPrimitive . createPlane ( IECore . Box2f ( IECore . V2f ( - <NUM_LIT:0.5> ) , IECore . V2f ( <NUM_LIT:0.5> ) ) ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . transform ( "<STR_LIT>" ) , IECore . M44f ( ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . bound ( "<STR_LIT>" ) , IECore . Box3f ( IECore . V3f ( - <NUM_LIT:0.5> , - <NUM_LIT:0.5> , <NUM_LIT:0> ) , IECore . V3f ( <NUM_LIT:0.5> , <NUM_LIT:0.5> , <NUM_LIT:0> ) ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . childNames ( "<STR_LIT>" ) , IECore . InternedStringVectorData ( ) ) <EOL> def testPlugs ( self ) : <EOL> p = GafferScene . Plane ( ) <EOL> m = IECore . MeshPrimitive . createPlane ( IECore . Box2f ( IECore . V2f ( - <NUM_LIT:0.5> ) , IECore . V2f ( <NUM_LIT:0.5> ) ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . object ( "<STR_LIT>" ) , m ) <EOL> h = p [ "<STR_LIT>" ] . objectHash ( "<STR_LIT>" ) <EOL> p [ "<STR_LIT>" ] . setValue ( IECore . V2f ( <NUM_LIT> , <NUM_LIT:5> ) ) <EOL> m = IECore . MeshPrimitive . createPlane ( IECore . Box2f ( IECore . V2f ( - <NUM_LIT> , - <NUM_LIT> ) , IECore . V2f ( <NUM_LIT> , <NUM_LIT> ) ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . object ( "<STR_LIT>" ) , m ) <EOL> self . assertNotEqual ( p [ "<STR_LIT>" ] . objectHash ( "<STR_LIT>" ) , h ) <EOL> h = p [ "<STR_LIT>" ] . objectHash ( "<STR_LIT>" ) <EOL> p [ "<STR_LIT>" ] . setValue ( IECore . V2i ( <NUM_LIT:5> , <NUM_LIT:10> ) ) <EOL> m = IECore . MeshPrimitive . createPlane ( IECore . Box2f ( IECore . V2f ( - <NUM_LIT> , - <NUM_LIT> ) , IECore . V2f ( <NUM_LIT> , <NUM_LIT> ) ) , IECore . V2i ( <NUM_LIT:5> , <NUM_LIT:10> ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . object ( "<STR_LIT>" ) , m ) <EOL> self . assertNotEqual ( p [ "<STR_LIT>" ] . objectHash ( "<STR_LIT>" ) , h ) <EOL> def testAffects ( self ) : <EOL> p = GafferScene . Plane ( ) <EOL> s = GafferTest . CapturingSlot ( p . plugDirtiedSignal ( ) ) <EOL> p [ "<STR_LIT:name>" ] . setValue ( "<STR_LIT>" ) <EOL> self . assertEqual ( len ( s ) , <NUM_LIT:4> ) <EOL> self . failUnless ( s [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] . isSame ( p [ "<STR_LIT:name>" ] ) ) <EOL> self . failUnless ( s [ <NUM_LIT:1> ] [ <NUM_LIT:0> ] . isSame ( p [ "<STR_LIT>" ] [ "<STR_LIT>" ] ) ) <EOL> self . failUnless ( s [ <NUM_LIT:2> ] [ <NUM_LIT:0> ] . isSame ( p [ "<STR_LIT>" ] [ "<STR_LIT>" ] ) ) <EOL> self . failUnless ( s [ <NUM_LIT:3> ] [ <NUM_LIT:0> ] . isSame ( p [ "<STR_LIT>" ] ) ) <EOL> del s [ : ] <EOL> p [ "<STR_LIT>" ] [ "<STR_LIT:x>" ] . setValue ( <NUM_LIT:10> ) <EOL> found = False <EOL> for ss in s : <EOL> if ss [ <NUM_LIT:0> ] . isSame ( p [ "<STR_LIT>" ] ) : <EOL> found = True <EOL> self . failUnless ( found ) <EOL> def testTransform ( self ) : <EOL> p = GafferScene . Plane ( ) <EOL> p [ "<STR_LIT>" ] [ "<STR_LIT>" ] . setValue ( IECore . V3f ( <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . transform ( "<STR_LIT:/>" ) , IECore . M44f ( ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . transform ( "<STR_LIT>" ) , IECore . M44f . createTranslated ( IECore . V3f ( <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> ) ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . bound ( "<STR_LIT:/>" ) , IECore . Box3f ( IECore . V3f ( <NUM_LIT:0.5> , - <NUM_LIT:0.5> , <NUM_LIT:0> ) , IECore . V3f ( <NUM_LIT> , <NUM_LIT:0.5> , <NUM_LIT:0> ) ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . bound ( "<STR_LIT>" ) , IECore . Box3f ( IECore . V3f ( - <NUM_LIT:0.5> , - <NUM_LIT:0.5> , <NUM_LIT:0> ) , IECore . V3f ( <NUM_LIT:0.5> , <NUM_LIT:0.5> , <NUM_LIT:0> ) ) ) <EOL> def testEnabled ( self ) : <EOL> p = GafferScene . Plane ( ) <EOL> p [ "<STR_LIT>" ] . setValue ( False ) <EOL> self . assertSceneValid ( p [ "<STR_LIT>" ] ) <EOL> self . assertTrue ( p [ "<STR_LIT>" ] . bound ( "<STR_LIT:/>" ) . isEmpty ( ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . childNames ( "<STR_LIT:/>" ) , IECore . InternedStringVectorData ( ) ) <EOL> p [ "<STR_LIT>" ] . setValue ( True ) <EOL> self . assertSceneValid ( p [ "<STR_LIT>" ] ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . childNames ( "<STR_LIT:/>" ) , IECore . InternedStringVectorData ( [ "<STR_LIT>" ] ) ) <EOL> def testSerialise ( self ) : <EOL> s = Gaffer . ScriptNode ( ) <EOL> s [ "<STR_LIT:p>" ] = GafferScene . Plane ( ) <EOL> ss = s . serialise ( ) <EOL> def testUndoAndRedoAndCompute ( self ) : <EOL> s = Gaffer . ScriptNode ( ) <EOL> with Gaffer . UndoContext ( s ) : <EOL> s [ "<STR_LIT:p>" ] = GafferScene . Plane ( ) <EOL> self . assertTrue ( isinstance ( s [ "<STR_LIT:p>" ] [ "<STR_LIT>" ] . object ( "<STR_LIT>" ) , IECore . MeshPrimitive ) ) <EOL> s . undo ( ) <EOL> s . redo ( ) <EOL> self . assertTrue ( isinstance ( s [ "<STR_LIT:p>" ] [ "<STR_LIT>" ] . object ( "<STR_LIT>" ) , IECore . MeshPrimitive ) ) <EOL> def testNonExistentSets ( self ) : <EOL> p = GafferScene . Plane ( ) <EOL> p [ "<STR_LIT>" ] . setValue ( "<STR_LIT>" ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] [ "<STR_LIT>" ] . getValue ( ) , IECore . InternedStringVectorData ( [ "<STR_LIT:A>" , "<STR_LIT:B>" ] ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . set ( "<STR_LIT>" ) , GafferScene . PathMatcherData ( ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . set ( "<STR_LIT>" ) , GafferScene . PathMatcherData ( ) ) <EOL> self . assertEqual ( p [ "<STR_LIT>" ] . setHash ( "<STR_LIT>" ) , p [ "<STR_LIT>" ] . setHash ( "<STR_LIT>" ) ) <EOL> self . assertTrue ( p [ "<STR_LIT>" ] . set ( "<STR_LIT>" , _copy = False ) . isSame ( p [ "<STR_LIT>" ] . set ( "<STR_LIT>" , _copy = False ) ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
