def test( self ) : sphere = GafferScene.Sphere() h = IECore.MurmurHash() for path in ( "/", "/sphere" ) : for method in ( "boundHash", "transformHash", "objectHash", "attributesHash" ) : h.append( getattr( sphere["out"], method )( path ) ) capsule = GafferScene.Capsule( sphere["out"], "/", Gaffer.Context(), h, sphere["out"].bound( "/" ) ) self.assertEqual( capsule.scene(), sphere["out"] ) self.assertEqual( capsule.root(), "/" ) self.assertEqual( capsule.bound(), sphere["out"].bound( "/" ) ) capsuleCopy = capsule.copy() self.assertEqual( capsuleCopy.scene(), sphere["out"] ) self.assertEqual( capsuleCopy.root(), "/" ) self.assertEqual( capsuleCopy.bound(), sphere["out"].bound( "/" ) ) self.assertEqual( capsuleCopy.hash(), capsule.hash() ) del sphere six.assertRaisesRegex( self, RuntimeError, "Source scene plug no longer valid.", capsule.scene )
def test(self): sphere = GafferScene.Sphere() h = IECore.MurmurHash() for path in ("/", "/sphere"): for method in ("boundHash", "transformHash", "objectHash", "attributesHash"): h.append(getattr(sphere["out"], method)(path)) capsule = GafferScene.Capsule(sphere["out"], "/", Gaffer.Context(), h, sphere["out"].bound("/")) self.assertEqual(capsule.scene(), sphere["out"]) self.assertEqual(capsule.root(), "/") self.assertEqual(capsule.bound(), sphere["out"].bound("/")) capsuleCopy = capsule.copy() self.assertEqual(capsuleCopy.scene(), sphere["out"]) self.assertEqual(capsuleCopy.root(), "/") self.assertEqual(capsuleCopy.bound(), sphere["out"].bound("/")) self.assertEqual(capsuleCopy.hash(), capsule.hash()) sphere["radius"].setValue(2) self.assertRaisesRegexp(RuntimeError, "Capsule has expired", capsule.scene) self.assertRaisesRegexp(RuntimeError, "Capsule has expired", capsule.root) self.assertRaisesRegexp(RuntimeError, "Capsule has expired", capsule.hash) self.assertRaisesRegexp(RuntimeError, "Capsule has expired", capsule.bound) self.assertRaisesRegexp(RuntimeError, "Capsule has expired", capsuleCopy.scene) self.assertRaisesRegexp(RuntimeError, "Capsule has expired", capsuleCopy.root) self.assertRaisesRegexp(RuntimeError, "Capsule has expired", capsuleCopy.hash) self.assertRaisesRegexp(RuntimeError, "Capsule has expired", capsuleCopy.bound)