Ejemplo n.º 1
0
def test_blank():

    testfig = template.Template(figsize=(8.5, 11), scriptname="")
    testfig.path_text = SCRIPTNAME
    blank = testfig.blank()

    return testfig.fig
Ejemplo n.º 2
0
def test_custom_spans():
    test = [
        {
            "span": [0, 8, 0, 32]
        },
        {
            "span": [13, 16, 16, 30]
        },
        {
            "span": [13, 16, 0, 16]
        },
        {
            "span": [8, 13, 0, 32]
        },
        {
            "span": [0, 13, 32, 40]
        },
        {
            "span": [13, 16, 30, 40]
        },
    ]

    testfig = template.Template(figsize=(5, 3),
                                scriptname="",
                                titleblock_content=test)
    testfig.path_text = SCRIPTNAME
    blank = testfig.blank()

    return testfig.fig
Ejemplo n.º 3
0
def test_zero_margins():

    testfig = template.Template(figsize=(8.5, 11),
                                scriptname="tests.py",
                                margins=(0, 0, 0, 0))

    blank = testfig.blank()

    return testfig.fig
Ejemplo n.º 4
0
def test_titleblock_on_left():

    testfig = template.Template(figsize=(8.5, 11), scriptname="")
    testfig.gstitleblock = testfig.gsfig[
        -(testfig.bottom + testfig.t_h) or None:-testfig.bottom or None,
        (testfig.left) or None:-(testfig.left + testfig.t_w) or None]

    blank = testfig.blank()

    return testfig.fig
Ejemplo n.º 5
0
def test_custom_titleblock():
    custom = [
        {
            'span': [0, 32, 0, 16],
            'name':
            'Title',
            'text': [
                {
                    "ha": "center",
                    "s": "Test\nCustom Block",
                    "va": "baseline",
                    "weight": "bold",
                    "x": 0.5,
                    "y": 0.52,
                },
                {
                    "color": (.3, 0.3, 0.3),
                    "ha": "center",
                    "s": "Blank Example",
                    "va": "top",
                    "weight": "light",
                    "x": 0.5,
                    "y": 0.48,
                },
            ],
        },
        {
            'name': 'logo',
            'image': {
                'path': DEMO_PNG_FILE,
                'scale': 1,
            },
            'span': [0, 32, 16, 32],
        },
        {
            'name': 'fignum',
            'text': {
                's': '5',
                'x': .5,
                'y': .5,
                'ha': 'center',
                'va': 'center',
            },
            'span': [0, 32, 32, 48],
        },
    ]

    testfig = template.Template(figsize=(8.5, 11),
                                scriptname="",
                                titleblock_content=custom)

    testfig.path_text = SCRIPTNAME
    fig = testfig.setup_figure()

    return testfig.fig
Ejemplo n.º 6
0
def test_fancy_titleblock():
    fancy = [
        {
            'name':
            'title',
            'text': [
                {
                    "ha": "center",
                    "s": "Fancy Template Example",
                    "va": "baseline",
                    "weight": "bold",
                    "x": 0.5,
                    "y": 0.6,
                },
                {
                    "color": (.3, 0.3, 0.3),
                    "ha": "center",
                    "s": "Feeling Gray",
                    "va": "top",
                    "weight": "light",
                    "x": 0.5,
                    "y": 0.4,
                },
            ],
        },
        {
            'name': 'logo',
            'image': {
                'path': DEMO_PNG_FILE,
                'scale': 0.8,
            },
        },
        {},  # placeholders for empty default boxes
        {},
        {
            'name': 'fignum',
            'text': {
                "ha": "center",
                "s": "Figure\n{:02d}",
                "va": "center",
                "weight": "bold",
                "x": 0.5,
                "y": 0.5,
            },
        },
    ]

    testfig = template.Template(figsize=(8.5, 11),
                                scriptname="",
                                titleblock_content=fancy)
    testfig.path_text = SCRIPTNAME
    fig = testfig.setup_figure()

    return testfig.fig