You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2012/10/09 06:03:58 UTC

svn commit: r1395855 - in /incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules: Integration/subModules_tester003.mxml SWFs/SubModuleTest_basic3.mxml SWFs/assets/ModuleLoadSubApp2.mxml SWFs/assets/ModuleLoadSubApp3.mxml

Author: aharui
Date: Tue Oct  9 04:03:58 2012
New Revision: 1395855

URL: http://svn.apache.org/viewvc?rev=1395855&view=rev
Log:
Use events instead of pauses so test is more stable.

Modified:
    incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/Integration/subModules_tester003.mxml
    incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/SubModuleTest_basic3.mxml
    incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/assets/ModuleLoadSubApp2.mxml
    incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/assets/ModuleLoadSubApp3.mxml

Modified: incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/Integration/subModules_tester003.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/Integration/subModules_tester003.mxml?rev=1395855&r1=1395854&r2=1395855&view=diff
==============================================================================
--- incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/Integration/subModules_tester003.mxml (original)
+++ incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/Integration/subModules_tester003.mxml Tue Oct  9 04:03:58 2012
@@ -78,11 +78,11 @@ testSWF="SubModuleTest_basic3.mxml">
 
 		        <RunCode code="FlexGlobals.topLevelApplication.loadContent('assets/SubApp1.swf');"  waitTarget="" waitEvent="SWFLoaded" />
 
-		        <Pause timeout="200"/>
+		        <WaitForLayoutManager />
 
 		    	<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.resetModuleLoader()" />
 
-		    	<Pause timeout="100"/>
+		    	<WaitForLayoutManager />
 
 		    	<SetProperty target="subAppRef.document.dg" propertyName="selectedIndex"  value="0" />
 
@@ -90,20 +90,20 @@ testSWF="SubModuleTest_basic3.mxml">
 
 		    <body>
 
-		    	<Pause timeout="100"/>
+				<WaitForLayoutManager />
 
-		    	<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.loadModule('assets/Module1.swf')"/>
+		    	<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.loadModule('assets/Module1.swf')" 
+						 waitEvent="ready" waitTarget="systemManager.info().currentDomain.getDefinition(mx.core.FlexGlobals).topLevelApplication.subAppRef.document.moduleLoader1" />
 
-		        <Pause timeout="200"/>
+		        <WaitForLayoutManager />
 
-		        <RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.moduleLoader1.child.loadModule1()"/>
+		        <RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.moduleLoader1.child.loadModule1()"
+						 waitEvent="ready" waitTarget="systemManager.info().currentDomain.getDefinition(mx.core.FlexGlobals).topLevelApplication.subAppRef.document.moduleLoader1.child.subModuleLoader1" />
 
-		       <Pause timeout="200"/>
+		        <WaitForLayoutManager />
 
 		        <AssertPropertyValue propertyName="text" target="subAppRef.document.moduleLoader1.child.subModuleLoader1.child.label1" value="SubModuleWithLabel loaded"/>
 
-		    	<Pause timeout="100"/>
-
 		    	<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.unloadModule()"/>
 
 		    </body>
@@ -122,11 +122,11 @@ testSWF="SubModuleTest_basic3.mxml">
 
 		    	<RunCode code="FlexGlobals.topLevelApplication.loadContent('assets/SubApp1.swf');"  waitTarget="" waitEvent="SWFLoaded" />
 
-		        <Pause timeout="200"/>
+		        <WaitForLayoutManager />
 
 		    	<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.resetModuleLoader()" />
 
-		    	<Pause timeout="100"/>
+		  	    <WaitForLayoutManager />
 
 		    	<SetProperty target="subAppRef.document.dg" propertyName="selectedIndex"  value="1" />
 
@@ -134,30 +134,26 @@ testSWF="SubModuleTest_basic3.mxml">
 
 		    <body>
 
-		        <Pause timeout="100"/>
-
-			<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.loadModule('assets/Module6.swf')"/>
+		        <WaitForLayoutManager />
 
