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

https://github.com/bsdf/trx · ActionScript · 159 lines · 33 code · 32 blank · 94 comment · 0 complexity · dfb0c628d58cbe9c6fea11d01eb4b540 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 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 DynExtDynamicClass();
  65. var arr = new Array(1, 2, 3);
  66. // ********************************************
  67. // access default method from a default
  68. // method of a sub class
  69. //
  70. // ********************************************
  71. EXTDCLASS = new DynExtDynamicClass();
  72. AddTestCase( "*** Access default method from default method of sub class ***", 1, 1 );
  73. AddTestCase( "EXTDCLASS.testSubArray(arr)", arr, (EXTDCLASS.testSubArray(arr)) );
  74. // ********************************************
  75. // access default method from a public
  76. // method of a sub class
  77. //
  78. // ********************************************
  79. EXTDCLASS = new DynExtDynamicClass();
  80. AddTestCase( "*** Access default 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 default method from a private
  84. // method of a sub class
  85. //
  86. // ********************************************
  87. EXTDCLASS = new DynExtDynamicClass();
  88. AddTestCase( "*** Access default method from private method of sub class ***", 1, 1 );
  89. AddTestCase( "EXTDCLASS.testPrivSubArray(arr)", arr, EXTDCLASS.testPrivSubArray(arr) );
  90. // ********************************************
  91. // access default method from a final
  92. // method of a sub class
  93. //
  94. // ********************************************
  95. EXTDCLASS = new DynExtDynamicClass();
  96. AddTestCase( "*** Access default method from final method of sub class ***", 1, 1 );
  97. AddTestCase( "EXTDCLASS.testFinSubArray(arr)", arr, (EXTDCLASS.testFinSubArray(arr)) );
  98. // ********************************************
  99. // access default property from
  100. // default method in sub class
  101. // ********************************************
  102. EXTDCLASS = new DynExtDynamicClass();
  103. AddTestCase( "*** Access default property from method in sub class ***", 1, 1 );
  104. AddTestCase( "EXTDCLASS.testSubGetDPArray(arr)", arr, (EXTDCLASS.testSubGetDPArray(arr)) );
  105. // ********************************************
  106. // access default property from
  107. // public method in sub class
  108. // ********************************************
  109. EXTDCLASS = new DynExtDynamicClass();
  110. AddTestCase( "*** Access default property from public method in sub class ***", 1, 1 );
  111. AddTestCase( "EXTDCLASS.pubSubSetDPArray(arr), EXTDCLASS.pubSubGetDPArray()", arr, (EXTDCLASS.pubSubSetDPArray(arr), EXTDCLASS.pubSubGetDPArray()) );
  112. // ********************************************
  113. // access default property from
  114. // private method in sub class
  115. // ********************************************
  116. EXTDCLASS = new DynExtDynamicClass();
  117. AddTestCase( "*** Access default property from private method in sub class ***", 1, 1 );
  118. AddTestCase( "EXTDCLASS.testPrivSubGetDPArray(arr)", arr, (EXTDCLASS.testPrivSubGetDPArray(arr)) );
  119. // ********************************************
  120. // access default property from
  121. // final method in sub class
  122. // ********************************************
  123. EXTDCLASS = new DynExtDynamicClass();
  124. AddTestCase( "*** Access default property from final method in sub class ***", 1, 1 );
  125. AddTestCase( "EXTDCLASS.testFinSubGetDPArray(arr)", arr, (EXTDCLASS.testFinSubGetDPArray(arr)) );
  126. test(); // leave this alone. this executes the test cases and
  127. // displays results.