configurationengine/source/plugins/symbian/ConeImagePlugin/imageplugin/tests/unittest_imageml_plugin.py
changeset 3 e7e0ae78773e
parent 0 2e8eeb919028
--- a/configurationengine/source/plugins/symbian/ConeImagePlugin/imageplugin/tests/unittest_imageml_plugin.py	Fri Mar 12 08:30:17 2010 +0200
+++ b/configurationengine/source/plugins/symbian/ConeImagePlugin/imageplugin/tests/unittest_imageml_plugin.py	Tue Aug 10 14:29:28 2010 +0300
@@ -15,15 +15,9 @@
 #
 
 import unittest
-import os, shutil, re
-import sys
-import logging
-import shutil
-import __init__
-		
-from cone.public import exceptions,plugin,api,container
-from cone.storage import filestorage
-from imageplugin import imageml
+import sys, os, re
+
+from cone.public import plugin,api
 from testautomation.base_testcase import BaseTestCase
 
 ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
@@ -39,10 +33,12 @@
             
             prj = api.Project(api.Storage.open(os.path.join(ROOT_PATH,"imageproject")))
             config = prj.get_configuration('product.confml')
-            implcontainer = plugin.get_impl_set(config, 'imageml$')
-            self.assertEquals(len(implcontainer), 4)
-            implcontainer.output = output
-            implcontainer.generate()
+            context = plugin.GenerationContext(configuration=config, output=output)
+            context.filtering_disabled = True
+            
+            impl_set = plugin.get_impl_set(config, 'imageml$')
+            self.assertEquals(len(impl_set), 5)
+            impl_set.generate(context)
             
             def check_gen(p):
                 self.assert_exists_and_contains_something(os.path.join(output, p))
@@ -50,33 +46,33 @@
                 self.assertFalse(os.path.exists(os.path.join(output, p)), "'%s' exists when it should not!" % p)
             
             try:
-	            check_gen('startup.mbm')
-	            check_gen('startup_mif.mif')
-	            
-	            check_not_gen('optional1_mbm.mbm')
-	            check_gen('optional2_mbm.mbm')
-	            check_not_gen('optional3_mbm.mbm')
-	            check_not_gen('optional4_mbm.mbm')
-	            
-	            check_not_gen('optional1_mif.mif')
-	            check_gen('optional2_mif.mif')
-	            check_not_gen('optional3_mif.mif')
-	            check_not_gen('optional4_mif.mif')
-	            
-	            check_gen('resource/apps/startup.mif')
-	            
-	            check_gen('depth_from_ref_test_mbm.mbm')
-	            check_gen('depth_from_ref_test_mif.mif')
-    	    except AssertionError:
-	            if ' ' in ROOT_PATH:
-	                self.fail("Known bug (#177)")
-	            else:
-	                raise
+                check_gen('startup.mbm')
+                check_gen('startup_mif.mif')
+                
+                check_not_gen('optional1_mbm.mbm')
+                check_gen('optional2_mbm.mbm')
+                check_not_gen('optional3_mbm.mbm')
+                check_not_gen('optional4_mbm.mbm')
+                
+                check_not_gen('optional1_mif.mif')
+                check_gen('optional2_mif.mif')
+                check_not_gen('optional3_mif.mif')
+                check_not_gen('optional4_mif.mif')
+                
+                check_gen('resource/apps/startup.mif')
+                
+                check_gen('depth_from_ref_test_mbm.mbm')
+                check_gen('depth_from_ref_test_mif.mif')
+            except AssertionError, e:
+                if ' ' in ROOT_PATH:
+                    self.fail("Known bug (#177): %s" % e)
+                else:
+                    raise
         finally:
             os.chdir(orig_workdir)
     
     def _get_impl(self, filename):
-    	prj = api.Project(api.Storage.open(os.path.join(ROOT_PATH, "imageproject")))
+        prj = api.Project(api.Storage.open(os.path.join(ROOT_PATH, "imageproject")))
         config = prj.get_configuration('product.confml')
         implcontainer = plugin.get_impl_set(config, re.escape(filename) + '$')
         self.assertEquals(len(implcontainer), 1)
@@ -84,20 +80,24 @@
         
     
     def test_get_refs(self):
-    	impl = self._get_impl('startupmif_animation.imageml')
-    	self.assertEquals(impl.get_refs(), None)
-    	self.assertEquals(impl.has_ref('Foo.Bar'), None)
-    	
-    	impl = self._get_impl('optional_test.imageml')
-    	self.assertEquals(impl.get_refs(), ['OptionalTest.EmptyString',
-										    'OptionalTest.EmptyString2'])
-    	self.assertEquals(impl.has_ref('OptionalTest.EmptyString'), True)
-    	self.assertEquals(impl.has_ref('Foo.Foo'), False)
-    	
-    	impl = self._get_impl('startup_animation.imageml')
-    	self.assertEquals(impl.get_refs(), ['CVC_StartupAnimationSequence.CVC_StartupFrameLocation.localPath'])
-    	self.assertEquals(impl.has_ref('CVC_StartupAnimationSequence.CVC_StartupFrameLocation.localPath'), True)
-    	self.assertEquals(impl.has_ref('Foo.Foo'), False)
+        impl = self._get_impl('startupmif_animation.imageml')
+        self.assertEquals(impl.get_refs(), None)
+        self.assertEquals(impl.has_ref('Foo.Bar'), None)
+        
+        impl = self._get_impl('optional_test.imageml')
+        self.assertEquals(impl.get_refs(), ['OptionalTest.EmptyString',
+                                            'OptionalTest.EmptyString2'])
+        self.assertEquals(impl.has_ref('OptionalTest.EmptyString'), True)
+        self.assertEquals(impl.has_ref('Foo.Foo'), False)
+        
+        impl = self._get_impl('startup_animation.imageml')
+        self.assertEquals(impl.get_refs(), ['CVC_StartupAnimationSequence.CVC_StartupFrameLocation.localPath'])
+        self.assertEquals(impl.has_ref('CVC_StartupAnimationSequence.CVC_StartupFrameLocation.localPath'), True)
+        self.assertEquals(impl.has_ref('Foo.Foo'), False)
+
+# Only run these tests on Windows
+if sys.platform != 'win32':
+    del TestGeneratorFromProject
 
 if __name__ == '__main__':
     unittest.main()