Beispiel #1
0
 def test_should_calculate_bounding_box_of_page_without_xy(self):
     page = E.PAGE({
         'width': '100',
         'height': '101'
     })
     doc = LxmlStructuredDocument(E.DOCUMENT(page))
     assert doc.get_bounding_box(page) == BoundingBox(0, 0, 100, 101)
Beispiel #2
0
 def test_should_calculate_default_bounding_box(self):
     token = E.TOKEN({
         'x': '10',
         'y': '11',
         'width': '100',
         'height': '101'
     })
     doc = LxmlStructuredDocument(E.DOCUMENT(E.PAGE(E.TEXT(token))))
     assert doc.get_bounding_box(token) == BoundingBox(10, 11, 100, 101)
Beispiel #3
0
 def test_should_be_able_to_set_bounding_box(self):
     bounding_box = BoundingBox(10, 11, 100, 101)
     token = E.TOKEN({
         'x': '20',
         'y': '21',
         'width': '200',
         'height': '201'
     })
     doc = LxmlStructuredDocument(E.DOCUMENT(E.PAGE(E.TEXT(token))))
     doc.set_bounding_box(token, bounding_box)
     assert doc.get_bounding_box(token) == bounding_box