def test_draw(self): pdf_path = create_test_path(path, 'draw.pdf') scene = Scene(relative_x=10, relative_y=10) scene.add_draw_object(SegmentedHorizontalLine(name='I', lengths=[3, 10, 5, 15])) scene.add_draw_object(SegmentedHorizontalLine(name='II', lengths=[3, 10, 5, 15, 20])) scene.draw(self.pdf) self.pdf.write(pdf_path)
def test_line(self): pdf_path = create_test_path(path, 'line.pdf') self.pdf.rect(0, 0, 50, 50) self.pdf.clip_rect(0, 0, 50, 50) self.pdf.line(10, 20, 100, 100) self.pdf.write(pdf_path) self.assertCompareFiles(pdf_path)
def test_time_line_with_voices(self): pdf_path = create_test_path(path, 'time_line_with_voices.pdf') tl = TimeLine(length=200, inner_distance=20, bottom_margin=30) # voice = tl.add_voice(name='v1') # voice.name.relative_x = -5 # for segment in voice.segments[5:15]: # segment.show = True tl.draw(self.pdf) self.pdf.write(pdf_path)
def test_draw_ruler_with_break(self): pdf_path = create_test_path(path, 'draw_ruler_with_break.pdf') pdf = Pdf(orientation='p') tl = TimeLine(length=300) printable = (pdf.w - pdf.r_margin - pdf.l_margin) tl.unit = Fraction(Fraction(printable), Fraction(20)) tl.show_interval = 10 tl.draw(pdf) pdf.write(pdf_path) self.assertCompareFiles(actual_file_path=pdf_path)
def test_empty_draw(self): pdf_path = create_test_path(path, 'empty_draw.pdf') canvas = Canvas() canvas.draw(self.pdf) self.pdf.write(pdf_path) self.assertCompareFiles(pdf_path)