You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cf...@apache.org on 2012/09/18 23:43:49 UTC

svn commit: r1387371 - in /incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion: SWFs/comps/button_swf_runtime.mxml Styles/Accordion_SkinStates_Basic.mxml Styles/Accordion_SkinStates_Basic_Spark.mxml

Author: cframpton
Date: Tue Sep 18 21:43:49 2012
New Revision: 1387371

URL: http://svn.apache.org/viewvc?rev=1387371&view=rev
Log:
Another pass at the timing issues around runtime loading of SWFs.

Modified:
    incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/SWFs/comps/button_swf_runtime.mxml
    incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/Styles/Accordion_SkinStates_Basic.mxml
    incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/Styles/Accordion_SkinStates_Basic_Spark.mxml

Modified: incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/SWFs/comps/button_swf_runtime.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/SWFs/comps/button_swf_runtime.mxml?rev=1387371&r1=1387370&r2=1387371&view=diff
==============================================================================
--- incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/SWFs/comps/button_swf_runtime.mxml (original)
+++ incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/SWFs/comps/button_swf_runtime.mxml Tue Sep 18 21:43:49 2012
@@ -17,60 +17,8 @@
   limitations under the License.
 
 -->
-<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" currentStateChange="currentStateChangeHandler(event)">	
-    <mx:Script>
-        <![CDATA[    	     
-            import flash.events.IEventDispatcher;
-
-            private function currentStateChangeHandler(event:Event):void
-            {
-                 checkIfImageLoaded();
-            }
- 
-            private function completeHandler(event:Event):void
-            {
-                checkIfImageLoaded();
-            }
-            
-            // For the runtime SWF tests we want also want to know the image is loaded even
-            // if it has already been loaded so we can wait on an event for every test.
-            private function checkIfImageLoaded():void
-            {
-                if (!parentApplication || !parentApplication.accordion_1 is IEventDispatcher)
-                    return;
-                
-                var loaded:Boolean = false;
-                
-                switch (currentState)
-                {
-                    case "over":
-                        if (overImage.bytesLoaded == overImage.bytesTotal)
-                            loaded = true;   
-                        break;
-                    case "selectedOver":
-                        if (selectedOverImage.bytesLoaded == selectedOverImage.bytesTotal)
-                            loaded = true;   
-                        break;
-                    case "down":
-                        if (downImage.bytesLoaded == downImage.bytesTotal)
-                            loaded = true;   
-                       break;
-                    case "selectedDown":
-                        if (selectedDownImage.bytesLoaded == selectedDownImage.bytesTotal)
-                            loaded = true;   
-                        break;
-                        
-                }
-                
-                if (loaded)
-                {
-                    var accordion_1:IEventDispatcher = IEventDispatcher(parentApplication.accordion_1);
-                    accordion_1.dispatchEvent(new Event(currentState + "ImageLoaded"));                                      
-                }
-             }
-        ]]>   
-    </mx:Script>
-	<mx:states>
+<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml">	
+ 	<mx:states>
 		<mx:State name="notBase">
 			<mx:RemoveChild target="{baseButton}"/>
 		</mx:State>
@@ -78,47 +26,47 @@
 		<mx:State name="over" basedOn="notBase">
 			<mx:AddChild creationPolicy="all">
 				<mx:Image id="overImage" source="../../../../Assets/Images/ButtonImages/buttonOver.swf" 
-                    complete="completeHandler(event)" maintainAspectRatio="false" width="100%" height="100%"/> 
+                          complete="trace(event.currentTarget, event)" maintainAspectRatio="false" width="100%" height="100%"/> 
 			</mx:AddChild>
 		</mx:State>
 		<mx:State name="down" basedOn="notBase">
 			<mx:AddChild creationPolicy="all">
 				<mx:Image id="downImage" source="../../../../Assets/Images/ButtonImages/buttonDown.swf" 
