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

https://github.com/bsdf/trx · ActionScript · 190 lines · 47 code · 40 blank · 103 comment · 0 complexity · 238589abe261edc16ee7436005d1beaa 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 = "final 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 DynExtDefaultClassFin();
  61. var arr = new Array(10, 15, 20, 25, 30);
  62. AddTestCase( "*** Access final method from final method of sub class ***", 1, 1 );
  63. AddTestCase( "EXTDCLASS.testFinSubArray(arr)", arr, (EXTDCLASS.testFinSubArray(arr)));
  64. // ********************************************
  65. // access final method from a default
  66. // method of a sub class
  67. //
  68. // ********************************************
  69. EXTDCLASS = new DynExtDefaultClassFin();
  70. var arr = new Array(1, 2, 3);
  71. AddTestCase( "*** Access final method from default method of sub class ***", 1, 1 );
  72. AddTestCase( "EXTDCLASS.testSubGetSetArray(arr)", arr, (EXTDCLASS.testSubGetSetArray(arr)) );
  73. // ********************************************
  74. // access final method from a public
  75. // method of a sub class
  76. //
  77. // ********************************************
  78. EXTDCLASS = new DynExtDefaultClassFin();
  79. var arr = new Array(4, 5, 6);
  80. AddTestCase( "*** Access final method from public method of sub class ***", 1, 1 );
  81. AddTestCase( "EXTDCLASS.pubSubSetArray(arr), EXTDCLASS.pubSubGetArray()", arr, (EXTDCLASS.pubSubSetArray(arr), EXTDCLASS.pubSubGetArray()) );
  82. // ********************************************
  83. // access final method from a private
  84. // method of a sub class
  85. //
  86. // ********************************************
  87. EXTDCLASS = new DynExtDefaultClassFin();
  88. var arr = new Array(10, 50);
  89. AddTestCase( "*** Access final method from private method of sub class ***", 1, 1 );
  90. AddTestCase( "EXTDCLASS.testPrivSubArray(arr)", arr, EXTDCLASS.testPrivSubArray(arr) );
  91. // ********************************************
  92. // access final method from a final
  93. // method of a sub class
  94. //
  95. // ********************************************
  96. EXTDCLASS = new DynExtDefaultClassFin();
  97. var arr = new Array(4, 5, 6);
  98. AddTestCase( "*** Access final method from public method of sub class ***", 1, 1 );
  99. AddTestCase( "EXTDCLASS.testFinSubArray(arr)", arr, (EXTDCLASS.testFinSubArray(arr)) );
  100. // ********************************************
  101. // access final method from a virtual
  102. // method of a sub class
  103. // ********************************************
  104. AddTestCase( "access 'final' method from 'virtual' method of sub class", arr,
  105. EXTDCLASS.testVirtSubArray(arr) );
  106. // ********************************************
  107. // access final property from outside
  108. // the class
  109. // ********************************************
  110. EXTDCLASS = new DynExtDefaultClassFin();
  111. AddTestCase( "*** Access final from outside the class ***", 1, 1 );
  112. //AddTestCase( "EXTDCLASS.finArray = arr", arr, (EXTDCLASS.finArray = arr, EXTDCLASS.finArray) );
  113. // ********************************************
  114. // access final property from
  115. // default method in sub class
  116. // ********************************************
  117. EXTDCLASS = new DynExtDefaultClassFin();
  118. var arr = new Array(10, 20, 30);
  119. AddTestCase( "*** Access final property from default method in sub class ***", 1, 1 );
  120. AddTestCase( "EXTDCLASS.testSubGetSetDPArray(arr)", arr, (EXTDCLASS.testSubGetSetDPArray(arr)) );
  121. // ********************************************
  122. // access final property from
  123. // public method in sub class
  124. // ********************************************
  125. EXTDCLASS = new DynExtDefaultClassFin();
  126. AddTestCase( "*** Access final property from public method in sub class ***", 1, 1 );
  127. AddTestCase( "EXTDCLASS.pubSubSetDPArray(arr), EXTDCLASS.pubSubGetDPArray()", arr, (EXTDCLASS.pubSubSetDPArray(arr), EXTDCLASS.pubSubGetDPArray()) );
  128. // ********************************************
  129. // access final property from
  130. // private method in sub class
  131. // ********************************************
  132. EXTDCLASS = new DynExtDefaultClassFin();
  133. AddTestCase( "*** Access final property from private method in sub class ***", 1, 1 );
  134. AddTestCase( "EXTDCLASS.testSubPrivDPArray(arr)", arr, (EXTDCLASS.testSubPrivDPArray(arr)) );
  135. // ********************************************
  136. // access final property from
  137. // final method in sub class
  138. // ********************************************
  139. EXTDCLASS = new DynExtDefaultClassFin();
  140. AddTestCase( "*** Access final property from final method in sub class ***", 1, 1 );
  141. AddTestCase( "EXTDCLASS.testSubFinDPArray(arr)", arr, (EXTDCLASS.testSubFinDPArray(arr)) );
  142. // ********************************************
  143. // access final property from
  144. // virtual method in sub class
  145. // ********************************************
  146. DYNEXTDCLASS = new DynExtDefaultClassFin();
  147. AddTestCase( "access 'final' property from 'virtual' method of sub class", arr,
  148. (EXTDCLASS.testVirtSubDPArray(arr)) );
  149. test(); // leave this alone. this executes the test cases and
  150. // displays results.