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

https://github.com/bsdf/trx · ActionScript · 186 lines · 35 code · 40 blank · 111 comment · 0 complexity · 5ec609d2566d08939a30eb0468058680 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 InternalClass.*;
  38. var SECTION = "Definitions"; // provide a document reference (ie, ECMA section)
  39. var VERSION = "AS3"; // Version of JavaScript or ECMA
  40. var TITLE = "Extend 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. // ************************************
  61. // public class extends <empty> class
  62. // ************************************
  63. var arr = new Array(1,2,3);
  64. // ********************************************
  65. // access default method from outside of class
  66. // ********************************************
  67. // this should give a compiler error
  68. PUBEXTDCLASS = new PubExtInternalClass();
  69. //We cannot access the default method from outside the class
  70. //AddTestCase( "PUBEXTDCLASS.setArray(arr), PUBEXTDCLASS.getArray()", arr, (PUBEXTDCLASS.setArray(arr), PUBEXTDCLASS.getArray()) );
  71. // ********************************************
  72. // access default method from a default
  73. // method of a sub class
  74. //
  75. // ********************************************
  76. PUBEXTDCLASS = new PubExtInternalClass();
  77. AddTestCase( "*** Access default method from default method of sub class ***", 1, 1 );
  78. AddTestCase( "PUBEXTDCLASS.subSetArray(arr), PUBEXTDCLASS.subGetArray()", arr, PUBEXTDCLASS.testSubGetSetArray(arr) );
  79. // <TODO> fill in the rest of the cases here
  80. // ********************************************
  81. // access default method from a public
  82. // method of a sub class
  83. //
  84. // ********************************************
  85. PUBEXTDCLASS = new PubExtInternalClass();
  86. AddTestCase( "*** Access default method from public method of sub class ***", 1, 1 );
  87. AddTestCase( "PUBEXTDCLASS.pubSubSetArray(arr), PUBEXTDCLASS.pubSubGetArray()", arr, (PUBEXTDCLASS.pubSubSetArray(arr), PUBEXTDCLASS.pubSubGetArray()) );
  88. // <TODO> fill in the rest of the cases here
  89. // ********************************************
  90. // access default method from a private
  91. // method of a sub class
  92. //
  93. // ********************************************
  94. PUBEXTDCLASS = new PubExtInternalClass();
  95. AddTestCase( "*** Access default method from private method of sub class ***", 1, 1 );
  96. AddTestCase( "PUBEXTDCLASS.testPrivSubArray(arr)", arr, PUBEXTDCLASS.testPrivSubArray(arr) );
  97. // <TODO> fill in the rest of the cases here
  98. // ********************************************
  99. // access default method from a final
  100. // method of a sub class
  101. //
  102. // ********************************************
  103. PUBEXTDCLASS = new PubExtInternalClass();
  104. AddTestCase( "*** Access default method from default method of sub class ***", 1, 1 );
  105. AddTestCase( "PUBEXTDCLASS.finSubSetArray(arr), PUBEXTDCLASS.finSubGetArray()", arr, PUBEXTDCLASS.testFinSubArray(arr) );
  106. // ********************************************
  107. // access default property from outside
  108. // the class
  109. // ********************************************
  110. PUBEXTDCLASS = new PubExtInternalClass();
  111. AddTestCase( "*** Access default property from outside the class ***", 1, 1 );
  112. //AddTestCase( "PUBEXTDCLASS.array = arr", arr, (PUBEXTDCLASS.array = arr, PUBEXTDCLASS.array) );
  113. // <TODO> fill in the rest of the cases here
  114. // ********************************************
  115. // access default property from
  116. // default method in sub class
  117. // ********************************************
  118. PUBEXTDCLASS = new PubExtInternalClass();
  119. AddTestCase( "*** Access default property from method in sub class ***", 1, 1 );
  120. AddTestCase( "PUBEXTDCLASS.subSetDPArray(arr), PUBEXTDCLASS.subGetDPArray()", arr, PUBEXTDCLASS.testSubGetSetDPArray(arr) );
  121. // <TODO> fill in the rest of the cases here
  122. // ********************************************
  123. // access default property from
  124. // public method in sub class
  125. // ********************************************
  126. PUBEXTDCLASS = new PubExtInternalClass();
  127. AddTestCase( "*** Access default property from public method in sub class ***", 1, 1 );
  128. AddTestCase( "PUBEXTDCLASS.pubSubSetDPArray(arr), PUBEXTDCLASS.pubSubGetDPArray()", arr, (PUBEXTDCLASS.pubSubSetDPArray(arr), PUBEXTDCLASS.pubSubGetDPArray()) );
  129. // <TODO> fill in the rest of the cases here
  130. // ********************************************
  131. // access default property from
  132. // private method in sub class
  133. // ********************************************
  134. PUBEXTDCLASS = new PubExtInternalClass();
  135. AddTestCase( "*** Access default property from private method in sub class ***", 1, 1 );
  136. AddTestCase( "PUBEXTDCLASS.privSubSetDPArray(arr), PUBEXTDCLASS.privSubGetDPArray()", arr, PUBEXTDCLASS.testPrivSubDPArray(arr) );
  137. // <TODO> fill in the rest of the cases here
  138. // ********************************************
  139. // access default property from
  140. // final method in sub class
  141. // ********************************************
  142. PUBEXTDCLASS = new PubExtInternalClass();
  143. AddTestCase( "*** Access default property from final method in sub class ***", 1, 1 );
  144. AddTestCase( "PUBEXTDCLASS.finSubSetDPArray(arr), PUBEXTDCLASS.finSubGetDPArray()", arr, PUBEXTDCLASS.testFinSubDPArray(arr) );
  145. test(); // leave this alone. this executes the test cases and
  146. // displays results.