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

Method testLoadSave

test/IECoreImage/ImagePrimitiveTest.py:85–105  ·  view source on GitHub ↗

Test IECoreImage.ImagePrimitive load/save

( self )

Source from the content-addressed store, hash-verified

83 # \todo Verify behaviour when dataWindow and displayWindow are contradictory or inconsistent
84
85 def testLoadSave( self ) :
86 """ Test IECoreImage.ImagePrimitive load/save """
87
88 windowMin = imath.V2i( 0, 0 )
89 windowMax = imath.V2i( 100, 100 )
90 w = imath.Box2i( windowMin, windowMax )
91 i = IECoreImage.ImagePrimitive( w, w )
92 i["R"] = IECore.FloatVectorData( 101 * 101 )
93 i["G"] = IECore.FloatVectorData( 101 * 101 )
94 i["B"] = IECore.FloatVectorData( 101 * 101 )
95 self.assertTrue( i.channelsValid() )
96
97 IECore.Writer.create( i, os.path.join( "test", "IECore", "data", "output.cob" ) ).write()
98
99 i2 = IECore.Reader.create( os.path.join( "test", "IECore", "data", "output.cob" ) ).read()
100 self.assertEqual( type( i2 ), IECoreImage.ImagePrimitive )
101
102 self.assertEqual( i.displayWindow, i2.displayWindow )
103 self.assertEqual( i.dataWindow, i2.dataWindow )
104 self.assertEqual( i.channelNames(), i2.channelNames() )
105 self.assertTrue( i2.channelsValid() )
106
107 def testChannelNames( self ) :
108

Callers

nothing calls this directly

Calls 9

channelsValidMethod · 0.95
channelNamesMethod · 0.95
typeFunction · 0.85
ImagePrimitiveMethod · 0.80
joinMethod · 0.80
writeMethod · 0.45
createMethod · 0.45
readMethod · 0.45
channelNamesMethod · 0.45

Tested by

no test coverage detected