Beispiel #1
0
class ROItests(unittest.TestCase):
    def setUp(self):
        self.BL = (35, 50)
        self.TR = (80, 100)
        self.roi = ROI(self.BL, self.TR, origin='absolute')

    def testInit(self):
        self.assertEqual(self.BL, (self.roi.left, self.roi.bottom))
        self.assertEqual(self.TR, (self.roi.right, self.roi.top))

    def testROItoRelative(self):
        old = ROI.copy(self.roi)
        origin = (30, 32)
        relROI = self.roi.toRelative(origin)
        assert relROI.origin == 'relative'
        assert old.left - relROI.left == origin[0]
        assert old.top - relROI.top == origin[1]

    @raises(ROIError)
    def testROItoRelativeFail(self):
        relROI = self.roi.toRelative((100, 100))

    @raises(ROIError)
    def testROIFail(self):
        roi = ROI((85, 50), (80, 100))

    def testROItoAbsolute(self):
        origin = (30, 32)
        absROI = self.roi.toAbsolute(origin)
        assert str(absROI) == str(self.roi)
Beispiel #2
0
class ROItests(unittest.TestCase):
  def setUp(self):
    self.BL = (35, 50)
    self.TR = (80,100)
    self.roi = ROI( self.BL, self.TR, origin='absolute')

  def testInit(self):
    self.assertEqual(self.BL, (self.roi.left,self.roi.bottom))
    self.assertEqual(self.TR, (self.roi.right,self.roi.top))

  def testROItoRelative(self):
    old = ROI.copy(self.roi)
    origin = (30, 32)
    relROI = self.roi.toRelative( origin )
    assert relROI.origin == 'relative'
    assert old.left - relROI.left == origin[0]
    assert old.top - relROI.top == origin[1]

  @raises(ROIError)
  def testROItoRelativeFail(self):
    relROI = self.roi.toRelative( (100,100) )

  @raises(ROIError)
  def testROIFail(self):
    roi = ROI( (85,50), (80,100) )

  def testROItoAbsolute(self):
    origin = (30, 32)
    absROI = self.roi.toAbsolute(origin)
    assert str(absROI) == str(self.roi)
Beispiel #3
0
 def testROItoRelative(self):
   old = ROI.copy(self.roi)
   origin = (30, 32)
   relROI = self.roi.toRelative( origin )
   assert relROI.origin == 'relative'
   assert old.left - relROI.left == origin[0]
   assert old.top - relROI.top == origin[1]
Beispiel #4
0
 def testROItoRelative(self):
     old = ROI.copy(self.roi)
     origin = (30, 32)
     relROI = self.roi.toRelative(origin)
     assert relROI.origin == 'relative'
     assert old.left - relROI.left == origin[0]
     assert old.top - relROI.top == origin[1]
Beispiel #5
0
def testROItoRelative():
  old = ROI.copy(roi)
  origin = (30, 32)
  relROI = roi.toRelative( origin )
  assert str(old) == str(roi)
  assert relROI.origin == 'relative'
  assert old.left - relROI.left == origin[0]
  assert old.top - relROI.top == origin[1]
Beispiel #6
0
 def setUp(self):
   self.BL = (35, 50)
   self.TR = (80,100)
   self.roi = ROI( self.BL, self.TR, origin='absolute')
Beispiel #7
0
 def setUp(self):
     self.BL = (35, 50)
     self.TR = (80, 100)
     self.roi = ROI(self.BL, self.TR, origin='absolute')
Beispiel #8
0
 def testROIFail(self):
     roi = ROI((85, 50), (80, 100))