1 Reply Latest reply on Oct 19, 2011 9:03 AM by mlabriola

    Spark Classes and Skins not being included when running FlexUnit task via Ant

    ccdfroggman2k

      I have a series of unit tests that run on a spark component. This spark component has a custom skin defined for it, and that is working beautifully.

       

      Inside that component is a spark list... By default, after digging into the list code, spark lists should use a default skin called "BorderContainerSkin". When I run the application that uses this component directly (whether compiled via FlashBuilder or via Ant/Hudson), the component itself runs and looks exactly like I would expect. When I run my unit tests in the browser (via Run As Web Application command on my TestRunner), the unit tests all perform as expected.

       

      However, when I run the FlexUnit tests via Ant (either through windows non-headless, or linux headless), an exception is thrown with the following error:

       

      Error: Skin for FromToList132.FromToListSkin133.VGroup134.fromList cannot be found.

          at spark.components.supportClasses::SkinnableComponent/attachSkin()[E:\dev\4.x\frameworks\pr ojects\spark\src\spark\components\supportClasses\SkinnableComponent.as:632]

          at spark.components.supportClasses::SkinnableComponent/validateSkinChange()[E:\dev\4.x\frame works\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:405]

          at spark.components.supportClasses::SkinnableComponent/commitProperties()[E:\dev\4.x\framewo rks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:419]

          at spark.components.supportClasses::ListBase/commitProperties()[E:\dev\4.x\frameworks\projec ts\spark\src\spark\components\supportClasses\ListBase.as:785]

          at spark.components::List/commitProperties()[E:\dev\4.x\frameworks\projects\spark\src\spark\ components\List.as:907]

          at mx.core::UIComponent/validateProperties()[E:\dev\4.x\frameworks\projects\framework\src\mx \core\UIComponent.as:7933]

          at mx.managers::LayoutManager/validateProperties()[E:\dev\4.x\frameworks\projects\framework\ src\mx\managers\LayoutManager.as:572]

          at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.x\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:730]

          at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.x\frameworks\projects \framework\src\mx\managers\LayoutManager.as:1072]

       

       

      (Note: fromList is the id of the spark list used in the FromToList component.)

       

      The issue is that the "BorderContainerSkin" class isn't ever getting imported along the way. I did several things that worked to "fix" the problem, but they are all hacky and don't explain the root problem:

       

      1- If I explicitly import that skin into my test file, then everything works great.

      2- If I add the <includes> directive into my mxmlc task in the Ant file, and again specifically call out that skin class, then again it will work.

       

      However, how would I know what skins from the spark library are going to get included and which aren't? How would I know that a default skin isn't included or where to find it or even what it is?

       

      It seems like either I'm missing something in my Ant file or there is a serious bug here with the FlexUnit task. Can anyone shed light on if this is a known issue, any permanent fixes (that don't involve keeping track of a long list of strings of class references), or anything that I might be missing?

       

      Thank you for any help!