

def testResetOrigin(self):
    constant = GafferImage.Constant()
    constant['format'].setValue(GafferImage.Format(100, 200, 1))
    crop = GafferImage.Crop()
    crop['in'].setInput(constant['out'])
    self.assertEqual(crop['affectDisplayWindow'].getValue(), True)
    self.assertEqual(crop['affectDataWindow'].getValue(), True)
    self.assertEqual(crop['resetOrigin'].getValue(), True)
    area = IECore.Box2i(IECore.V2i(50), IECore.V2i(100, 190))
    crop['area'].setValue(area)
    self.assertEqual(crop['out']['format'].getValue().getDisplayWindow(), IECore.Box2i(IECore.V2i(0), area.size()))
    self.assertEqual(crop['out']['dataWindow'].getValue(), IECore.Box2i(IECore.V2i(0), area.size()))
    crop['resetOrigin'].setValue(False)
    self.assertEqual(crop['out']['format'].getValue().getDisplayWindow(), area)
    self.assertEqual(crop['out']['dataWindow'].getValue(), area)
    crop['resetOrigin'].setValue(True)
    crop['affectDisplayWindow'].setValue(False)
    self.assertEqual(crop['out']['format'].getValue(), crop['in']['format'].getValue())
    self.assertEqual(crop['out']['dataWindow'].getValue(), area)
    crop['affectDisplayWindow'].setValue(True)
    constant['affectDataWindow'].setValue(False)
    self.assertEqual(crop['out']['format'].getValue().getDisplayWindow(), IECore.Box2i(IECore.V2i(0), area.size()))
    self.assertEqual(crop['out']['dataWindow'].getValue(), IECore.Box2i(IECore.V2i((- 50)), IECore.V2i(50, 150)))

dataset/ETHPy150Open ImageEngine/gaffer/python/GafferImageTest/CropTest.py CropTest.testResetOrigin/VarMisuse@343/468 `crop`->`constant`