示例#1
0
    def test_targetLatexIMGtoEPS(self):
        tree = etree.parse(ECMDS_TEST_DATA_DIR + os.sep + "ecromedos_png.xml")
        root = tree.getroot()

        with tempfile.TemporaryDirectory() as tmpdir:
            config = {
                "latex_bin": "/usr/bin/latex",
                "dvipng_bin": "/usr/bin/dvipng",
                "convert_bin": "/usr/bin/convert",
                "identify_bin": "/usr/bin/identify",
                "tmp_dir": tmpdir
            }

            plugin = picture.getInstance(config)
            plugin.process(root.find("./img"), "latex")
            plugin.flush()
        #end with

        os.unlink("img000001.eps")
示例#2
0
    def test_targetXHTMLSetScreenWidth(self):
        tree = etree.parse(ECMDS_TEST_DATA_DIR + os.sep + "ecromedos_png_explicit_width.xml")
        root = tree.getroot()

        with tempfile.TemporaryDirectory() as tmpdir:
            config = {
                "latex_bin":    "/usr/bin/latex",
                "dvipng_bin":   "/usr/bin/dvipng",
                "convert_bin":  "/usr/bin/convert",
                "identify_bin": "/usr/bin/identify",
                "tmp_dir":      tmpdir
            }

            plugin = picture.getInstance(config)
            plugin.process(root.find("./img"), "xhtml")
            plugin.flush()
        #end with

        os.unlink("img000001.png")
示例#3
0
    def test_gracefulFailOnFileNotFound(self):
        tree = etree.parse(ECMDS_TEST_DATA_DIR + os.sep + "no_such_img_file.xml")
        root = tree.getroot()

        with tempfile.TemporaryDirectory() as tmpdir:
            config = {
                "latex_bin":    "/usr/bin/latex",
                "dvipng_bin":   "/usr/bin/dvipng",
                "convert_bin":  "/usr/bin/convert",
                "identify_bin": "/usr/bin/identify",
                "tmp_dir":      tmpdir
            }

            plugin = picture.getInstance(config)

            try:
                plugin.process(root.find("./img"), "xhtml")
            except ECMDSPluginError as e:
                self.assertTrue(e.msg().startswith(
                    "Could not find bitmap file at location"))
示例#4
0
    def test_gracefulFailOnFileNotFound(self):
        tree = etree.parse(ECMDS_TEST_DATA_DIR + os.sep +
                           "no_such_img_file.xml")
        root = tree.getroot()

        with tempfile.TemporaryDirectory() as tmpdir:
            config = {
                "latex_bin": "/usr/bin/latex",
                "dvipng_bin": "/usr/bin/dvipng",
                "convert_bin": "/usr/bin/convert",
                "identify_bin": "/usr/bin/identify",
                "tmp_dir": tmpdir
            }

            plugin = picture.getInstance(config)

            try:
                plugin.process(root.find("./img"), "xhtml")
            except ECMDSPluginError as e:
                self.assertTrue(e.msg().startswith(
                    "Could not find bitmap file at location"))