Author: fthomas
Date: Wed Dec 12 17:20:31 2012
New Revision: 1420842
URL: http://svn.apache.org/viewvc?rev=1420842&view=rev
Log:
FLEX-33242 Fixed Mustella tests failed: when your computer language doesn't
match the expected localized error
Modified:
incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/Assert.as
incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertError.as
incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertMethodValue.as
incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertPropertyValue.as
incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/ButtonBar/Integration/ButtonBar_VS_Methods.mxml
incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/ButtonBar/Integration/ButtonBar_VS_Methods2.mxml
incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/TabBar/Integration/TabBar_ViewStack_Methods.mxml
incubator/flex/sdk/branches/develop/mustella/tests/gumbo/core/Group/methods/Group_Methods_main.mxml
incubator/flex/sdk/branches/develop/mustella/tests/gumbo/core/SkinnableComponent/Properties/properties_hostComponent.mxml
incubator/flex/sdk/branches/develop/mustella/tests/mx/collections/AsyncListView/properties/AsyncListView_createFailedItemFunction.mxml
incubator/flex/sdk/branches/develop/mustella/tests/resources/Locale/Properties/Locale_Properties_country.mxml
incubator/flex/sdk/branches/develop/mustella/tests/resources/Locale/Properties/Locale_Properties_language.mxml
incubator/flex/sdk/branches/develop/mustella/tests/resources/Locale/Properties/Locale_Properties_variant.mxml
incubator/flex/sdk/branches/develop/mustella/tests/resources/ResourceBundle/Methods/ResourceBundle_Methods_getBoolean.mxml
incubator/flex/sdk/branches/develop/mustella/tests/resources/ResourceBundle/Methods/ResourceBundle_Methods_getStringArray.mxml
incubator/flex/sdk/branches/develop/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_bundleName.mxml
incubator/flex/sdk/branches/develop/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_content.mxml
incubator/flex/sdk/branches/develop/mustella/tests/resources/ResourceBundle/Properties/ResourceBundle_Properties_locale.mxml
incubator/flex/sdk/branches/develop/mustella/tests/resources/ResourceManager/Methods/ResourceManager_Methods_removeResourceBundle.mxml
incubator/flex/sdk/branches/develop/mustella/tests/spark/formatters/NumberFormatter/Fallback/NF_Fallback_parseNumber_tester.mxml
incubator/flex/sdk/branches/develop/mustella/tests/spark/formatters/NumberFormatter/Fallback/NF_Fallback_parse_tester.mxml
incubator/flex/sdk/branches/develop/mustella/tests/spark/formatters/NumberFormatter/Methods/NF_parseNumber_tester.mxml
incubator/flex/sdk/branches/develop/mustella/tests/spark/formatters/NumberFormatter/Methods/NF_parse_tester.mxml
Modified:
incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/Assert.as
URL:
http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/Assert.as?rev=1420842&r1=1420841&r2=1420842&view=diff
==============================================================================
--- incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/Assert.as
(original)
+++ incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/Assert.as Wed
Dec 12 17:20:31 2012
@@ -42,14 +42,14 @@ public class Assert extends TestStep
{
// list of properties we don't examine in determining equivalence
private static var excludeList:Array = [
- "stage",
- "systemManager",
- "parent",
- "owner",
- "target",
+ "stage",
+ "systemManager",
+ "parent",
+ "owner",
+ "target",
"currentTarget"
];
-
+
/**
* Called by the test case in case you need to set up before execute()
*/
@@ -150,7 +150,7 @@ public class Assert extends TestStep
if (value == null)
return "null";
var s:String;
-
+
if (value is Number)
{
if ((value is int) || (value is uint))
@@ -165,6 +165,16 @@ public class Assert extends TestStep
s = ObjectUtil.toString(value, null, excludeList);
return s;
}
+
+ protected function contains(value:*, expectedError:ErrorArray):Boolean {
+ if (expectedError && expectedError.parts && expectedError.parts.length)
+ for (var i:uint = 0; i < expectedError.parts.length; i++) {
+ if
(valueToString(value).indexOf(valueToString(expectedError.parts[i])) == -1)
+ return false;
+ }
+
+ return true;
+ }
}
}
Modified:
incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertError.as
URL:
http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertError.as?rev=1420842&r1=1420841&r2=1420842&view=diff
==============================================================================
---
incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertError.as
(original)
+++
incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertError.as
Wed Dec 12 17:20:31 2012
@@ -54,7 +54,7 @@ public class AssertError extends Assert
catch (e1:Error)
{
TestOutput.logResult("Exception thrown
evaluating value expression.");
- testResult.doFail (e1.getStackTrace());
+ testResult.doFail (e1.getStackTrace());
return;
}
value = context.value;
@@ -62,16 +62,20 @@ public class AssertError extends Assert
TestOutput.logResult("WARNING: value was not
set by valueExpression. 'value=' missing from expression?");
}
- if (valueToString(testCase.lastError) != valueToString(value))
- {
- testResult.doFail ( "Expected Error " +
valueToString(value) + ", got " + valueToString(testCase.lastError));
- }
+ if (errorArray) {
+ var errors:ErrorArray = new ErrorArray(errorArray);
+ if (!contains(testCase.lastError, errors))
+ testResult.doFail("Expected Error contains " +
valueToString(errors) + ", got " + valueToString(testCase.lastError));
+ } else if (valueToString(testCase.lastError) != valueToString(value))
+ testResult.doFail("Expected Error " + valueToString(value) + ",
got " + valueToString(testCase.lastError));
}
/**
- * The value the property should have
+ * The value the property should have.
*/
- public var value:Object;
+ public var value:*;
+
+ public var errorArray:Array;
/**
* customize string representation
Modified:
incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertMethodValue.as
URL:
http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertMethodValue.as?rev=1420842&r1=1420841&r2=1420842&view=diff
==============================================================================
---
incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertMethodValue.as
(original)
+++
incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertMethodValue.as
Wed Dec 12 17:20:31 2012
@@ -60,7 +60,7 @@ use namespace mx_internal;
public class AssertMethodValue extends Assert
{
public var conditionalValues:Vector.<ConditionalValue> = null;
-
+
/**
* Test the value of a property, log result if failure.
*/
@@ -68,9 +68,9 @@ public class AssertMethodValue extends A
{
var cv:ConditionalValue = null;
var dispatcher:EventDispatcher = this;
-
+
context.resetValue();
-
+
// Use MultiResult to determine the proper value (or
valueExpression, below).
if(conditionalValues){
cv = new MultiResult().chooseCV(conditionalValues);
@@ -81,9 +81,9 @@ public class AssertMethodValue extends A
}
// Execute the method.
- try
+ try
{
- dispatchEvent(new RunCodeEvent("method",
root["document"], context, testCase, testResult));
+ dispatchEvent(new RunCodeEvent("method",
root["document"], context, testCase, testResult));
}
catch (e:Error)
{
@@ -106,7 +106,7 @@ public class AssertMethodValue extends A
catch (e1:Error)
{
TestOutput.logResult("Exception thrown
evaluating value expression.");
- testResult.doFail (e1.getStackTrace());
+ testResult.doFail (e1.getStackTrace());
return;
}
value = context.value;
@@ -114,16 +114,20 @@ public class AssertMethodValue extends A
TestOutput.logResult("WARNING: value was not
set by valueExpression. 'value=' missing from expression?");
}
- if (valueToString(methodValue) != valueToString(value))
- {
- testResult.doFail ( "method returned " +
valueToString(methodValue) + ", expected " + valueToString(value));
- }
+ if (errorArray) {
+ var errors:ErrorArray = new ErrorArray(errorArray);
+ if (!contains(methodValue, errors))
+ testResult.doFail("method returned " +
valueToString(methodValue) + ", expected it contains " + valueToString(errors));
+ } else if (valueToString(methodValue) != valueToString(value))
+ testResult.doFail("method returned " + valueToString(methodValue)
+ ", expected " + valueToString(value));
}
/**
* The value the method should return
*/
- public var value:Object;
+ public var value:*;
+
+ public var errorArray:Array;
/**
* customize string representation
Modified:
incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertPropertyValue.as
URL:
http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertPropertyValue.as?rev=1420842&r1=1420841&r2=1420842&view=diff
==============================================================================
---
incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertPropertyValue.as
(original)
+++
incubator/flex/sdk/branches/develop/mustella/as3/src/mustella/AssertPropertyValue.as
Wed Dec 12 17:20:31 2012
@@ -48,7 +48,7 @@ use namespace mx_internal;
public class AssertPropertyValue extends Assert
{
public var conditionalValues:Vector.<ConditionalValue> = null;
-
+
/**
* See if the property has the correct value
*/
@@ -58,7 +58,7 @@ public class AssertPropertyValue extends
var multiResultResult:String = "";
var cv:ConditionalValue = null;
var dispatcher:EventDispatcher = this;
-
+
if (!actualTarget)
{
testResult.doFail("Target " + target + " not found");
@@ -90,21 +90,23 @@ public class AssertPropertyValue extends
catch (e1:Error)
{
TestOutput.logResult("Exception thrown
evaluating value expression.");
- testResult.doFail (e1.getStackTrace());
+ testResult.doFail (e1.getStackTrace());
return;
}
-
+
value = context.value;
-
+
if (!context.valueChanged)
TestOutput.logResult("WARNING: value was not
set by valueExpression. 'value=' missing from expression?");
}
- if (valueToString(actualTarget[propertyName]) !=
valueToString(value))
- {
- testResult.doFail ( target + "." + propertyName + " " +
valueToString(actualTarget[propertyName]) + " != " + valueToString(value));
- }
+ if (errorArray) {
+ var errors:ErrorArray = new ErrorArray(errorArray);
+ if (!contains(actualTarget[propertyName], errors))
+ testResult.doFail(target + "." + propertyName + " " +
valueToString(actualTarget[propertyName]) + " should contain " +
valueToString(errors));
+ } else if (valueToString(actualTarget[propertyName]) !=
valueToString(value))
+ testResult.doFail(target + "." + propertyName + " " +
valueToString(actualTarget[propertyName]) + " != " + valueToString(value));
}
/**
@@ -115,7 +117,9 @@ public class AssertPropertyValue extends
/**
* The value the property should have
*/
- public var value:Object;
+ public var value:*;
+
+ public var errorArray:Array;
/**
* customize string representation
Modified:
incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/ButtonBar/Integration/ButtonBar_VS_Methods.mxml
URL:
http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/ButtonBar/Integration/ButtonBar_VS_Methods.mxml?rev=1420842&r1=1420841&r2=1420842&view=diff
==============================================================================
---
incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/ButtonBar/Integration/ButtonBar_VS_Methods.mxml
(original)
+++
incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/ButtonBar/Integration/ButtonBar_VS_Methods.mxml
Wed Dec 12 17:20:31 2012
@@ -197,7 +197,7 @@ Verify methods of ViewStack with spark B
<RunCode code="addNav()" waitTarget="TC.bb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue method="try{addNavAt(4)}catch(e:Error){value =
e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue method="try{addNavAt(4)}catch(e:Error){value =
e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
@@ -210,7 +210,7 @@ Verify methods of ViewStack with spark B
<RunCode code="addNav()" waitTarget="TC.bb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue method="try{addNavAt(-1)}catch(e:Error){value =
e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue method="try{addNavAt(-1)}catch(e:Error){value =
e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
@@ -299,7 +299,7 @@ Verify methods of ViewStack with spark B
<RunCode code="addNav()" waitTarget="TC.bb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.getItemAt(5)}catch(e:Error){value
= e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.getItemAt(5)}catch(e:Error){value
= e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
@@ -314,7 +314,7 @@ Verify methods of ViewStack with spark B
<RunCode code="addNav()" waitTarget="TC.bb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.getItemAt(-1)}catch(e:Error){value
= e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.getItemAt(-1)}catch(e:Error){value
= e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
@@ -555,7 +555,7 @@ Verify methods of ViewStack with spark B
<RunCode code="addVB()" waitTarget="TC.bb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(-2)}catch(e:Error){value
= e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(-2)}catch(e:Error){value
= e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
@@ -570,7 +570,7 @@ Verify methods of ViewStack with spark B
<RunCode code="addVB()" waitTarget="TC.bb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(5)}catch(e:Error){value
= e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(5)}catch(e:Error){value
= e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
@@ -711,7 +711,7 @@ Verify methods of ViewStack with spark B
<RunCode code="addVB()" waitTarget="TC.bb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(-2)}catch(e:Error){value
= e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(-2)}catch(e:Error){value
= e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
@@ -725,7 +725,7 @@ Verify methods of ViewStack with spark B
<RunCode code="addVB()" waitTarget="TC.bb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(4)}catch(e:Error){value
= e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(4)}catch(e:Error){value
= e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
Modified:
incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/ButtonBar/Integration/ButtonBar_VS_Methods2.mxml
URL:
http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/ButtonBar/Integration/ButtonBar_VS_Methods2.mxml?rev=1420842&r1=1420841&r2=1420842&view=diff
==============================================================================
---
incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/ButtonBar/Integration/ButtonBar_VS_Methods2.mxml
(original)
+++
incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/ButtonBar/Integration/ButtonBar_VS_Methods2.mxml
Wed Dec 12 17:20:31 2012
@@ -156,7 +156,7 @@ Verify methods of ViewStack with spark B
<RunCode code="addVB()" waitTarget="TC.bb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(-2)}catch(e:Error){value
= e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(-2)}catch(e:Error){value
= e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
Modified:
incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/TabBar/Integration/TabBar_ViewStack_Methods.mxml
URL:
http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/TabBar/Integration/TabBar_ViewStack_Methods.mxml?rev=1420842&r1=1420841&r2=1420842&view=diff
==============================================================================
---
incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/TabBar/Integration/TabBar_ViewStack_Methods.mxml
(original)
+++
incubator/flex/sdk/branches/develop/mustella/tests/gumbo/components/TabBar/Integration/TabBar_ViewStack_Methods.mxml
Wed Dec 12 17:20:31 2012
@@ -216,7 +216,7 @@ Verify methods of ViewStack with spark T
<RunCode code="addNav()" waitTarget="TC.tb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue method="try{addNavAt(4)}catch(e:Error){value =
e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue method="try{addNavAt(4)}catch(e:Error){value =
e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
@@ -229,7 +229,7 @@ Verify methods of ViewStack with spark T
<RunCode code="addNav()" waitTarget="TC.tb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue method="try{addNavAt(-1)}catch(e:Error){value =
e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue method="try{addNavAt(-1)}catch(e:Error){value =
e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
@@ -312,7 +312,7 @@ Verify methods of ViewStack with spark T
<RunCode code="addNav()" waitTarget="TC.tb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.getItemAt(5)}catch(e:Error){value
= e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.getItemAt(5)}catch(e:Error){value
= e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
@@ -327,7 +327,7 @@ Verify methods of ViewStack with spark T
<RunCode code="addNav()" waitTarget="TC.tb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.getItemAt(-1)}catch(e:Error){value
= e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.getItemAt(-1)}catch(e:Error){value
= e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
@@ -568,7 +568,7 @@ Verify methods of ViewStack with spark T
<RunCode code="addVB()" waitTarget="TC.tb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(-2)}catch(e:Error){value
= e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(-2)}catch(e:Error){value
= e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
@@ -583,7 +583,7 @@ Verify methods of ViewStack with spark T
<RunCode code="addVB()" waitTarget="TC.tb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(5)}catch(e:Error){value
= e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(5)}catch(e:Error){value
= e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
@@ -724,7 +724,7 @@ Verify methods of ViewStack with spark T
<RunCode code="addVB()" waitTarget="TC.tb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(-2)}catch(e:Error){value
= e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(-2)}catch(e:Error){value
= e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>
@@ -738,7 +738,7 @@ Verify methods of ViewStack with spark T
<RunCode code="addVB()" waitTarget="TC.tb.dataGroup"
waitEvent="updateComplete" />
</setup>
<body>
- <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(4)}catch(e:Error){value
= e.message}" value="Error #2006: The supplied index is out of bounds." />
+ <AssertMethodValue
method="try{FlexGlobals.topLevelApplication.TC.newVS.removeItemAt(4)}catch(e:Error){value
= e.message}" errorArray="['Error #2006:']" />
</body>
</TestCase>