configurationengine/source/plugins/symbian/ConeThemePlugin/themeplugin/tests/unittest_theme_function.py
changeset 3 e7e0ae78773e
parent 0 2e8eeb919028
equal deleted inserted replaced
2:87cfa131b535 3:e7e0ae78773e
    12 # Contributors:
    12 # Contributors:
    13 #
    13 #
    14 # Description: 
    14 # Description: 
    15 #
    15 #
    16 
    16 
    17 import unittest, os, shutil
    17 import unittest, os, sys
    18 
    18 
    19 import __init__    
       
    20 from cone.public import exceptions,plugin,api
       
    21 from cone.storage import filestorage
       
    22 from cone.confml import implml
       
    23 from themeplugin import maketheme
       
    24 from themeplugin import theme_function
    19 from themeplugin import theme_function
    25 from cone.storage.filestorage import FileStorage
       
    26 
    20 
    27 ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
    21 ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
    28 
    22 
    29 class TestThemePlugin(unittest.TestCase):    
    23 class TestThemePlugin(unittest.TestCase):    
    30     def setUp(self):
    24     def setUp(self):
    34 
    28 
    35     def tearDown(self):
    29     def tearDown(self):
    36         pass
    30         pass
    37         
    31         
    38     def test_convert_hexa_to_decimal(self):
    32     def test_convert_hexa_to_decimal(self):
    39        decimal = theme_function.convert_hexa_to_decimal("a5d5f19d6e6097b8")
    33         decimal = theme_function.convert_hexa_to_decimal("a5d5f19d6e6097b8")
    40        self.assertEquals(decimal,"-1512705635 1851824056")
    34         self.assertEquals(decimal,"-1512705635 1851824056")
    41        
    35        
    42     def test_find_text_in_string(self):
    36     def test_find_text_in_string(self):
    43         row_in_pkg_file = "\"themepackage.mbm\" - \"!:\\resource\\skins\\99d49b086e6097b8\\themepackage.mbm\""
    37         row_in_pkg_file = "\"themepackage.mbm\" - \"!:\\resource\\skins\\99d49b086e6097b8\\themepackage.mbm\""
    44         start_text = "!:\\resource\\skins\\"
    38         start_text = "!:\\resource\\skins\\"
    45         end_text = "\\"
    39         end_text = "\\"
    51         start_text = "!:\\resource\\skins\\"
    45         start_text = "!:\\resource\\skins\\"
    52         end_text = "\\"
    46         end_text = "\\"
    53         PID = theme_function.find_text_in_file(os.path.join(ROOT_PATH,"e75\\test_pkg\\themepackage.pkg"),start_text, end_text)
    47         PID = theme_function.find_text_in_file(os.path.join(ROOT_PATH,"e75\\test_pkg\\themepackage.pkg"),start_text, end_text)
    54         self.assertEquals(PID,"99d49b086e6097b8")
    48         self.assertEquals(PID,"99d49b086e6097b8")
    55 
    49 
       
    50 # Only run these tests on Windows
       
    51 if sys.platform != 'win32':
       
    52     del TestThemePlugin
    56         
    53         
    57 if __name__ == '__main__':
    54 if __name__ == '__main__':
    58   unittest.main()
    55     unittest.main()