-		        <Pause timeout="300"/>
+    			<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.loadModule('assets/Module6.swf')"
+						 waitEvent="ready" waitTarget="systemManager.info().currentDomain.getDefinition(mx.core.FlexGlobals).topLevelApplication.subAppRef.document.moduleLoader1" />
 
-		        <RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.moduleLoader1.child.loadModule1()"/>
+		        <WaitForLayoutManager />
 
-		        <Pause timeout="700"/>
+		        <RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.moduleLoader1.child.loadModule1()"
+						 waitEvent="moduleLoaded" waitTarget="systemManager.info().currentDomain.getDefinition(mx.core.FlexGlobals).topLevelApplication.subAppRef.document.moduleLoader1.child" />
 
-		        
+				<WaitForEvent eventName="moduleLoaded" target="systemManager.info().currentDomain.getDefinition(mx.core.FlexGlobals).topLevelApplication.subAppRef.document.moduleLoader1.child.subModuleLoader1.child" />
+				
+		        <WaitForLayoutManager />
 
 		        <RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.moduleLoader1.child.subModuleLoader1.child.addNumbers(5,7)"/>
 
-		        
-
-		        <Pause timeout="200"/>
+		        <WaitForLayoutManager />
 
 		        <AssertPropertyValue propertyName="text" target="subAppRef.document.moduleLoader1.child.subModuleLoader1.child.label1" value="12"/>
 
-		        
-
-		        <Pause timeout="100"/>
-
 		    	<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.unloadModule()"/>
 
 		    </body>
@@ -176,13 +172,13 @@ testSWF="SubModuleTest_basic3.mxml">
 
 		        <RunCode code="FlexGlobals.topLevelApplication.resetModuleLoader()"/>
 
-			<RunCode code="FlexGlobals.topLevelApplication.loadContent('assets/SubApp1.swf');"  waitTarget="" waitEvent="SWFLoaded" />
+			    <RunCode code="FlexGlobals.topLevelApplication.loadContent('assets/SubApp1.swf');"  waitTarget="" waitEvent="SWFLoaded" />
 
-			<Pause timeout="200"/>
+			    <WaitForLayoutManager />
 
-			<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.resetModuleLoader()" />
+		    	<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.resetModuleLoader()" />
 
-			<Pause timeout="100"/>
+	    		<WaitForLayoutManager />
 
 		    	<SetProperty target="subAppRef.document.dg" propertyName="selectedIndex"  value="2" />
 
@@ -190,29 +186,23 @@ testSWF="SubModuleTest_basic3.mxml">
 
 		    <body>
 
-		        <Pause timeout="100"/>
-
-			<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.loadModule('assets/Module4.swf')"/>
+		        <WaitForLayoutManager />
 
-		        <Pause timeout="500"/>
+				<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.loadModule('assets/Module4.swf')"
+						 waitEvent="moduleLoaded" waitTarget="systemManager.info().currentDomain.getDefinition(mx.core.FlexGlobals).topLevelApplication.subAppRef.document" />
 
-		        
+				<WaitForEvent eventName="moduleLoaded" target="systemManager.info().currentDomain.getDefinition(mx.core.FlexGlobals).topLevelApplication.subAppRef.document.moduleLoader1.child" />
+				
+		        <WaitForLayoutManager />
 
 		        <AssertPropertyValue propertyName="text" target="subAppRef.document.moduleLoader1.child.ccm.label1" value="SubModuleWithLabel loaded"/>
 
-		    	<Pause timeout="100"/>
-
 		    	<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.unloadModule()"/>
 
 		    </body>
 
 		</TestCase>
 
-		
-
-
-
-		
 
 		<TestCase testID="subAppWithSubModule_test4" keywords="[SubApplication, SubModule, ModuleLoader]" description="swfLoader=>subApp=>moduleLoader=>Module1(Modulemanager)=>subModule(ModuleManager):load a sub application which loads module created in moduleManager, subModule is loaded by using ModuleLoader" >
 
@@ -222,11 +212,11 @@ testSWF="SubModuleTest_basic3.mxml">
 
 		    	<RunCode code="FlexGlobals.topLevelApplication.loadContent('assets/SubApp1.swf');"  waitTarget="" waitEvent="SWFLoaded" />
 
