def test_should_use_default_page_number(self): page = AltoParser().parse_page( ALTO_E.Page( ALTO_E.PrintSpace(), ), page_index=10 ) assert page.meta.page_number == 11
def test_should_parse_font_without_fontstyle(self): font = AltoParser().parse_font(ALTO_E.TextStyle( ID=FONT_ID_1, FONTFAMILY=FONTFAMILY_1, FONTSIZE=str(FONTSIZE_1) )) assert font.is_bold is False assert font.is_italics is False assert font.is_subscript is False assert font.is_superscript is False
def test_should_parse_page_meta_data(self): page = AltoParser().parse_page( ALTO_E.Page( {'PHYSICAL_IMG_NR': '10', 'WIDTH': '101', 'HEIGHT': '102'}, ALTO_E.PrintSpace(), ), page_index=0 ) assert page.meta.page_number == 10 assert page.meta.coordinates == LayoutPageCoordinates( x=0, y=0, width=101, height=102, page_number=10 )
def test_should_parse_illustration_as_layout_graphic(self): page = AltoParser().parse_page(ALTO_E.Page(ALTO_E.PrintSpace( ALTO_E.Illustration( ID='graphic1', HPOS=str(COORDINATES_1.x), VPOS=str(COORDINATES_1.y), WIDTH=str(COORDINATES_1.width), HEIGHT=str(COORDINATES_1.height), FILEID="/path/to/graphic.svg", TYPE="svg" ) )), page_index=(COORDINATES_1.page_number - 1)) assert len(page.graphics) == 1 graphic = page.graphics[0] assert graphic.local_file_path == '/path/to/graphic.svg' assert graphic.coordinates == COORDINATES_1 assert graphic.graphic_type == 'svg'