diff options
author | Hossein <hossein@libreoffice.org> | 2021-09-12 00:31:38 +0200 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2021-09-12 00:43:37 +0200 |
commit | db25622001241fda6f2a1c3a1cdff4bc79c6b65e (patch) | |
tree | b655ed5408a4d9fa249f44048d0c28566eb17c92 | |
parent | e4a481e77c913710c0bb3b59b0749e99fdc1470a (diff) |
Add test and sample wmf files for wmf-dump.py
Added test.py similar to the test.py for emf files, and samples from the
LibreOffice Core source code and attachments from the Bugzilla. The test
is added to the Makefile, so that it is invoked with 'make check'.
To check:
cd test/wmf && ./test.py
Or simply:
make check
Change-Id: Ia2e819f48eae8cc4efc26411522ba1472bd19da4
Reviewed-on: https://gerrit.libreoffice.org/c/mso-dumper/+/121969
Tested-by: Hossein <hossein@libreoffice.org>
Reviewed-by: Hossein <hossein@libreoffice.org>
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | test/wmf/pass/TypeDetectionExample.wmf | bin | 0 -> 290 bytes | |||
-rw-r--r-- | test/wmf/pass/beef.wmf | bin | 0 -> 9856 bytes | |||
-rw-r--r-- | test/wmf/pass/tdf88163.wmf | bin | 0 -> 1290 bytes | |||
-rw-r--r-- | test/wmf/pass/vegetable.wmf | bin | 0 -> 17862 bytes | |||
-rw-r--r-- | test/wmf/pass/visio_import_source.wmf | bin | 0 -> 13801 bytes | |||
-rwxr-xr-x | test/wmf/test.py | 46 |
7 files changed, 47 insertions, 0 deletions
@@ -1,6 +1,7 @@ check: cd test/doc && ./test.py cd test/emf && ./test.py + cd test/wmf && ./test.py pycodestyle --ignore=E501 msodumper/binarystream.py pycodestyle --ignore=E501 msodumper/msometa.py pycodestyle --ignore=E501 doc-dump.py msodumper/doc*.py test/doc/test.py diff --git a/test/wmf/pass/TypeDetectionExample.wmf b/test/wmf/pass/TypeDetectionExample.wmf Binary files differnew file mode 100644 index 0000000..7ed7069 --- /dev/null +++ b/test/wmf/pass/TypeDetectionExample.wmf diff --git a/test/wmf/pass/beef.wmf b/test/wmf/pass/beef.wmf Binary files differnew file mode 100644 index 0000000..0947521 --- /dev/null +++ b/test/wmf/pass/beef.wmf diff --git a/test/wmf/pass/tdf88163.wmf b/test/wmf/pass/tdf88163.wmf Binary files differnew file mode 100644 index 0000000..edcab8a --- /dev/null +++ b/test/wmf/pass/tdf88163.wmf diff --git a/test/wmf/pass/vegetable.wmf b/test/wmf/pass/vegetable.wmf Binary files differnew file mode 100644 index 0000000..364d122 --- /dev/null +++ b/test/wmf/pass/vegetable.wmf diff --git a/test/wmf/pass/visio_import_source.wmf b/test/wmf/pass/visio_import_source.wmf Binary files differnew file mode 100644 index 0000000..88deac9 --- /dev/null +++ b/test/wmf/pass/visio_import_source.wmf diff --git a/test/wmf/test.py b/test/wmf/test.py new file mode 100755 index 0000000..831125e --- /dev/null +++ b/test/wmf/test.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +# -*- encoding: UTF-8 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +import sys +sys.path.append(sys.path[0] + "/../..") +wmf_dumper = __import__('wmf-dump') +from xml.etree import ElementTree +import unittest +import os + + +class Test(unittest.TestCase): + def dump(self, name): + try: + os.unlink("%s.wmf.xml" % name) + except OSError: + pass + sock = open("%s.wmf.xml" % name, "w") + saved = sys.stdout + sys.stdout = sock + wmf_dumper.main(["wmf-dumper", "%s.wmf" % name]) + sys.stdout = saved + sock.close() + tree = ElementTree.parse('%s.wmf.xml' % name) + self.root = tree.getroot() + # Make sure everything is dumped - so it can't happen that dump(a) == dump(b), but a != b. + self.assertEqual(0, len(self.root.findall('todo'))) + + def test_pass(self): + """This test just makes sure that all files in the 'pass' directory are + dumped without problems.""" + + for dirname, dirnames, filenames in os.walk('pass'): + for filename in filenames: + if filename.endswith(".wmf"): + self.dump(os.path.join(dirname, filename).replace('.wmf', '')) + +if __name__ == '__main__': + unittest.main() + +# vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab: |