/test/acceptance/as3/Definitions/Classes/Ext/DynExtDynamicClassStat.as

https://github.com/changm/tessa · ActionScript · 249 lines · 41 code · 42 blank · 166 comment · 0 complexity · b261499016a409e0e7dc52f1de2a4831 MD5 · raw file

  1. /* ***** BEGIN LICENSE BLOCK *****
  2. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3. *
  4. * The contents of this file are subject to the Mozilla Public License Version
  5. * 1.1 (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. * http://www.mozilla.org/MPL/
  8. *
  9. * Software distributed under the License is distributed on an "AS IS" basis,
  10. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. * for the specific language governing rights and limitations under the
  12. * License.
  13. *
  14. * The Original Code is [Open Source Virtual Machine.].
  15. *
  16. * The Initial Developer of the Original Code is
  17. * Adobe System Incorporated.
  18. * Portions created by the Initial Developer are Copyright (C) 2004-2006
  19. * the Initial Developer. All Rights Reserved.
  20. *
  21. * Contributor(s):
  22. * Adobe AS3 Team
  23. *
  24. * Alternatively, the contents of this file may be used under the terms of
  25. * either the GNU General Public License Version 2 or later (the "GPL"), or
  26. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27. * in which case the provisions of the GPL or the LGPL are applicable instead
  28. * of those above. If you wish to allow use of your version of this file only
  29. * under the terms of either the GPL or the LGPL, and not to allow others to
  30. * use your version of this file under the terms of the MPL, indicate your
  31. * decision by deleting the provisions above and replace them with the notice
  32. * and other provisions required by the GPL or the LGPL. If you do not delete
  33. * the provisions above, a recipient may use your version of this file under
  34. * the terms of any one of the MPL, the GPL or the LGPL.
  35. *
  36. * ***** END LICENSE BLOCK ***** */
  37. import DynamicClass.*;
  38. var SECTION = "Definitions"; // provide a document reference (ie, ECMA section)
  39. var VERSION = "Clean AS2"; // Version of JavaScript or ECMA
  40. var TITLE = "Extend Dynamic Class"; // Provide ECMA section title or a description
  41. var BUGNUMBER = "";
  42. startTest(); // leave this alone
  43. /**
  44. * Calls to AddTestCase here. AddTestCase is a function that is defined
  45. * in shell.js and takes three arguments:
  46. * - a string representation of what is being tested
  47. * - the expected result
  48. * - the actual result
  49. *
  50. * For example, a test might look like this:
  51. *
  52. * var helloWorld = "Hello World";
  53. *
  54. * AddTestCase(
  55. * "var helloWorld = 'Hello World'", // description of the test
  56. * "Hello World", // expected result
  57. * helloWorld ); // actual result
  58. *
  59. */
  60. arr = new Array(1, 2, 3);
  61. // ********************************************
  62. // access static method from a default
  63. // method of a sub class
  64. //
  65. // ********************************************
  66. EXTDCLASS = new DynExtDynamicClassStat();
  67. AddTestCase( "*** Access static method from default method of sub class ***", 1, 1 );
  68. AddTestCase( "EXTDCLASS.testSubArray(arr)", arr, (EXTDCLASS.testSubArray(arr)) );
  69. // ********************************************
  70. // access static method from a public
  71. // method of a sub class
  72. //
  73. // ********************************************
  74. EXTDCLASS = new DynExtDynamicClassStat();
  75. AddTestCase( "*** Access static method from public method of sub class ***", 1, 1 );
  76. AddTestCase( "EXTDCLASS.pubSubSetArray(arr), EXTDCLASS.pubSubGetArray()", arr, (EXTDCLASS.pubSubSetArray(arr), EXTDCLASS.pubSubGetArray()) );
  77. // <TODO> fill in the rest of the cases here
  78. // ********************************************
  79. // access static method from a private
  80. // method of a sub class
  81. //
  82. // ********************************************
  83. EXTDCLASS = new DynExtDynamicClassStat();
  84. AddTestCase( "*** Access static method from private method of sub class ***", 1, 1 );
  85. AddTestCase( "EXTDCLASS.testPrivSubArray(arr)", arr, EXTDCLASS.testPrivSubArray(arr) );
  86. // ********************************************
  87. // access static method from a final
  88. // method of a sub class
  89. //
  90. // ********************************************
  91. EXTDCLASS = new DynExtDynamicClassStat();
  92. AddTestCase( "*** Access static method from final method of sub class ***", 1, 1 );
  93. AddTestCase( "EXTDCLASS.testFinSubArray(arr)", arr, (EXTDCLASS.testFinSubArray(arr)) );
  94. // ********************************************
  95. // access static method from a private final
  96. // method of a sub class
  97. //
  98. // ********************************************
  99. EXTDCLASS = new DynExtDynamicClassStat();
  100. AddTestCase( "*** Access static method from private final method of sub class ***", 1, 1 );
  101. AddTestCase( "EXTDCLASS.testPrivFinSubArray(arr)", arr, (EXTDCLASS.testPrivFinSubArray(arr)) );
  102. // ********************************************
  103. // access static method from a virtual
  104. // method of a sub class
  105. //
  106. // ********************************************
  107. EXTDCLASS = new DynExtDynamicClassStat();
  108. AddTestCase( "*** Access static method from virtual method of sub class ***", 1, 1 );
  109. AddTestCase( "EXTDCLASS.testVirSubArray(arr)", arr, (EXTDCLASS.testVirSubArray(arr)) );
  110. // ********************************************
  111. // access static method from a static
  112. // method of a sub class
  113. //
  114. // ********************************************
  115. /*
  116. AddTestCase( "*** Access static method from static method of sub class ***", 1, 1 );
  117. AddTestCase( "EXTDCLASS.testStatSubArray(arr)", arr,
  118. (EXTDCLASS.testStatSubArray(arr)) );
  119. // ********************************************
  120. // access static method from a public static
  121. // method of a sub class
  122. //
  123. // ********************************************
  124. AddTestCase( "*** Access static method from public static method of sub class ***", 1, 1 );
  125. AddTestCase( "EXTDCLASS.testPubStatSubArray(arr)", arr,
  126. (EXTDCLASS.testPubStatSubArray(arr)) );
  127. // ********************************************
  128. // access static method from a private static
  129. // method of a sub class
  130. //
  131. // ********************************************
  132. var EXTDEFAULTCLASS = new DynExtDynamicClassStat();
  133. AddTestCase( "*** Access static method from private static method of sub class ***", 1, 1 );
  134. AddTestCase( "EXTDCLASS.testPrivStatSubArray(arr)", arr,
  135. EXTDCLASS.testPrivStatSubArray(arr) );
  136. */
  137. // ********************************************
  138. // access static property from
  139. // default method in sub class
  140. // ********************************************
  141. EXTDCLASS = new DynExtDynamicClassStat();
  142. AddTestCase( "*** Access static property from default method in sub class ***", 1, 1 );
  143. AddTestCase( "EXTDCLASS.testSubDPArray(arr)", arr, (EXTDCLASS.testSubDPArray(arr)) );
  144. // ********************************************
  145. // access static property from
  146. // public method in sub class
  147. // ********************************************
  148. EXTDCLASS = new DynExtDynamicClassStat();
  149. AddTestCase( "*** Access static property from public method in sub class ***", 1, 1 );
  150. AddTestCase( "EXTDCLASS.pubSubSetDPArray(arr), EXTDCLASS.pubSubGetDPArray()", arr, (EXTDCLASS.pubSubSetDPArray(arr), EXTDCLASS.pubSubGetDPArray()) );
  151. // ********************************************
  152. // access static property from
  153. // private method in sub class
  154. // ********************************************
  155. EXTDCLASS = new DynExtDynamicClassStat();
  156. AddTestCase( "*** Access static property from private method in sub class ***", 1, 1 );
  157. AddTestCase( "EXTDCLASS.testPrivSubDPArray(arr)", arr, (EXTDCLASS.testSubDPArray(arr)) );
  158. // ********************************************
  159. // access static property from
  160. // static method in sub class
  161. // ********************************************
  162. /*
  163. AddTestCase( "*** Access static property from static method in sub class ***", 1, 1 );
  164. AddTestCase( "EXTDCLASS.statSubSetSPArray(arr), EXTDCLASS.statSubGetSPArray()", arr,
  165. (EXTDCLASS.statSubSetSPArray(arr), EXTDCLASS.statSubGetSPArray()) );
  166. // ********************************************
  167. // access static property from
  168. // public static method in sub class
  169. // ********************************************
  170. AddTestCase( "*** Access static property from public static method in sub class ***", 1, 1 );
  171. AddTestCase( "EXTDCLASS.pubStatSubSetSPArray(arr), EXTDCLASS.pubStatSubGetSPArray()", arr,
  172. (EXTDCLASS.pubStatSubSetSPArray(arr), EXTDCLASS.pubStatSubGetSPArray()) );
  173. // ********************************************
  174. // access static property from
  175. // private static method in sub class
  176. // ********************************************
  177. EXTDCLASS = new DynExtDynamicClassStat();
  178. AddTestCase( "*** Access static property from private static method in sub class ***", 1, 1 );
  179. AddTestCase( "EXTDCLASS.testPrivStatSubPArray(arr)", arr,
  180. EXTDCLASS.testPrivStatSubPArray(arr));
  181. */
  182. // ********************************************
  183. // access static property from
  184. // final method in sub class
  185. // ********************************************
  186. EXTDCLASS = new DynExtDynamicClassStat();
  187. AddTestCase( "*** Access static property from final method in sub class ***", 1, 1 );
  188. AddTestCase( "EXTDCLASS.testFinSubDPArray(arr)", arr, (EXTDCLASS.testFinSubDPArray(arr)) );
  189. // ********************************************
  190. // access static property from
  191. // public virtual method in sub class
  192. // ********************************************
  193. EXTDCLASS = new DynExtDynamicClassStat();
  194. AddTestCase( "*** Access static property from public virtual method in sub class ***", 1, 1 );
  195. AddTestCase( "EXTDCLASS.testPubVirSubDPArray(arr)", arr, (EXTDCLASS.testPubVirSubDPArray(arr)) );
  196. test(); // leave this alone. this executes the test cases and
  197. // displays results.