-			<Pause timeout="200"/>
+    			<WaitForLayoutManager />
 
-			<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.resetModuleLoader()" />
+	    		<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.resetModuleLoader()" />
 
-			<Pause timeout="100"/>
+		    	<WaitForLayoutManager />
 
 		    	<SetProperty target="subAppRef.document.dg" propertyName="selectedIndex"  value="3" />
 
@@ -234,23 +224,16 @@ testSWF="SubModuleTest_basic3.mxml">
 
 		    <body>
 
-		       
+    			<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.loadModule('assets/Module5.swf')"
+					 waitEvent="ready" waitTarget="systemManager.info().currentDomain.getDefinition(mx.core.FlexGlobals).topLevelApplication.subAppRef.document.moduleLoader1"/>
 
-			<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.loadModule('assets/Module5.swf')"/>
-
-			<Pause timeout="1000"/>
+	    		<WaitForLayoutManager />
 
 		        <RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.moduleLoader1.child.vg.getChildAt(0).addNumbers(5,7)"/>
 
-					        
-
-			<Pause timeout="300"/>
+    			<WaitForLayoutManager />
 
-			<AssertPropertyValue propertyName="text" target="subAppRef.document.moduleLoader1.child.vg.getChildAt(0).label1" value="12"/>
-
-
-
-			<Pause timeout="100"/>
+    			<AssertPropertyValue propertyName="text" target="subAppRef.document.moduleLoader1.child.vg.getChildAt(0).label1" value="12"/>
 
 		    	<RunCode code="FlexGlobals.topLevelApplication.subAppRef.document.unloadModule()"/>
 
@@ -270,19 +253,15 @@ testSWF="SubModuleTest_basic3.mxml">
 
 		    	<RunCode code="FlexGlobals.topLevelApplication.loadModule('assets/ModuleLoadSubApp3.swf');"  waitTarget="" waitEvent="moduleLoaded" />
 
-		   </setup>
-
-		    <body>
-
-		        <Pause timeout="1000"/>
+				<WaitForEvent eventName="SWFLoaded" target="systemManager.info().currentDomain.getDefinition(mx.core.FlexGlobals).topLevelApplication.moduleLoader1.child" />
 
-		     
+			</setup>
 
-		        <AssertPropertyValue propertyName="text" target="moduleLoader1.child.subAppRef.document.moduleLoader1.child.label1" value="SubModuleWithLabel loaded"/>
+		    <body>
 
-		        
+		        <WaitForLayoutManager />
 
-		        <Pause timeout="100"/>
+				<AssertPropertyValue propertyName="text" target="moduleLoader1.child.subAppRef.document.moduleLoader1.child.label1" value="SubModuleWithLabel loaded"/>
 
 		    	<RunCode code="FlexGlobals.topLevelApplication.moduleLoader1.unloadModule()"/>
 
@@ -298,31 +277,22 @@ testSWF="SubModuleTest_basic3.mxml">
 
 		    	<RunCode code="FlexGlobals.topLevelApplication.resetModuleLoader()"/>
 
-		    	
-
 		    	<RunCode code="FlexGlobals.topLevelApplication.loadModule('assets/ModuleLoadSubApp2.swf');"  waitTarget="" waitEvent="moduleLoaded" />
-
 		
+				<WaitForEvent eventName="SWFLoaded" target="systemManager.info().currentDomain.getDefinition(mx.core.FlexGlobals).topLevelApplication.moduleLoader1.child" />
 
 		   </setup>
 
 		    <body>
 
-		        <Pause timeout="600"/>
-
-		
-
-		        <RunCode code="FlexGlobals.topLevelApplication.moduleLoader1.child.subAppRef.document.loadModule('assets/TitleWindowModule.swf')"/>
-
-								        
-
-			<Pause timeout="400"/>
+		        <WaitForLayoutManager />
 