-                          complete="completeHandler(event)" maintainAspectRatio="false" width="100%" height="100%"/> 
+                          complete="trace(event.currentTarget, event)" maintainAspectRatio="false" width="100%" height="100%"/> 
 			</mx:AddChild>
 		</mx:State>
 		<mx:State name="disabled" basedOn="notBase">
 			<mx:AddChild creationPolicy="all">
-				<mx:Image id="disabled" source="../../../../Assets/Images/ButtonImages/buttonDisabled.swf" 
-                          maintainAspectRatio="false" width="100%" height="100%"/> 
+				<mx:Image id="disabledImage" source="../../../../Assets/Images/ButtonImages/buttonDisabled.swf" 
+                          complete="trace(event.currentTarget, event)" maintainAspectRatio="false" width="100%" height="100%"/> 
 			</mx:AddChild>
 		</mx:State>
 		<mx:State name="selectedUp" basedOn="notBase">
 			<mx:AddChild creationPolicy="all">
-				<mx:Image id="selectedUp" source="../../../../Assets/Images/ButtonImages/buttonSelectedUp.swf" 
-                          maintainAspectRatio="false" width="100%" height="100%"/> 
+				<mx:Image id="selectedUpImage" source="../../../../Assets/Images/ButtonImages/buttonSelectedUp.swf" 
+                          complete="trace(event.currentTarget, event)" maintainAspectRatio="false" width="100%" height="100%"/> 
 			</mx:AddChild>
 		</mx:State>
 		<mx:State name="selectedOver" basedOn="notBase">
 			<mx:AddChild creationPolicy="all">
 				<mx:Image id="selectedOverImage" source="../../../../Assets/Images/ButtonImages/buttonSelectedOver.swf" 
-                          complete="completeHandler(event)" maintainAspectRatio="false" width="100%" height="100%"/> 
+                          complete="trace(event.currentTarget, event)" maintainAspectRatio="false" width="100%" height="100%"/> 
 			</mx:AddChild>
 		</mx:State>
 		<mx:State name="selectedDown" basedOn="notBase">
 			<mx:AddChild creationPolicy="all">
 				<mx:Image id="selectedDownImage" source="../../../../Assets/Images/ButtonImages/buttonSelectedDown.swf" 
-                          complete="completeHandler(event)" maintainAspectRatio="false" width="100%" height="100%"/> 
+                          complete="trace(event.currentTarget, event)" maintainAspectRatio="false" width="100%" height="100%"/> 
 			</mx:AddChild>
 		</mx:State>
 		<mx:State name="selectedDisabled" basedOn="notBase">
 			<mx:AddChild creationPolicy="all">
-				<mx:Image id="selectedDisabled" source="../../../../Assets/Images/ButtonImages/buttonSelectedDown.swf" 
-                          maintainAspectRatio="false" width="100%" height="100%"/> 
+				<mx:Image id="selectedDisabledImage" source="../../../../Assets/Images/ButtonImages/buttonSelectedDown.swf" 
+                          complete="trace(event.currentTarget, event)"  maintainAspectRatio="false" width="100%" height="100%"/> 
 			</mx:AddChild>
 		</mx:State>
 	</mx:states>
 		
 	<mx:Image id="baseButton" source="../../../../Assets/Images/ButtonImages/buttonUp.swf" 
-              maintainAspectRatio="false"  width="100%" height="100%"/>
+              maintainAspectRatio="false" width="100%" height="100%"/>
 </mx:Canvas>
\ No newline at end of file

Modified: incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/Styles/Accordion_SkinStates_Basic.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/Styles/Accordion_SkinStates_Basic.mxml?rev=1387371&r1=1387370&r2=1387371&view=diff
==============================================================================
--- incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/Styles/Accordion_SkinStates_Basic.mxml (original)
+++ incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/Styles/Accordion_SkinStates_Basic.mxml Tue Sep 18 21:43:49 2012
@@ -390,7 +390,9 @@
 
                 <SetStyle target="accordion_1" styleName="headerStyleName" value="myAccordionSWFRunTime" waitEvent="updateComplete" waitTarget="accordion_1" />
                 <DispatchMouseEvent type="rollOver" localX="10" localY="10" target="accordion_1" waitEvent="rollOver" waitTarget="accordion_1" />
