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

https://github.com/bsdf/trx · ActionScript · 269 lines · 68 code · 58 blank · 143 comment · 0 complexity · dad05caa889e7ebc374786af0bfa2619 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 DefaultClass.*;
  38. var SECTION = "Definitions"; // provide a document reference (ie, ECMA section)
  39. var VERSION = "AS3"; // Version of JavaScript or ECMA
  40. var TITLE = "Public Class Extends Default 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. var EXTDCLASS = new DynExtDefaultClassPub();
  61. var arr = new Array(10, 15, 20, 25, 30);
  62. // *******************************************
  63. // access public method of parent class from
  64. // outside of class
  65. // *******************************************
  66. AddTestCase( "*** Access from outside of class ***", 1, 1 );
  67. AddTestCase( "EXTDCLASS.setPubArray(arr), EXTDCLASS.getPubArray", arr, (EXTDCLASS.setPubArray(arr), EXTDCLASS.getPubArray()) );
  68. // ********************************************
  69. // access public method from a default
  70. // method of a sub class
  71. //
  72. // ********************************************
  73. EXTDCLASS = new DynExtDefaultClassPub();
  74. AddTestCase( "*** Access public method from default method of sub class ***", 1, 1 );
  75. AddTestCase( "EXTDCLASS.testSubArray(arr)", arr, (EXTDCLASS.testSubArray(arr)) );
  76. // ********************************************
  77. // access public method from a public
  78. // method of a sub class
  79. //
  80. // ********************************************
  81. EXTDCLASS = new DynExtDefaultClassPub();
  82. AddTestCase( "*** Access public method from public method of sub class ***", 1, 1 );
  83. AddTestCase( "EXTDCLASS.pubSubSetArray(arr), EXTDCLASS.pubSubGetArray()", arr, (EXTDCLASS.pubSubSetArray(arr), EXTDCLASS.pubSubGetArray()) );
  84. // ********************************************
  85. // access public method from a private
  86. // method of a sub class
  87. //
  88. // ********************************************
  89. EXTDCLASS = new DynExtDefaultClassPub();
  90. AddTestCase( "*** Access public method from private method of sub class ***", 1, 1 );
  91. AddTestCase( "EXTDCLASS.testPrivSubArray(arr)", arr, EXTDCLASS.testPrivSubArray(arr) );
  92. // ********************************************
  93. // access public method from a final
  94. // method of a sub class
  95. //
  96. // ********************************************
  97. EXTDCLASS = new DynExtDefaultClassPub();
  98. AddTestCase( "*** Access public method from final method of sub class ***", 1, 1 );
  99. AddTestCase( "EXTDCLASS.testFinSubArray(arr)", arr, (EXTDCLASS.testFinSubArray(arr)) );
  100. // ********************************************
  101. // access public method from a final
  102. // method of a sub class
  103. //
  104. // ********************************************
  105. EXTDCLASS = new DynExtDefaultClassPub();
  106. AddTestCase( "*** Access public method from final method of sub class ***", 1, 1 );
  107. AddTestCase( "EXTDCLASS.testPubFinSubArray(arr)", arr, (EXTDCLASS.testPubFinSubArray(arr)) );
  108. // ********************************************
  109. // access public method from a final
  110. // method of a sub class
  111. //
  112. // ********************************************
  113. EXTDCLASS = new DynExtDefaultClassPub();
  114. AddTestCase( "*** Access public method from final method of sub class ***", 1, 1 );
  115. AddTestCase( "EXTDCLASS.testPrivFinSubArray(arr)", arr, (EXTDCLASS.testPrivFinSubArray(arr)) );
  116. // ********************************************
  117. // access public method from a virtual
  118. // method of a sub class
  119. //
  120. // ********************************************
  121. EXTDCLASS = new DynExtDefaultClassPub();
  122. AddTestCase( "*** Access public method from virtual method of sub class ***", 1, 1 );
  123. AddTestCase( "EXTDCLASS.testVirSubArray(arr)", arr, (EXTDCLASS.testVirSubArray(arr)) );
  124. // ********************************************
  125. // access public method from a public virtual
  126. // method of a sub class
  127. //
  128. // ********************************************
  129. EXTDCLASS = new DynExtDefaultClassPub();
  130. AddTestCase( "*** Access public method from public virtual method of sub class ***", 1, 1 );
  131. AddTestCase( "EXTDCLASS.testPubVirSubArray(arr)", arr, (EXTDCLASS.testPubVirSubArray(arr)) );
  132. // ********************************************
  133. // access public method from a private virtual
  134. // method of a sub class
  135. //
  136. // ********************************************
  137. EXTDCLASS = new DynExtDefaultClassPub();
  138. AddTestCase( "*** Access public method from private virtual method of sub class ***", 1, 1 );
  139. AddTestCase( "EXTDCLASS.testPrivVirSubArray(arr)", arr, (EXTDCLASS.testPrivVirSubArray(arr)) );
  140. // ********************************************
  141. // access public property from outside
  142. // the class
  143. // ********************************************
  144. EXTDCLASS = new DynExtDefaultClassPub();
  145. AddTestCase( "*** Access public property from outside the class ***", 1, 1 );
  146. AddTestCase( "EXTDCLASS.pubArray = arr", arr, (EXTDCLASS.pubArray = arr, EXTDCLASS.pubArray) );
  147. // ********************************************
  148. // access public property from
  149. // default method in sub class
  150. // ********************************************
  151. EXTDCLASS = new DynExtDefaultClassPub();
  152. AddTestCase( "*** Access public property from default method in sub class ***", 1, 1 );
  153. AddTestCase( "EXTDCLASS.testSubDPArray(arr)", arr, (EXTDCLASS.testSubDPArray(arr)) );
  154. // ********************************************
  155. // access public property from
  156. // public method in sub class
  157. // ********************************************
  158. EXTDCLASS = new DynExtDefaultClassPub();
  159. AddTestCase( "*** Access public property from public method in sub class ***", 1, 1 );
  160. AddTestCase( "EXTDCLASS.pubSubSetDPArray(arr), EXTDCLASS.pubSubGetDPArray()", arr, (EXTDCLASS.pubSubSetDPArray(arr), EXTDCLASS.pubSubGetDPArray()) );
  161. // ********************************************
  162. // access public property from
  163. // private method in sub class
  164. // ********************************************
  165. EXTDCLASS = new DynExtDefaultClassPub();
  166. AddTestCase( "*** Access public property from private method in sub class ***", 1, 1 );
  167. AddTestCase( "EXTDCLASS.testPrivDPArray(arr)", arr, (EXTDCLASS.testPrivDPArray(arr)) );
  168. // ********************************************
  169. // access public property from
  170. // final method in sub class
  171. // ********************************************
  172. EXTDCLASS = new DynExtDefaultClassPub();
  173. AddTestCase( "*** Access public property from final method in sub class ***", 1, 1 );
  174. AddTestCase( "EXTDCLASS.testFinDPArray(arr)", arr, (EXTDCLASS.testFinDPArray(arr)) );
  175. // ********************************************
  176. // access public property from
  177. // public final method in sub class
  178. // ********************************************
  179. EXTDCLASS = new DynExtDefaultClassPub();
  180. AddTestCase( "*** Access public property from public final method in sub class ***", 1, 1 );
  181. AddTestCase( "EXTDCLASS.testPubFinDPArray(arr)", arr, (EXTDCLASS.testPubFinDPArray(arr)) );
  182. // ********************************************
  183. // access public property from
  184. // private final method in sub class
  185. // ********************************************
  186. EXTDCLASS = new DynExtDefaultClassPub();
  187. AddTestCase( "*** Access public property from private final method in sub class ***", 1, 1 );
  188. AddTestCase( "EXTDCLASS.testPrivFinDPArray(arr)", arr, (EXTDCLASS.testPrivFinDPArray(arr)) );
  189. // ********************************************
  190. // access public property from
  191. // virtual method in sub class
  192. // ********************************************
  193. EXTDCLASS = new DynExtDefaultClassPub();
  194. AddTestCase( "*** Access public property from final method in sub class ***", 1, 1 );
  195. AddTestCase( "EXTDCLASS.testVirDPArray(arr)", arr, (EXTDCLASS.testVirDPArray(arr)) );
  196. // ********************************************
  197. // access public property from
  198. // public virtual method in sub class
  199. // ********************************************
  200. EXTDCLASS = new DynExtDefaultClassPub();
  201. AddTestCase( "*** Access public property from public final method in sub class ***", 1, 1 );
  202. AddTestCase( "EXTDCLASS.testPubVirDPArray(arr)", arr, (EXTDCLASS.testPubVirDPArray(arr)) );
  203. // ********************************************
  204. // access public property from
  205. // private virtual method in sub class
  206. // ********************************************
  207. EXTDCLASS = new DynExtDefaultClassPub();
  208. AddTestCase( "*** Access public property from private final method in sub class ***", 1, 1 );
  209. AddTestCase( "EXTDCLASS.testPrivVirDPArray(arr)", arr, (EXTDCLASS.testPrivVirDPArray(arr)) );
  210. test(); // leave this alone. this executes the test cases and
  211. // displays results.