UnicodeTests.py
Go to the documentation of this file.00001
00002
00003
00004
00005
00006 import FreeCAD, os, unittest, tempfile
00007
00008
00009
00010
00011
00012
00013
00014 class UnicodeBasicCases(unittest.TestCase):
00015 def setUp(self):
00016 self.Doc = FreeCAD.newDocument("CreateTest")
00017
00018 def testUnicodeLabel(self):
00019 L1 = self.Doc.addObject("App::FeatureTest","Label_1")
00020 L1.Label = u"हिन्दी"
00021 self.failUnless(L1.Label == u"हिन्दी")
00022
00023 def tearDown(self):
00024
00025 FreeCAD.closeDocument("CreateTest")
00026
00027 class DocumentSaveRestoreCases(unittest.TestCase):
00028 def setUp(self):
00029 self.Doc = FreeCAD.newDocument("SaveRestoreTests")
00030 L1 = self.Doc.addObject("App::FeatureTest","Label_1")
00031 L1.Label = u"हिन्दी"
00032 self.TempPath = tempfile.gettempdir()
00033 FreeCAD.Console.PrintLog( ' Using temp path: ' + self.TempPath + '\n')
00034
00035 def testSaveAndRestore(self):
00036
00037 SaveName = self.TempPath + os.sep + "UnicodeTest.FCStd"
00038 self.Doc.FileName = SaveName
00039 self.Doc.save()
00040 self.Doc.FileName = ""
00041 self.Doc = FreeCAD.open(SaveName)
00042 self.failUnless(self.Doc.Label_1.Label == u"हिन्दी")
00043 FreeCAD.closeDocument("UnicodeTest")
00044
00045
00046 def tearDown(self):
00047
00048 FreeCAD.closeDocument("SaveRestoreTests")
00049
00050