+                <WaitForEvent eventName="complete" target="accordion_1.rawChildren.getChildAt(3).getChildAt(0).selectedOverImage" />
                 <WaitForEffectsToEnd />
+                <WaitForLayoutManager />
             </setup>
             <body>
                 <CompareBitmap target="accordion_1" url="../Styles/baselines/Accordion_Styles_SkinStates_runtime_SWF_mouseOver_selectedTab.png"  numColorVariances="4" ignoreMaxColorVariance="true" timeout="5000" />
@@ -402,7 +404,9 @@
 
                 <SetStyle target="accordion_1" styleName="headerStyleName" value="myAccordionSWFRunTime" waitEvent="updateComplete" waitTarget="accordion_1" />
                 <DispatchMouseEvent type="rollOver" localX="10" localY="82" target="accordion_1" waitEvent="rollOver" waitTarget="accordion_1" />
+                <WaitForEvent eventName="complete" target="accordion_1.rawChildren.getChildAt(4).getChildAt(0).overImage" />
                 <WaitForEffectsToEnd />
+                <WaitForLayoutManager />
             </setup>
             <body>
                 <CompareBitmap target="accordion_1" url="../Styles/baselines/Accordion_Styles_SkinStates_runtime_SWF_mouseOver_NonselectedTab.png"  numColorVariances="4" ignoreMaxColorVariance="true" timeout="5000" />
@@ -415,7 +419,9 @@
                 <SetStyle target="accordion_1" styleName="headerStyleName" value="myAccordionSWFRunTime" waitEvent="updateComplete" waitTarget="accordion_1" />
                 <DispatchMouseEvent type="rollOver" localX="10" localY="10" target="accordion_1" waitEvent="rollOver" waitTarget="accordion_1" />
                 <DispatchMouseEvent type="mouseDown" localX="10" localY="10" target="accordion_1" waitEvent="mouseDown" waitTarget="accordion_1" />
+                <WaitForEvent eventName="complete" target="accordion_1.rawChildren.getChildAt(3).getChildAt(0).selectedDownImage" />
                 <WaitForEffectsToEnd />
+                <WaitForLayoutManager />
             </setup>
             <body>
                 <CompareBitmap target="accordion_1" url="../Styles/baselines/Accordion_Styles_SkinStates_runtime_SWF_mouseDown_selectedTab.png"  numColorVariances="4" ignoreMaxColorVariance="true" timeout="5000" />
@@ -428,7 +434,9 @@
                 <SetStyle target="accordion_1" styleName="headerStyleName" value="myAccordionSWFRunTime" waitEvent="updateComplete" waitTarget="accordion_1" />
                 <DispatchMouseEvent type="rollOver" localX="10" localY="82" target="accordion_1" waitEvent="rollOver" waitTarget="accordion_1" />
                 <DispatchMouseEvent type="mouseDown" localX="10" localY="82" target="accordion_1" waitEvent="mouseDown" waitTarget="accordion_1" />
+                <WaitForEvent eventName="complete" target="accordion_1.rawChildren.getChildAt(4).getChildAt(0).downImage" />
                 <WaitForEffectsToEnd />
+                <WaitForLayoutManager />
             </setup>
             <body>
                 <CompareBitmap target="accordion_1" url="../Styles/baselines/Accordion_Styles_SkinStates_runtime_SWF_mouseDown_NonselectedTab.png"  numColorVariances="4" ignoreMaxColorVariance="true" timeout="5000" />

