Skip to content

Commit

Permalink
Test: [skip ci] test file path with utf-8 <-> utf-16 conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Jun 29, 2022
1 parent 9a70b16 commit 448b1ec
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/Mod/Test/Metadata.py
Expand Up @@ -25,6 +25,7 @@
import FreeCAD
import unittest
import os
import tempfile

class TestMetadata(unittest.TestCase):

Expand Down Expand Up @@ -107,6 +108,28 @@ def test_content_types(self):
self.assertEqual(len(macros), 2)
self.assertEqual(len(preferencepacks), 1)

def test_file_path(self):
# Issue 7112
filename = os.path.join(tempfile.gettempdir(), b'H\xc3\xa5vard.xml'.decode("utf-8"))
xmlfile = open(filename, "w")
xmlfile.write(r"""<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<package format="1" xmlns="https://wiki.freecad.org/Package_Metadata">
<name>test</name>
<description>Text</description>
<version>1.0.0</version>
<date>2022-01-01</date>
<content>
<workbench>
<classname>Workbench</classname>
</workbench>
</content>
</package>""")
xmlfile.close()
md = FreeCAD.Metadata(filename)
self.assertEqual(md.Name, "test")
self.assertEqual(md.Description, "Text")
self.assertEqual(md.Version, "1.0.0")

def test_content_item_tags(self):
pass

Expand All @@ -120,4 +143,4 @@ def test_supports_current(self):
pass

def test_generic_metadata(self):
pass
pass

0 comments on commit 448b1ec

Please sign in to comment.