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

https://github.com/bsdf/trx · ActionScript · 181 lines · 36 code · 38 blank · 107 comment · 0 complexity · 5eb3c8ceeda92e3eb8b0b22e77a08b79 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 = "public 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 default method of parent class
  62. // from outside of class
  63. //**********************************************
  64. var EXTDCLASS = new PubExtDynamicClass();
  65. arr = new Array(1, 2, 3);
  66. AddTestCase( "*** access default method of parent class from outside of class ***", 1, 1 );
  67. //AddTestCase( "EXTDCLASS.setArray(arr), EXTDCLASS.getArray()", arr, (EXTDCLASS.setArray(arr), EXTDCLASS.getArray()) );
  68. // ********************************************
  69. // access default method from a default
  70. // method of a sub class
  71. //
  72. // ********************************************
  73. EXTDCLASS = new PubExtDynamicClass();
  74. AddTestCase( "*** Access default method from default method of sub class ***", 1, 1 );
  75. AddTestCase( "EXTDCLASS.testSubGetSetArray(arr)", arr, EXTDCLASS.testSubGetSetArray(arr) );
  76. // <TODO> fill in the rest of the cases here
  77. // ********************************************
  78. // access default method from a public
  79. // method of a sub class
  80. //
  81. // ********************************************
  82. EXTDCLASS = new PubExtDynamicClass();
  83. AddTestCase( "*** Access default method from public method of sub class ***", 1, 1 );
  84. AddTestCase( "EXTDCLASS.pubSubSetArray(arr), EXTDCLASS.pubSubGetArray()", arr, (EXTDCLASS.pubSubSetArray(arr), EXTDCLASS.pubSubGetArray()) );
  85. // <TODO> fill in the rest of the cases here
  86. // ********************************************
  87. // access default method from a private
  88. // method of a sub class
  89. //
  90. // ********************************************
  91. EXTDCLASS = new PubExtDynamicClass();
  92. AddTestCase( "*** Access default method from private method of sub class ***", 1, 1 );
  93. AddTestCase( "EXTDCLASS.testPrivSubArray(arr)", arr, EXTDCLASS.testPrivSubArray(arr) );
  94. // <TODO> fill in the rest of the cases here
  95. // ********************************************
  96. // access default method from a final
  97. // method of a sub class
  98. //
  99. // ********************************************
  100. EXTDCLASS = new PubExtDynamicClass();
  101. AddTestCase( "*** Access default method from final method of sub class ***", 1, 1 );
  102. AddTestCase( "EXTDCLASS.testFinSubArray(arr)", arr, EXTDCLASS.testFinSubArray(arr) );
  103. // ********************************************
  104. // access default property from outside
  105. // the class
  106. // ********************************************
  107. EXTDCLASS = new PubExtDynamicClass();
  108. AddTestCase( "*** Access default property from outside the class ***", 1, 1 );
  109. //AddTestCase( "EXTDCLASS.array = arr", arr, (EXTDCLASS.array = arr, EXTDCLASS.array) );
  110. // <TODO> fill in the rest of the cases here
  111. // ********************************************
  112. // access default property from
  113. // default method in sub class
  114. // ********************************************
  115. EXTDCLASS = new PubExtDynamicClass();
  116. AddTestCase( "*** Access default property from method in sub class ***", 1, 1 );
  117. AddTestCase( "EXTDCLASS.subSetDPArray(arr), EXTDCLASS.subGetDPArray()", arr, EXTDCLASS.testSubGetSetDPArray(arr) );
  118. // <TODO> fill in the rest of the cases here
  119. // ********************************************
  120. // access default property from
  121. // public method in sub class
  122. // ********************************************
  123. EXTDCLASS = new PubExtDynamicClass();
  124. AddTestCase( "*** Access default property from public method in sub class ***", 1, 1 );
  125. AddTestCase( "EXTDCLASS.pubSubSetDPArray(arr), EXTDCLASS.pubSubGetDPArray()", arr, (EXTDCLASS.pubSubSetDPArray(arr), EXTDCLASS.pubSubGetDPArray()) );
  126. // <TODO> fill in the rest of the cases here
  127. // ********************************************
  128. // access default property from
  129. // private method in sub class
  130. // ********************************************
  131. EXTDCLASS = new PubExtDynamicClass();
  132. AddTestCase( "*** Access default property from private method in sub class ***", 1, 1 );
  133. AddTestCase( "EXTDCLASS.testPrivSubDPArray(arr)", arr, EXTDCLASS.testPrivSubDPArray(arr) );
  134. // <TODO> fill in the rest of the cases here
  135. // ********************************************
  136. // access default property from
  137. // final method in sub class
  138. // ********************************************
  139. EXTDCLASS = new PubExtDynamicClass();
  140. AddTestCase( "*** Access default property from final method in sub class ***", 1, 1 );
  141. AddTestCase( "EXTDCLASS.finSubSetDPArray(arr), EXTDCLASS.finSubGetDPArray()", arr, EXTDCLASS.testFinSubDPArray(arr) );
  142. test(); // leave this alone. this executes the test cases and
  143. // displays results.