def METHOD_NAME(out_filename, output_dir, reference_path):
    pdf_filename = '{}.pdf'.format(out_filename)
    _, _, _, _, _, _, _, ref_outlines = \
        check_pdf_links(reference_path / pdf_filename)
    with in_directory(output_dir):
        _, _, _, badlinks, badoutlinelinks, _, _, outlines = \
            check_pdf_links(pdf_filename)
        pytest.assume(badlinks == [], badlinks)
        pytest.assume(badoutlinelinks == [], badoutlinelinks)
        pytest.assume(diff_outlines(ref_outlines, outlines),
                      "Outlines mismatch!          (ref | new)\n"
                      + format_outlines(ref_outlines, outlines))
        if not diff_pdf(reference_path / pdf_filename, pdf_filename):
            pytest.fail('The generated PDF is different from the reference '
                        'PDF.\nGenerated files can be found in {}'
                        .format(output_dir))