From cca66b9ec4e494c1d919bff0f71a820d8afab1fa Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:24:48 +0200 Subject: Adding upstream version 1.2.2. Signed-off-by: Daniel Baumann --- .../other/gcodetools/tests/test_inkex_inx.py | 114 +++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 share/extensions/other/gcodetools/tests/test_inkex_inx.py (limited to 'share/extensions/other/gcodetools/tests/test_inkex_inx.py') diff --git a/share/extensions/other/gcodetools/tests/test_inkex_inx.py b/share/extensions/other/gcodetools/tests/test_inkex_inx.py new file mode 100644 index 0000000..211b746 --- /dev/null +++ b/share/extensions/other/gcodetools/tests/test_inkex_inx.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python +# coding=utf-8 +""" +Test elements extra logic from svg xml lxml custom classes. +""" + +import os +from glob import glob + +from inkex.utils import PY3 +from inkex.tester import TestCase +from inkex.tester.inx import InxMixin +from inkex.inx import InxFile + +class InxTestCase(InxMixin, TestCase): + """Test INX files""" + def test_inx_effect(self): + inx = InxFile(""" + + TestOne + org.inkscape.test.inx_one + + all + + + + + + + +""") + self.assertEqual(inx.name, 'TestOne') + self.assertEqual(inx.ident, 'org.inkscape.test.inx_one') + self.assertEqual(inx.slug, 'InxOne') + self.assertEqual(inx.metadata, {'type': 'effect', 'preview': False, 'objects': 'all'}) + self.assertEqual(inx.menu, ['Banana', 'Ice Cream', 'TestOne']) + self.assertEqual(inx.warnings, []) + + def test_inx_output(self): + inx = InxFile(""" + + <_name>TestTwo + org.inkscape.test.inx_two + + .inx + text/xml+inx + Extension (*.inx) + <_filetypetooltip>The extension extension repention suspension. + true + +""") + self.assertEqual(inx.name, 'TestTwo') + self.assertEqual(inx.ident, 'org.inkscape.test.inx_two') + self.assertEqual(inx.metadata, { + 'dataloss': True, + 'extension': '.inx', + 'mimetype': 'text/xml+inx', + 'name': 'Extension (*.inx)', + 'tooltip': 'The extension extension repention suspension.', + 'type': 'output'}) + self.assertEqual(inx.warnings, [ + 'Use of old translation scheme: <_filetypetooltip...>', + 'Use of old translation scheme: <_name...>']) + + def test_inx_input(self): + inx = InxFile(""" + TestThree + org.inkscape.test.inx_three + + .inx + text/xml+inx + Extension (*.inx) + The extension extension repention suspension. + +""") + self.assertEqual(inx.name, 'TestThree') + self.assertEqual(inx.metadata, { + 'extension': '.inx', + 'mimetype': 'text/xml+inx', + 'name': 'Extension (*.inx)', + 'tooltip': 'The extension extension repention suspension.', + 'type': 'input'}) + self.assertEqual(inx.warnings, ['No inx xml prefix.']) + + def test_inx_template(self): + inx = InxFile(""" + TestFour + org.inkscape.test.inx_four + + all + + + Magic Number + Donky Oaty + Something might happen. + 2070-01-01 + word food strawberry + +""") + self.assertEqual(inx.name, 'TestFour') + self.assertEqual(inx.metadata, {'author': 'Donky Oaty', 'desc': 'Something might happen.', 'type': 'template'}) + self.assertEqual(inx.warnings, ['No inx xml prefix.']) + + + def test_inx_files(self): + """Get all inx files and test each of them""" + if not PY3: + self.skipTest("No INX testing in python2") + return + for inx_file in glob(os.path.join(self._testdir(), '..', '*.inx')): + self.assertInxIsGood(inx_file) -- cgit v1.2.3