def test_recorder_replay_ok(tmp_path): recorder = FPDFRecorder(init_pdf()) recorder.add_page() recorder.cell(w=recorder.epw, h=10, txt="Hello again!", align="C") expected = recorder.output() recorder.rewind() recorder.replay() assert_pdf_equal(recorder, expected, tmp_path)
def test_recorder_override_accept_page_break_ok(): recorder = FPDFRecorder(init_pdf(), accept_page_break=False) assert recorder.accept_page_break is False
def test_recorder_rewind_twice_ok(tmp_path): pdf = init_pdf() recorder = FPDFRecorder(pdf) expected = recorder.output() # close the document as a side-effect recorder.rewind() # in order to un-close the document recorder.add_page() recorder.cell(w=recorder.epw, h=10, txt="Hello again!", align="C") recorder.rewind() assert_pdf_equal(recorder, expected, tmp_path)