UnicodeTests.py

Go to the documentation of this file.
00001 # -*- coding: utf-8 -*-
00002 #   (c) Juergen Riegel (juergen.riegel@web.de) 2007 LGPL   
00003 
00004 # Open and edit only in UTF-8 !!!!!!
00005 
00006 import FreeCAD, os, unittest, tempfile
00007 
00008 
00009 #---------------------------------------------------------------------------
00010 # define the functions to test the FreeCAD Document code
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     #closing doc
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     # saving and restoring
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     #closing doc
00048     FreeCAD.closeDocument("SaveRestoreTests")
00049 
00050       

Generated on Wed Nov 23 19:00:55 2011 for FreeCAD by  doxygen 1.6.1