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

https://github.com/bsdf/trx · ActionScript · 189 lines · 39 code · 42 blank · 108 comment · 0 complexity · f43df50639e0d3b5b2c9133e201c7488 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 = "AS 3.0"; // Version of JavaScript or ECMA
  40. var TITLE = "dynamic class 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. //*******************************************
  61. // access final method from
  62. // outside of class
  63. //*******************************************
  64. var EXTDCLASS = new DynExtDynamicClassFin();
  65. var arr = new Array(1, 2, 3);
  66. // ********************************************
  67. // access final method from a default
  68. // method of a sub class
  69. //
  70. // ********************************************
  71. EXTDCLASS = new DynExtDynamicClassFin();
  72. AddTestCase( "*** Access final method from default method of sub class ***", 1, 1 );
  73. AddTestCase( "EXTDCLASS.testSubArray(arr)", arr, (EXTDCLASS.testSubArray(arr)) );
  74. // ********************************************
  75. // access final method from a public
  76. // method of a sub class
  77. //
  78. // ********************************************
  79. EXTDCLASS = new DynExtDynamicClassFin();
  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 DynExtDynamicClassFin();
  88. AddTestCase( "*** Access final method from private method of sub class ***", 1, 1 );
  89. AddTestCase( "EXTDCLASS.testPrivSubArray(arr)", arr, EXTDCLASS.testPrivSubArray(arr) );
  90. // ********************************************
  91. // access final method from a final
  92. // method of a sub class
  93. //
  94. // ********************************************
  95. EXTDCLASS = new DynExtDynamicClassFin();
  96. AddTestCase( "*** Access final method from final method of sub class ***", 1, 1 );
  97. AddTestCase( "EXTDCLASS.testFinSubArray(arr)", arr, (EXTDCLASS.testFinSubArray(arr)) );
  98. // ********************************************
  99. // access final method from a private final
  100. // method of a sub class
  101. //
  102. // ********************************************
  103. EXTDCLASS = new DynExtDynamicClassFin();
  104. AddTestCase( "*** Access final method from private final method of sub class ***", 1, 1 );
  105. AddTestCase( "EXTDCLASS.testPrivFinSubArray(arr)", arr, (EXTDCLASS.testPrivFinSubArray(arr)) );
  106. // ********************************************
  107. // access final method from a virtual
  108. // method of a sub class
  109. //
  110. // ********************************************
  111. EXTDCLASS = new DynExtDynamicClassFin();
  112. AddTestCase( "*** Access final method from virtual method of sub class ***", 1, 1 );
  113. AddTestCase( "EXTDCLASS.testVirSubArray(arr)", arr, (EXTDCLASS.testVirSubArray(arr)) );
  114. // ********************************************
  115. // access final property from outside
  116. // the class
  117. // ********************************************
  118. // ********************************************
  119. // access final property from
  120. // default method in sub class
  121. // ********************************************
  122. EXTDCLASS = new DynExtDynamicClassFin();
  123. AddTestCase( "*** Access final property from method in sub class ***", 1, 1 );
  124. AddTestCase( "EXTDCLASS.testSubGetDPArray(arr)", arr, (EXTDCLASS.testSubGetDPArray(arr)) );
  125. // ********************************************
  126. // access final property from
  127. // public method in sub class
  128. // ********************************************
  129. EXTDCLASS = new DynExtDynamicClassFin();
  130. AddTestCase( "*** Access final property from public method in sub class ***", 1, 1 );
  131. AddTestCase( "EXTDCLASS.pubSubSetDPArray(arr), EXTDCLASS.pubSubGetDPArray()", arr, (EXTDCLASS.pubSubSetDPArray(arr), EXTDCLASS.pubSubGetDPArray()) );
  132. // ********************************************
  133. // access final property from
  134. // private method in sub class
  135. // ********************************************
  136. EXTDCLASS = new DynExtDynamicClassFin();
  137. AddTestCase( "*** Access final property from private method in sub class ***", 1, 1 );
  138. AddTestCase( "EXTDCLASS.testPrivSubGetDPArray(arr)", arr, (EXTDCLASS.testPrivSubGetDPArray(arr)) );
  139. // ********************************************
  140. // access final property from
  141. // private virtual method in sub class
  142. // ********************************************
  143. EXTDCLASS = new DynExtDynamicClassFin();
  144. AddTestCase( "*** Access final property from private virtual method in sub class ***", 1, 1 );
  145. AddTestCase( "EXTDCLASS.testPrivVirSubGetDPArray(arr)", arr, (EXTDCLASS.testPrivVirSubGetDPArray(arr)) );
  146. test(); // leave this alone. this executes the test cases and
  147. // displays results.