Modified: incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/Styles/Accordion_SkinStates_Basic_Spark.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/Styles/Accordion_SkinStates_Basic_Spark.mxml?rev=1387371&r1=1387370&r2=1387371&view=diff
==============================================================================
--- incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/Styles/Accordion_SkinStates_Basic_Spark.mxml (original)
+++ incubator/flex/sdk/branches/develop/mustella/tests/containers/Accordion/Styles/Accordion_SkinStates_Basic_Spark.mxml Tue Sep 18 21:43:49 2012
@@ -37,13 +37,15 @@
     <mx:Script>
     <![CDATA[
 
-    import mx.containers.*
-    import mx.controls.*
-    import mx.styles.StyleManager;
-    import mx.managers.SystemManager;
-
-
-
+        import mx.containers.*
+        import mx.controls.*
+        import mx.styles.StyleManager;
+        import mx.managers.SystemManager;
+        
+        // an image in header1 is
+        //      accordion_1.rawChildren.getChildAt(3).getChildAt(0).overImage
+        // an image in header2 is
+        //      accordion_1.rawChildren.getChildAt(4).getChildAt(0).overImage        
     ]]>
     </mx:Script>
 <mx:Style>
@@ -444,6 +446,7 @@
                 <ResetComponent target="accordion_1" className="AccordionComp2"  waitEvent="updateComplete" waitTarget="accordion_1"/>
 
                 <SetStyle target="accordion_1" styleName="headerStyleName" value="myAccordionSWFRunTime" waitEvent="updateComplete" waitTarget="accordion_1" />
+                <WaitForLayoutManager/>
             </setup>
             <body>
                 <CompareBitmap target="accordion_1" url="../Styles/baselines/spark/Accordion_Styles_SkinStates_runtime_SWF.png" numColorVariances="2" ignoreMaxColorVariance="true" timeout="5000" />
@@ -454,12 +457,12 @@
                 <ResetComponent target="accordion_1" className="AccordionComp2"  waitEvent="updateComplete" waitTarget="accordion_1"/>
                  
                 <SetStyle target="accordion_1" styleName="headerStyleName" value="myAccordionSWFRunTime" waitEvent="updateComplete" waitTarget="accordion_1" />
-                <DispatchMouseEvent type="rollOver" localX="10" localY="10" target="accordion_1" waitEvent="selectedOverImageLoaded" waitTarget="accordion_1" />
-                <!--WaitForEvent eventName="selectedOverImageLoaded" target="accordion_1" numExpectedEvents="1"/-->
+                <DispatchMouseEvent type="rollOver" localX="10" localY="10" target="accordion_1" waitEvent="rollOver"/>
+                <!--WaitForEvent eventName="complete" target="accordion_1.rawChildren.getChildAt(3).getChildAt(0).selectedOverImage" /-->
                 <WaitForEffectsToEnd />
+                <WaitForLayoutManager/>
             </setup>
             <body>
-                <WaitForLayoutManager/>
                 <CompareBitmap target="accordion_1" url="../Styles/baselines/spark/Accordion_Styles_SkinStates_runtime_SWF_mouseOver_selectedTab.png" numColorVariances="2" ignoreMaxColorVariance="true" timeout="5000" />
             </body>
         </TestCase>
@@ -468,12 +471,12 @@
                 <ResetComponent target="accordion_1" className="AccordionComp2"  waitEvent="updateComplete" waitTarget="accordion_1"/>
 
                 <SetStyle target="accordion_1" styleName="headerStyleName" value="myAccordionSWFRunTime" waitEvent="updateComplete" waitTarget="accordion_1" />
-                <DispatchMouseEvent type="rollOver" localX="10" localY="82" target="accordion_1" waitEvent="overImageLoaded" waitTarget="accordion_1" />
-                <!--WaitForEvent eventName="overImageLoaded" target="accordion_1"/-->
+                <DispatchMouseEvent type="rollOver" localX="10" localY="82" target="accordion_1" waitEvent="rollOver"/>
+                <!--WaitForEvent eventName="complete" target="accordion_1.rawChildren.getChildAt(4).getChildAt(0).overImage" /-->
                 <WaitForEffectsToEnd />
