configurationengine/source/plugins/symbian/ConeThemePlugin/themeplugin/tests/unittest_theme_function.py
changeset 0 2e8eeb919028
child 3 e7e0ae78773e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configurationengine/source/plugins/symbian/ConeThemePlugin/themeplugin/tests/unittest_theme_function.py	Thu Mar 11 17:04:37 2010 +0200
@@ -0,0 +1,58 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+import unittest, os, shutil
+
+import __init__    
+from cone.public import exceptions,plugin,api
+from cone.storage import filestorage
+from cone.confml import implml
+from themeplugin import maketheme
+from themeplugin import theme_function
+from cone.storage.filestorage import FileStorage
+
+ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
+
+class TestThemePlugin(unittest.TestCase):    
+    def setUp(self):
+        self.curdir = os.getcwd()
+        self.output = 'output'
+        pass
+
+    def tearDown(self):
+        pass
+        
+    def test_convert_hexa_to_decimal(self):
+       decimal = theme_function.convert_hexa_to_decimal("a5d5f19d6e6097b8")
+       self.assertEquals(decimal,"-1512705635 1851824056")
+       
+    def test_find_text_in_string(self):
+        row_in_pkg_file = "\"themepackage.mbm\" - \"!:\\resource\\skins\\99d49b086e6097b8\\themepackage.mbm\""
+        start_text = "!:\\resource\\skins\\"
+        end_text = "\\"
+
+        PID_number = theme_function.find_text_in_string(row_in_pkg_file,start_text, end_text)
+        self.assertEquals(PID_number,"99d49b086e6097b8")
+        
+    def test_find_text_in_file(self):
+        start_text = "!:\\resource\\skins\\"
+        end_text = "\\"
+        PID = theme_function.find_text_in_file(os.path.join(ROOT_PATH,"e75\\test_pkg\\themepackage.pkg"),start_text, end_text)
+        self.assertEquals(PID,"99d49b086e6097b8")
+
+        
+if __name__ == '__main__':
+  unittest.main()