/test/acceptance/as3/Definitions/Classes/ExtImpl/ExtDynamicImplDefDefStat.as

https://github.com/bsdf/trx · ActionScript · 246 lines · 57 code · 55 blank · 134 comment · 0 complexity · 2587aa7462e7395eb61b634357b4321e 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. var SECTION = "Definitions"; // provide a document reference (ie, ECMA section)
  38. var VERSION = "Clean AS2"; // Version of JavaScript or ECMA
  39. var TITLE = "Extend Dynamic Class Implement 2 Default Interfaces"; // Provide ECMA section title or a description
  40. var BUGNUMBER = "";
  41. startTest(); // leave this alone
  42. /**
  43. * Calls to AddTestCase here. AddTestCase is a function that is defined
  44. * in shell.js and takes three arguments:
  45. * - a string representation of what is being tested
  46. * - the expected result
  47. * - the actual result
  48. *
  49. * For example, a test might look like this:
  50. *
  51. * var helloWorld = "Hello World";
  52. *
  53. * AddTestCase(
  54. * "var helloWorld = 'Hello World'", // description of the test
  55. * "Hello World", // expected result
  56. * helloWorld ); // actual result
  57. *
  58. */
  59. import DynamicClass.*;
  60. arr = new Array(1, 2, 3);
  61. THISTEST = new ExtDynamicImplDefDefStat();
  62. // *******************************************
  63. // define default method from interface as a
  64. // public method in the sub class
  65. // *******************************************
  66. AddTestCase( "*** default(<empty>) method implemented interface ***", 1, 1 );
  67. AddTestCase( "THISTEST.testGetBoolean(false)", false, THISTEST.testGetBoolean(false) );
  68. AddTestCase( "THISTEST.testGetBoolean(true)", true, THISTEST.testGetBoolean(true) );
  69. // *******************************************
  70. // define public method from interface as a
  71. // public method in the sub class
  72. // *******************************************
  73. AddTestCase( "*** public method implemented interface ***", 1, 1 );
  74. AddTestCase( "THISTEST.testGetPubBoolean(false)", false, THISTEST.testGetPubBoolean(false) );
  75. AddTestCase( "THISTEST.testGetPubBoolean(true)", true, THISTEST.testGetPubBoolean(true) );
  76. // *******************************************
  77. // define default method from interface 2 as a
  78. // public method in the sub class
  79. // *******************************************
  80. AddTestCase( "*** default(<empty>) method implemented interface 2 ***", 1, 1 );
  81. AddTestCase( "THISTEST.testGetSetNumber(420)", 420, THISTEST.testGetSetNumber(420) );
  82. // *******************************************
  83. // define public method from interface 2 as a
  84. // public method in the sub class
  85. // *******************************************
  86. AddTestCase( "*** public method implemented interface 2 ***", 1, 1 );
  87. AddTestCase( "THISTEST.setPubNumber(14), THISTEST.iGetPubNumber()", 14, (THISTEST.setPubNumber(14), THISTEST.iGetPubNumber()) );
  88. // ********************************************
  89. // access static method from a default
  90. // method of a sub class
  91. //
  92. // ********************************************
  93. EXTDCLASS = new ExtDynamicImplDefDefStat();
  94. AddTestCase( "*** Access static method from default method of sub class ***", 1, 1 );
  95. AddTestCase( "EXTDCLASS.testSubSetArray(arr)", arr, EXTDCLASS.testSubSetArray(arr) );
  96. // <TODO> fill in the rest of the cases here
  97. // ********************************************
  98. // access static method from a public
  99. // method of a sub class
  100. //
  101. // ********************************************
  102. EXTDCLASS = new ExtDynamicImplDefDefStat();
  103. AddTestCase( "*** Access static method from public method of sub class ***", 1, 1 );
  104. AddTestCase( "EXTDCLASS.pubSubSetArray(arr), EXTDCLASS.pubSubGetArray()", arr, (EXTDCLASS.pubSubSetArray(arr), EXTDCLASS.pubSubGetArray()) );
  105. // <TODO> fill in the rest of the cases here
  106. // ********************************************
  107. // access static method from a private
  108. // method of a sub class
  109. //
  110. // ********************************************
  111. EXTDCLASS = new ExtDynamicImplDefDefStat();
  112. AddTestCase( "*** Access static method from private method of sub class ***", 1, 1 );
  113. AddTestCase( "EXTDCLASS.testPrivSubArray(arr)", arr, EXTDCLASS.testPrivSubArray(arr) );
  114. // <TODO> fill in the rest of the cases here
  115. // ********************************************
  116. // access static method from a static
  117. // method of a sub class
  118. //
  119. // ********************************************
  120. EXTDCLASS = new ExtDynamicImplDefDefStat();
  121. AddTestCase( "*** Access static method from static method of sub class ***", 1, 1 );
  122. AddTestCase( "ExtDynamicClassStat.testStatSubSetArray(arr)", arr, EXTDCLASS.testStatSubSetArray(arr) );
  123. // <TODO> fill in the rest of the cases here
  124. // ********************************************
  125. // access static method from a public static
  126. // method of a sub class
  127. //
  128. // ********************************************
  129. EXTDCLASS = new ExtDynamicImplDefDefStat();
  130. AddTestCase( "*** Access static method from public static method of sub class ***", 1, 1 );
  131. AddTestCase( "EXTDCLASS.pubStatSubSetArray(arr), EXTDCLASS.pubStatSubGetArray()", arr,
  132. EXTDCLASS.testPubStatSubGetSetArray(arr) );
  133. // <TODO> fill in the rest of the cases here
  134. // ********************************************
  135. // access static method from a private static
  136. // method of a sub class
  137. //
  138. // ********************************************
  139. var EXTDEFAULTCLASS = new ExtDynamicImplDefDefStat();
  140. AddTestCase( "*** Access static method from private static method of sub class ***", 1, 1 );
  141. AddTestCase( "EXTDEFAULTCLASS.testPrivStatSubArray(arr)", arr, EXTDEFAULTCLASS.testPrivStatSubArray(arr) );
  142. // <TODO> fill in the rest of the cases here
  143. // ********************************************
  144. // access static property from
  145. // default method in sub class
  146. // ********************************************
  147. EXTDCLASS = new ExtDynamicImplDefDefStat();
  148. AddTestCase( "*** Access static property from default method in sub class ***", 1, 1 );
  149. AddTestCase( "EXTDCLASS.testSubSetDPArray(arr)", arr, EXTDCLASS.testSubSetDPArray(arr) );
  150. // <TODO> fill in the rest of the cases here
  151. // ********************************************
  152. // access static property from
  153. // public method in sub class
  154. // ********************************************
  155. EXTDCLASS = new ExtDynamicImplDefDefStat();
  156. AddTestCase( "*** Access static property from public method in sub class ***", 1, 1 );
  157. AddTestCase( "EXTDCLASS.pubSubSetDPArray(arr), EXTDCLASS.pubSubGetDPArray()", arr, (EXTDCLASS.pubSubSetDPArray(arr), EXTDCLASS.pubSubGetDPArray()) );
  158. // <TODO> fill in the rest of the cases here
  159. // ********************************************
  160. // access static property from
  161. // private method in sub class
  162. // ********************************************
  163. EXTDCLASS = new ExtDynamicImplDefDefStat();
  164. AddTestCase( "*** Access static property from private method in sub class ***", 1, 1 );
  165. AddTestCase( "EXTDCLASS.testPrivSubSetDPArray(arr)", arr, EXTDCLASS.testPrivSubSetDPArray(arr) );
  166. // <TODO> fill in the rest of the cases here
  167. // ********************************************
  168. // access static property from
  169. // static method in sub class
  170. // ********************************************
  171. EXTDCLASS = new ExtDynamicImplDefDefStat();
  172. AddTestCase( "*** Access static property from static method in sub class ***", 1, 1 );
  173. AddTestCase( "EXTDCLASS.testStatSubSetDPArray(arr)", arr, EXTDCLASS.testStatSubSetDPArray(arr) );
  174. // ********************************************
  175. // access static property from
  176. // public static method in sub class
  177. // ********************************************
  178. EXTDCLASS = new ExtDynamicImplDefDefStat();
  179. AddTestCase( "*** Access static property from public static method in sub class ***", 1, 1 );
  180. AddTestCase( "EXTDCLASS.pubStatSubSetSPArray(arr), EXTDCLASS.pubStatSubGetSPArray()", arr,
  181. EXTDCLASS.testPubStatSubGetSetSPArray(arr) );
  182. // ********************************************
  183. // access static property from
  184. // private static method in sub class
  185. // ********************************************
  186. EXTDCLASS = new ExtDynamicImplDefDefStat();
  187. AddTestCase( "*** Access static property from private static method in sub class ***", 1, 1 );
  188. AddTestCase( "EXTDCLASS.testPrivStatSubPArray(arr)", arr, EXTDCLASS.testPrivStatSubPArray(arr));
  189. // <TODO> fill in the rest of the cases here
  190. test(); // leave this alone. this executes the test cases and
  191. // displays results.