Esempio n. 1
0
def do_main(argv=None):
    out_files = ["customimage15.pdf",\
                  "customimage14.pdf",\
                  "customimage13.pdf",\
                  "customimage12.pdf"]
    # (0,2,1) - removed
    for index, version, strict in [(3,2,0), (2,3,1), (1,4,1), (0,5,1)]:
        if strict and version == 2:
            # it seems that this test branch is flawed as the
            # exceptions are raised in different places then
            # originally inteded
            checker = testlib.must_throw
            cfg = testlib.test_config()
            cfg.set("doc.version", str(version))
            cfg.set("doc.strict_mode", str(strict))
            doc = jagpdf.create_as_stream(testlib.NoopStreamOut(), cfg)
        else:
            checker = lambda fn, *args: fn(*args)
            doc, cfg = testlib.get_legacy_doc(argv,
                                              out_files[index],
                                              {'doc.version':version,
                                               'doc.strict_mode':strict})
        g_font.set_writer(doc)
        checker(g_hardmask.set_doc, doc)
        checker(do_grayscale, doc)
        checker(do_rgb, doc)
        checker(do_cmyk, doc)
        checker(do_cielab, doc)
        checker(do_indexed, doc)
        check_errors(doc)
        doc.finalize()
Esempio n. 2
0
def do_main(argv):
    out_files = ["customsmask15.pdf",
                  "customsmask14.pdf",
                  "customsmask13.pdf"]
    # (2,3,1) - removed
    for index, version, strict in [(1,4,1), (0,5,1), (2,3,0)]:
        if version < 4 and strict:
            checker = testlib.must_throw
            cfg = testlib.test_config()
            cfg.set("doc.version", str(version))
            cfg.set("doc.strict_mode", str(strict))
            cfg.set("images.softmask_16_to_8", str(0))
            doc = jagpdf.create_stream(testlib.NoopStreamOut(), cfg)
        else:
            checker = lambda fn, *args: fn(*args)
        doc, cfg = testlib.get_legacy_doc(argv,
                                           out_files[index],
                                           { 'doc.version' : version,
                                             'doc.strict_mode' : strict,
                                             'images.softmask_16_to_8' : 0 })
        g_font.set_writer(doc)
        g_softmask.set_doc(doc)
        checker(do_grayscale, doc)
        checker(do_rgb, doc)
        checker(do_cmyk, doc)
        doc.finalize()
Esempio n. 3
0
def do_main(argv=None):
    out_files = ["customimage15.pdf",\
                  "customimage14.pdf",\
                  "customimage13.pdf",\
                  "customimage12.pdf"]
    # (0,2,1) - removed
    for index, version, strict in [(3, 2, 0), (2, 3, 1), (1, 4, 1), (0, 5, 1)]:
        if strict and version == 2:
            # it seems that this test branch is flawed as the
            # exceptions are raised in different places then
            # originally inteded
            checker = testlib.must_throw
            cfg = testlib.test_config()
            cfg.set("doc.version", str(version))
            cfg.set("doc.strict_mode", str(strict))
            doc = jagpdf.create_as_stream(testlib.NoopStreamOut(), cfg)
        else:
            checker = lambda fn, *args: fn(*args)
            doc, cfg = testlib.get_legacy_doc(argv, out_files[index], {
                'doc.version': version,
                'doc.strict_mode': strict
            })
        g_font.set_writer(doc)
        checker(g_hardmask.set_doc, doc)
        checker(do_grayscale, doc)
        checker(do_rgb, doc)
        checker(do_cmyk, doc)
        checker(do_cielab, doc)
        checker(do_indexed, doc)
        check_errors(doc)
        doc.finalize()
Esempio n. 4
0
def test_main(argv=None):
    doc, cfg = testlib.get_legacy_doc(argv,
                                       'smask16.pdf',\
                                       { 'doc.version' : 5,\
                                         'images.softmask_16_to_8' : 0})
    do(doc)
    doc.finalize()
Esempio n. 5
0
def test_main(argv=None):
    doc, cfg = testlib.get_legacy_doc(argv, "smask-color.pdf", { 'doc.version' : 5 })
    do(doc)
    doc.finalize()