PageRenderTime 36ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 1ms

/flash/video/gnash-bzr/src/gnash-build/testsuite/misc-haxe.all/classes.all/display/DisplayObject_as.hx

https://github.com/o1iver/Code-Backup
Haxe | 320 lines | 263 code | 16 blank | 41 comment | 85 complexity | 24f0eb2696b596ba050069a0f19d3a2d MD5 | raw file
  1. // DisplayObject_as.hx: ActionScript 3 "DisplayObject" class, for Gnash.
  2. //
  3. // Generated on: 20090529 by "bnaugle". Remove this
  4. // after any hand editing loosing changes.
  5. //
  6. // Copyright (C) 2009, 2010 Free Software Foundation, Inc.
  7. //
  8. // This program is free software; you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation; either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program; if not, write to the Free Software
  20. // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  21. //
  22. // This test case must be processed by CPP before compiling to include the
  23. // DejaGnu.hx header file for the testing framework support.
  24. #if flash9
  25. import flash.accessibility.AccessibilityProperties;
  26. import flash.display.Loader;
  27. import flash.display.DisplayObjectContainer;
  28. import flash.display.DisplayObject;
  29. import flash.display.MovieClip;
  30. import flash.display.Shape;
  31. import flash.display.LoaderInfo;
  32. import flash.display.Sprite;
  33. import flash.display.Stage;
  34. import flash.geom.Rectangle;
  35. import flash.geom.Transform;
  36. import flash.net.URLRequest;
  37. #end
  38. import flash.Lib;
  39. import Type;
  40. import Std;
  41. // import our testing API
  42. import DejaGnu;
  43. // Class must be named with the _as suffix, as that's the same name as the file.
  44. class DisplayObject_as {
  45. static function main() {
  46. #if flash9
  47. var x1:Shape = new Shape();
  48. var l1:DisplayObject = new Loader();
  49. var r1:Rectangle = new Rectangle(1,1,1,1);
  50. // Make sure we actually get a valid class
  51. if (untyped __typeof__(DisplayObject) == 'object') {
  52. DejaGnu.pass("DisplayObject class exists");
  53. } else {
  54. DejaGnu.fail("DisplayObject class does not exist");
  55. }
  56. if (Std.is(x1, DisplayObject)) {
  57. DejaGnu.pass("Shape correctly inherits DisplayObject");
  58. } else {
  59. DejaGnu.fail("Shape does not correctly inherit DisplayObject");
  60. }
  61. //---------------------------------------------------------------------
  62. // Property Existence
  63. //---------------------------------------------------------------------
  64. DejaGnu.note("**** Property Existence testing ****");
  65. if (untyped x1.hasOwnProperty('accessibilityProperties')) {
  66. DejaGnu.pass("DisplayObject::accessibilityProperties property exists");
  67. } else {
  68. DejaGnu.fail("[ln:"+here.lineNumber+
  69. "]DisplayObject::accessibilityProperties property"+
  70. " doesn't exist");
  71. }
  72. if (untyped x1.hasOwnProperty('alpha')) {
  73. DejaGnu.pass("DisplayObject::alpha property exists");
  74. } else {
  75. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::alpha"+
  76. " property doesn't exist");
  77. }
  78. if (untyped x1.hasOwnProperty('blendMode')) {
  79. DejaGnu.pass("DisplayObject::blendMode property exists");
  80. } else {
  81. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::blendMode"+
  82. " property doesn't exist");
  83. }
  84. if (untyped x1.hasOwnProperty('cacheAsBitmap')) {
  85. DejaGnu.pass("DisplayObject::cacheAsBitmap property exists");
  86. } else {
  87. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::cacheAsBitmap"+
  88. " property doesn't exist");
  89. }
  90. if (untyped x1.hasOwnProperty('filters')) {
  91. DejaGnu.pass("DisplayObject::filters property exists");
  92. } else {
  93. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::filters"+
  94. " property doesn't exist");
  95. }
  96. if (untyped x1.hasOwnProperty('height')) {
  97. DejaGnu.pass("DisplayObject::height property exists");
  98. } else {
  99. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::height"+
  100. " property doesn't exist");
  101. }
  102. if (untyped x1.hasOwnProperty('loaderInfo')) {
  103. DejaGnu.pass("DisplayObject::loaderInfo property exists");
  104. } else {
  105. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::loaderInfo"+
  106. " property does not exist");
  107. }
  108. //Determine if the mask property of x1 exists by setting it and testing it
  109. if (untyped x1.hasOwnProperty('mask')) {
  110. DejaGnu.pass("DisplayObject::mask property exists");
  111. } else {
  112. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::mask property"+
  113. " does not exist");
  114. }
  115. if (untyped x1.hasOwnProperty('mouseX')) {
  116. DejaGnu.pass("DisplayObject::mouseX property exists");
  117. } else {
  118. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::mouseX"+
  119. " property doesn't exist");
  120. }
  121. if (untyped x1.hasOwnProperty('mouseY')) {
  122. DejaGnu.pass("DisplayObject::mouseY property exists");
  123. } else {
  124. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::mouseY"+
  125. " property doesn't exist");
  126. }
  127. if (untyped x1.hasOwnProperty('name')) {
  128. DejaGnu.pass("DisplayObject::name property exists");
  129. } else {
  130. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::name property"+
  131. " doesn't exist");
  132. }
  133. if (untyped x1.hasOwnProperty('opaqueBackground')) {
  134. DejaGnu.pass("DisplayObject::opaqueBackground property exists");
  135. } else {
  136. DejaGnu.fail("[ln:"+here.lineNumber+
  137. "]DisplayObject::opaqueBackground property doesn't"+
  138. " exist");
  139. }
  140. if (untyped x1.hasOwnProperty('parent')) {
  141. DejaGnu.pass("DisplayObject::parent property exists");
  142. } else {
  143. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::parent"+
  144. " property does not exist");
  145. }
  146. if (untyped x1.hasOwnProperty('root')) {
  147. DejaGnu.pass("DisplayObject::root property exists");
  148. } else {
  149. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::root property"+
  150. " doesn't exist");
  151. }
  152. if (untyped x1.hasOwnProperty('rotation')) {
  153. DejaGnu.pass("DisplayObject::rotation property exists");
  154. } else {
  155. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::rotation"+
  156. " property doesn't exist");
  157. }
  158. if (untyped x1.hasOwnProperty('scale9Grid')) {
  159. DejaGnu.pass("DisplayObject::scale9Grid property exists");
  160. } else {
  161. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::scale9Grid"+
  162. " property doesn't exist");
  163. }
  164. if (untyped x1.hasOwnProperty('scaleX')) {
  165. DejaGnu.pass("DisplayObject::scaleX property exists");
  166. } else {
  167. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::scaleX"+
  168. " property doesn't exist");
  169. }
  170. if (untyped x1.hasOwnProperty('scaleY')) {
  171. DejaGnu.pass("DisplayObject::scaleY property exists");
  172. } else {
  173. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::scaleY"+
  174. " property doesn't exist");
  175. }
  176. if (untyped x1.hasOwnProperty('scrollRect')) {
  177. DejaGnu.pass("DisplayObject::scrollRect property exists");
  178. } else {
  179. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::scrollRect"+
  180. " property doesn't exist");
  181. }
  182. if (untyped x1.hasOwnProperty('stage')) {
  183. DejaGnu.pass("DisplayObject::stage property exists");
  184. } else {
  185. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::stage"+
  186. "property doesn't exist");
  187. }
  188. if (untyped x1.hasOwnProperty('transform')) {
  189. DejaGnu.pass("DisplayObject::transform property exists");
  190. } else {
  191. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::transform"+
  192. " property doesn't exist");
  193. }
  194. if (untyped x1.hasOwnProperty('visible')) {
  195. DejaGnu.pass("DisplayObject::visible property exists");
  196. } else {
  197. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::visible"+
  198. " property doesn't exist");
  199. }
  200. if (untyped x1.hasOwnProperty('width')) {
  201. DejaGnu.pass("DisplayObject::width property exists");
  202. } else {
  203. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::width"+
  204. " property doesn't exist");
  205. }
  206. if (untyped x1.hasOwnProperty('x')) {
  207. DejaGnu.pass("DisplayObject::x property exists");
  208. } else {
  209. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::x property"+
  210. " doesn't exist");
  211. }
  212. if (untyped x1.hasOwnProperty('y')) {
  213. DejaGnu.pass("DisplayObject::y property exists");
  214. } else {
  215. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::y property"+
  216. " doesn't exist");
  217. }
  218. // Tests to see if all the methods exist. All these do is test for
  219. // existance of a method, and don't test the functionality at all. This
  220. // is primarily useful only to test completeness of the API implementation.
  221. //----------------------------------------------------------------------
  222. // Method Existence
  223. //----------------------------------------------------------------------
  224. if (untyped x1.hasOwnProperty('getBounds')) {
  225. DejaGnu.pass("DisplayObject::getBounds() method exists");
  226. } else {
  227. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::getBounds()"+
  228. " method doesn't exist");
  229. }
  230. if (untyped __typeof__(x1.getBounds) == 'function') {
  231. DejaGnu.pass("getBounds() is a function");
  232. } else {
  233. DejaGnu.fail("[ln:"+here.lineNumber+"]getBounds() is not a function");
  234. }
  235. if (untyped x1.hasOwnProperty('getRect')) {
  236. DejaGnu.pass("DisplayObject::getRect() method exists");
  237. } else {
  238. DejaGnu.fail("[ln:"+here.lineNumber+"]DisplayObject::getRect()"+
  239. " method doesn't exist");
  240. }
  241. if (untyped __typeof__(x1.getRect) == 'function') {
  242. DejaGnu.pass("getRect() is a function");
  243. } else {
  244. DejaGnu.fail("[ln:"+here.lineNumber+"]getRect() is not a function");
  245. }
  246. if (untyped x1.hasOwnProperty('globalToLocal')) {
  247. DejaGnu.pass("DisplayObject::globalToLocal() method exists");
  248. } else {
  249. DejaGnu.fail("[ln:"+here.lineNumber+
  250. "]DisplayObject::globalToLocal() method doesn't exist");
  251. }
  252. if (untyped __typeof__(x1.globalToLocal) == 'function') {
  253. DejaGnu.pass("globalToLocal() is a function");
  254. } else {
  255. DejaGnu.fail("[ln:"+here.lineNumber+"]globalToLocal() is not a"+
  256. " function");
  257. }
  258. if (untyped x1.hasOwnProperty('hitTestObject')) {
  259. DejaGnu.pass("DisplayObject::hitTestObject() method exists");
  260. } else {
  261. DejaGnu.fail("[ln:"+here.lineNumber+
  262. "]DisplayObject::hitTestObject() method doesn't exist");
  263. }
  264. if (untyped __typeof__(x1.hitTestObject) == 'function') {
  265. DejaGnu.pass("hitTestObject() is a function");
  266. } else {
  267. DejaGnu.fail("[ln:"+here.lineNumber+"]hitTestObject() is not a"+
  268. " function");
  269. }
  270. if (untyped x1.hasOwnProperty('hitTestPoint')) {
  271. DejaGnu.pass("DisplayObject::hitTestPoint() method exists");
  272. } else {
  273. DejaGnu.fail("[ln:"+here.lineNumber+
  274. "]DisplayObject::hitTestPoint() method doesn't exist");
  275. }
  276. if (untyped __typeof__(x1.hitTestPoint) == 'function') {
  277. DejaGnu.pass("hitTestPoint() is a function");
  278. } else {
  279. DejaGnu.fail("[ln:"+here.lineNumber+"]hitTestPoint() is not a"+
  280. " function");
  281. }
  282. if (untyped x1.hasOwnProperty('localToGlobal')) {
  283. DejaGnu.pass("DisplayObject::localToGlobal() method exists");
  284. } else {
  285. DejaGnu.fail("[ln:"+here.lineNumber+
  286. "]DisplayObject::localToGlobal() method doesn't exist");
  287. }
  288. if (untyped __typeof__(x1.localToGlobal) == 'function') {
  289. DejaGnu.pass("localToGlobal() is a function");
  290. } else {
  291. DejaGnu.fail("[ln:"+here.lineNumber+"]localToGlobal() is not a"+
  292. " function");
  293. }
  294. #else
  295. DejaGnu.note("Display Object did not exist in versions prior to SWF 9");
  296. // Call this after finishing all tests. It prints out the totals.
  297. #end
  298. DejaGnu.done();
  299. }
  300. }
  301. // local Variables:
  302. // mode: C++
  303. // indent-tabs-mode: t
  304. // End: