Exemplo n.º 1
0
        # equation002.tex does not exist - check fallback to image

        wiki = '{{./equation001.png?type=equation}}\n{{./equation002.png?type=equation}}\n'
        wanted = '\\begin{math}\na + b\n\\end{math}\n\n\\includegraphics[]{./equation002.png}\n\n'

        linker = tests.MockObject()
        linker.resolve_source_file = lambda name: folder.file(name)
        linker.img = lambda name: name

        tree = WikiParser().parse(wiki)
        latex = LatexDumper(linker).dump(tree)

        self.assertEqual(latex, wanted.splitlines(True))


@tests.skipUnless(InsertDiagramPlugin.check_dependencies_ok(),
                  'Missing dependencies')
class TestDiagramEditor(TestImageGeneratorPluginMixin, tests.TestCase):

    plugin = 'diagrameditor'
    object_types = ['image+diagram']

    validinput = r'''
digraph G {
	foo -> bar
	bar -> baz
	baz -> foo
}
'''
    invalidinput = r'sdf sdfsdf sdf'
Exemplo n.º 2
0
\int_{-\infty}^{\infty} \frac{1}{x} \, dx

f(x) = \sum_{n = 0}^{\infty} \alpha_n x^n

x_{1,2}=\frac{-b\pm\sqrt{\color{Red}b^2-4ac}}{2a}

\hat a  \bar b  \vec c  x'  \dot{x}  \ddot{x}
'''
	invalidinput = r'\int_{'

	def runTest(self):
		'Test Equation Editor plugin'
		TestGenerator._test_generator(self)


@tests.skipUnless(InsertDiagramPlugin.check_dependencies_ok(), 'Missing dependencies')
class TestDiagramEditor(TestGenerator):

	pluginklass = InsertDiagramPlugin
	generatorklass = DiagramGenerator

	validinput = r'''
digraph G {
	foo -> bar
	bar -> baz
	baz -> foo
}
'''
	invalidinput = r'sdf sdfsdf sdf'

	def runTest(self):