-			<AssertPropertyValue propertyName="text" target="moduleLoader1.child.subAppRef.document.moduleLoader1.child.tw.label1" value="SimpleTitleWindow loaded"/>
+		        <RunCode code="FlexGlobals.topLevelApplication.moduleLoader1.child.subAppRef.document.loadModule('assets/TitleWindowModule.swf')"
+						 waitEvent="moduleLoaded" waitTarget="systemManager.info().currentDomain.getDefinition(mx.core.FlexGlobals).topLevelApplication.moduleLoader1.child.subAppRef.document" />
 
+    			<WaitForLayoutManager />
 
-
-			<Pause timeout="100"/>
+    			<AssertPropertyValue propertyName="text" target="moduleLoader1.child.subAppRef.document.moduleLoader1.child.tw.label1" value="SimpleTitleWindow loaded"/>
 
 		    	<RunCode code="FlexGlobals.topLevelApplication.moduleLoader1.unloadModule()"/>
 
@@ -338,35 +308,27 @@ testSWF="SubModuleTest_basic3.mxml">
 
 		        <RunCode code="FlexGlobals.topLevelApplication.resetModuleLoader()"/>
 
-		    	
-
 		    	<RunCode code="FlexGlobals.topLevelApplication.loadModule('assets/ModuleLoadSubApp2.swf');"  waitTarget="" waitEvent="moduleLoaded" />
 
-		
-
+				<WaitForEvent eventName="SWFLoaded" target="systemManager.info().currentDomain.getDefinition(mx.core.FlexGlobals).topLevelApplication.moduleLoader1.child" />
 		   </setup>
 
 		    <body>
 
-		        <Pause timeout="600"/>
-
-		
-
-		        <RunCode code="FlexGlobals.topLevelApplication.moduleLoader1.child.subAppRef.document.loadModule('assets/SimpleASModuleTest.swf')"/>
-
-			<Pause timeout="400"/>				        
-
-			<RunCode code="FlexGlobals.topLevelApplication.moduleLoader1.child.subAppRef.document.moduleLoader1.child.addNumbers(5,7)"/>
-
-								        
+		        <WaitForLayoutManager />
 
-			<Pause timeout="200"/>
+		        <RunCode code="FlexGlobals.topLevelApplication.moduleLoader1.child.subAppRef.document.loadModule('assets/SimpleASModuleTest.swf')"
+						 waitEvent="moduleLoaded" waitTarget="systemManager.info().currentDomain.getDefinition(mx.core.FlexGlobals).topLevelApplication.moduleLoader1.child.subAppRef.document" />
 
-			<AssertPropertyValue propertyName="text" target="moduleLoader1.child.subAppRef.document.moduleLoader1.child.label1" value="12"/>
+				<WaitForEvent eventName="moduleLoaded" target="systemManager.info().currentDomain.getDefinition(mx.core.FlexGlobals).topLevelApplication.moduleLoader1.child.subAppRef.document.moduleLoader1.child" />
 
+				<WaitForLayoutManager />				        
 
+			    <RunCode code="FlexGlobals.topLevelApplication.moduleLoader1.child.subAppRef.document.moduleLoader1.child.addNumbers(5,7)"/>
+				        
+				<WaitForLayoutManager />
 
-			<Pause timeout="100"/>
+    			<AssertPropertyValue propertyName="text" target="moduleLoader1.child.subAppRef.document.moduleLoader1.child.label1" value="12"/>
 
 		    	<RunCode code="FlexGlobals.topLevelApplication.moduleLoader1.unloadModule()"/>
 