+                <WaitForLayoutManager/>
             </setup>
             <body>
-                <WaitForLayoutManager/>
                 <CompareBitmap target="accordion_1" url="../Styles/baselines/spark/Accordion_Styles_SkinStates_runtime_SWF_mouseOver_NonselectedTab.png" numColorVariances="2" ignoreMaxColorVariance="true" timeout="5000" />
             </body>
         </TestCase>
@@ -483,12 +486,12 @@
 
                 <SetStyle target="accordion_1" styleName="headerStyleName" value="myAccordionSWFRunTime" waitEvent="updateComplete" waitTarget="accordion_1" />
                 <DispatchMouseEvent type="rollOver" localX="10" localY="10" target="accordion_1" waitEvent="rollOver" waitTarget="accordion_1" />
-                <DispatchMouseEvent type="mouseDown" localX="10" localY="10" target="accordion_1" waitEvent="selectedDownImageLoaded" waitTarget="accordion_1" />
-                <!--WaitForEvent eventName="selectedDownImageLoaded" target="accordion_1"/-->
+                <DispatchMouseEvent type="mouseDown" localX="10" localY="10" target="accordion_1" waitEvent="mouseDown" waitTarget="accordion_1"/> 
+                <!--WaitForEvent eventName="complete" target="accordion_1.rawChildren.getChildAt(3).getChildAt(0).selectedDownImage"/-->
                 <WaitForEffectsToEnd />
+                <WaitForLayoutManager/>
             </setup>
             <body>
-                <WaitForLayoutManager/>
                 <CompareBitmap target="accordion_1" url="../Styles/baselines/spark/Accordion_Styles_SkinStates_runtime_SWF_mouseDown_selectedTab.png" numColorVariances="2" ignoreMaxColorVariance="true" timeout="5000" />
             </body>
         </TestCase>
@@ -498,20 +501,18 @@
 
                 <SetStyle target="accordion_1" styleName="headerStyleName" value="myAccordionSWFRunTime" waitEvent="updateComplete" waitTarget="accordion_1" />
                 <DispatchMouseEvent type="rollOver" localX="10" localY="82" target="accordion_1" waitEvent="rollOver" waitTarget="accordion_1" />
-                <DispatchMouseEvent type="mouseDown" localX="10" localY="82" target="accordion_1" waitEvent="downImageLoaded" waitTarget="accordion_1" />
-                <!--WaitForEvent eventName="downImageLoaded" target="accordion_1"/-->
+                <DispatchMouseEvent type="mouseDown" localX="10" localY="82" target="accordion_1" waitEvent="mouseDown"/>
+                <WaitForEvent eventName="complete" target="accordion_1.rawChildren.getChildAt(4).getChildAt(0).downImage" />
                 <WaitForEffectsToEnd />
+                <WaitForLayoutManager/>
             </setup>
             <body>
-                <WaitForLayoutManager/>
                 <CompareBitmap target="accordion_1" url="../Styles/baselines/spark/Accordion_Styles_SkinStates_runtime_SWF_mouseDown_NonselectedTab.png" numColorVariances="2" ignoreMaxColorVariance="true" timeout="5000" />
             </body>
         </TestCase>
         <TestCase testID="Accordion_Styles_SkinStates_Embeding_JPGIcon" keywords="[enabled, SkinStates,EmbedJPGIcon, Accordion]" >
             <setup>
                 <ResetComponent target="accordion_1" className="AccordionComp2"  waitEvent="updateComplete" waitTarget="accordion_1"/>
-
-
                 <SetStyle target="accordion_1" styleName="headerStyleName" value="myAccordionJPGIcon" waitEvent="updateComplete" waitTarget="accordion_1" />
             </setup>
             <body>