configurationengine/source/plugins/symbian/ConeThemePlugin/themeplugin/tests/unittest_theme_container.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, sys, os
    18 
    18 
    19 import __init__    
    19 from cone.public import api
    20 from cone.public import exceptions,plugin,api
       
    21 from cone.storage import filestorage
       
    22 from cone.confml import implml
       
    23 from themeplugin import theme_function
       
    24 from themeplugin.theme_container import ThemeContainer
    20 from themeplugin.theme_container import ThemeContainer
    25 from cone.storage.filestorage import FileStorage
       
    26 
    21 
    27 from unittest_theme_plugin import impl_from_resource
    22 from unittest_theme_plugin import impl_from_resource
    28 
    23 
    29 ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
    24 ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
    30 
    25 
    42         project = api.Project(api.Storage.open(os.path.join(ROOT_PATH,"e75")))
    37         project = api.Project(api.Storage.open(os.path.join(ROOT_PATH,"e75")))
    43         config = project.get_configuration("root_variant.confml")
    38         config = project.get_configuration("root_variant.confml")
    44         impl = impl_from_resource("variant/implml/theme.thememl", config);
    39         impl = impl_from_resource("variant/implml/theme.thememl", config);
    45         list_tpf = impl.list_tpf_files(impl.list_active_theme, impl.list_theme_dir)
    40         list_tpf = impl.list_tpf_files(impl.list_active_theme, impl.list_theme_dir)
    46         
    41         
    47         list_theme=[]
       
    48         container = ThemeContainer(list_tpf,impl.configuration)
    42         container = ThemeContainer(list_tpf,impl.configuration)
    49         container.create_themes()
    43         container.create_themes()
    50         self.assertEquals(len(container.list_theme),2)
    44         self.assertEquals(len(container.list_theme),2)
    51         container.removeTempDirs() 
    45         container.removeTempDirs() 
    52 
    46 
    72         container.prepare_active_themes(impl.list_active_theme)
    66         container.prepare_active_themes(impl.list_active_theme)
    73         theme = get_theme(container.list_theme, 's60/content/UI/Armi2.tpf')
    67         theme = get_theme(container.list_theme, 's60/content/UI/Armi2.tpf')
    74         self.assertEquals(theme.get_setting_uids(), ["KCRUidPersonalisation.KPslnActiveSkinUid"])
    68         self.assertEquals(theme.get_setting_uids(), ["KCRUidPersonalisation.KPslnActiveSkinUid"])
    75         self.assertEquals(theme.get_uid(), "0x101FD60A")
    69         self.assertEquals(theme.get_uid(), "0x101FD60A")
    76 
    70 
    77          
    71 # Only run these tests on Windows
       
    72 if sys.platform != 'win32':
       
    73     del TestThemePlugin
    78         
    74         
    79 if __name__ == '__main__':
    75 if __name__ == '__main__':
    80   unittest.main()
    76     unittest.main()