Modified: incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/SubModuleTest_basic3.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/SubModuleTest_basic3.mxml?rev=1395855&r1=1395854&r2=1395855&view=diff
==============================================================================
--- incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/SubModuleTest_basic3.mxml (original)
+++ incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/SubModuleTest_basic3.mxml Tue Oct  9 04:03:58 2012
@@ -50,14 +50,15 @@
 	
 	<fx:Script>
 		<![CDATA[
-			import mx.events.ModuleEvent;	
-			import mx.events.FlexEvent;	
 			import flash.events.Event;
-			import mx.controls.Alert;	
+			
 			import mx.collections.ArrayList;
+			import mx.controls.Alert;
+			import mx.core.IUIComponent;
+			import mx.events.FlexEvent;
+			import mx.events.ModuleEvent;
 			import mx.managers.PopUpManager;
 			import mx.managers.SystemManager;
-			import mx.core.IUIComponent;
 			
 			PopUpManager;
 			private var moduleErrorMsg:String="";
@@ -66,12 +67,18 @@
 			public function handleSWFLoaded(e:Event):void
 			{
 				e.currentTarget.removeEventListener("complete", handleSWFLoaded);
-				dispatchEvent(new FlexEvent("SWFLoaded")); 
 				subAppRef=(contentLoader.content as SystemManager);
+				subAppRef.addEventListener(FlexEvent.APPLICATION_COMPLETE, handleSWFLoadedAndReady);
 				trace("subAppRef="+subAppRef);
 				
 				
 			}
+			public function handleSWFLoadedAndReady(e:Event):void
+			{
+				subAppRef.removeEventListener(FlexEvent.APPLICATION_COMPLETE, handleSWFLoadedAndReady);
+				dispatchEvent(new FlexEvent("SWFLoaded")); 	
+			}
+			
 			public function handleSWFLoadedError(e:Event):void
 			{
 				e.currentTarget.removeEventListener("error", handleSWFLoaded);

Modified: incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/assets/ModuleLoadSubApp2.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/assets/ModuleLoadSubApp2.mxml?rev=1395855&r1=1395854&r2=1395855&view=diff
==============================================================================
--- incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/assets/ModuleLoadSubApp2.mxml (original)
+++ incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/assets/ModuleLoadSubApp2.mxml Tue Oct  9 04:03:58 2012
@@ -53,17 +53,18 @@
 			public var subAppRef:SystemManager;
 
 			public function handleSWFLoaded(e:Event):void
-
 			{
-
 				e.currentTarget.removeEventListener("complete", handleSWFLoaded);
-
-				dispatchEvent(new FlexEvent("SWFLoaded"));
-
 				subAppRef=(contentLoader.content as SystemManager);
-
-				trace("###swf loaded");
-
+				subAppRef.addEventListener(FlexEvent.APPLICATION_COMPLETE, handleSWFLoadedAndReady);
+				trace("subAppRef="+subAppRef);
+				
+				
+			}
+			public function handleSWFLoadedAndReady(e:Event):void
+			{
+				subAppRef.removeEventListener(FlexEvent.APPLICATION_COMPLETE, handleSWFLoadedAndReady);
+				dispatchEvent(new FlexEvent("SWFLoaded")); 	
 			}
 
 			public function handleSWFLoadedError(e:Event):void

Modified: incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/assets/ModuleLoadSubApp3.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/assets/ModuleLoadSubApp3.mxml?rev=1395855&r1=1395854&r2=1395855&view=diff
==============================================================================
--- incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/assets/ModuleLoadSubApp3.mxml (original)
+++ incubator/flex/sdk/branches/develop/mustella/tests/SparkModules/SubModules/SWFs/assets/ModuleLoadSubApp3.mxml Tue Oct  9 04:03:58 2012
@@ -53,17 +53,18 @@
 			public var subAppRef:SystemManager;
 
 			public function handleSWFLoaded(e:Event):void
-
 			{
-
 				e.currentTarget.removeEventListener("complete", handleSWFLoaded);
-
-				dispatchEvent(new FlexEvent("SWFLoaded"));
-
 				subAppRef=(contentLoader.content as SystemManager);
-
-				trace("###swf loaded");
-
+				subAppRef.addEventListener(FlexEvent.APPLICATION_COMPLETE, handleSWFLoadedAndReady);
+				trace("subAppRef="+subAppRef);
+				
+				
+			}
+			public function handleSWFLoadedAndReady(e:Event):void
+			{
+				subAppRef.removeEventListener(FlexEvent.APPLICATION_COMPLETE, handleSWFLoadedAndReady);
+				dispatchEvent(new FlexEvent("SWFLoaded")); 	
 			}
 
 			public function handleSWFLoadedError(e:Event):void