#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""Test which creates an SVG, saves it and opens it.

"""

import subprocess
import sys

import src.config as config

def test_save_svg(cfg, silent=True):
    faint_exe = cfg.get('test', 'faint_exe')
    cmd = [faint_exe, '--run', 'faint_scripts/test-save-svg.py']
    if silent:
        cmd.append('--silent')
    subprocess.call(cmd)


if __name__ == '__main__':
    if config.maybe_create_config():
        exit(1)
    silent = not 'stay' in sys.argv
    cfg = config.read_config()
    test_save_svg(cfg, silent)
