"Fossies" - the Fresh Open Source Software Archive

Member "gnash-0.8.10/testsuite/misc-haxe.all/classes.all/accessibility/Accessibility_as.hx" (19 Jan 2012, 8699 Bytes) of package /linux/www/old/gnash-0.8.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) haXe source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 // Accessibility_as.hx:  ActionScript 3 "Accessibility" class, for Gnash.
    2 //
    3 // Generated by gen-as3.sh on: 20090514 by "rob". 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 
   23 // This test case must be processed by CPP before compiling to include the
   24 //  DejaGnu.hx header file for the testing framework support.
   25 
   26 // These tests were in the ming test files, but have not yet been included
   27 // in the haxe cases
   28 // Possible internal tests that need to be written
   29 // check_equals (typeof(Accessibility.__proto__), 'object');
   30 // check_equals (Accessibility.__proto__, Object.prototype);
   31 // sendEvent may be a function that is undocumented in the Adobe specs
   32 // check_equals ( typeof(Accessibility.sendEvent), 'function' );
   33 // check(Accessibility.hasOwnProperty("sendEvent"));
   34 
   35 #if flash9
   36 import flash.accessibility.Accessibility;
   37 import flash.display.MovieClip;
   38 #else
   39 import flash.Accessibility;
   40 import flash.MovieClip;
   41 #end
   42 import flash.Lib;
   43 import Type;
   44 import Reflect;
   45 import haxe.PosInfos;
   46 
   47 // import our testing API
   48 import DejaGnu;
   49 
   50 // Class must be named with the _as suffix, as that's the same name as the file.
   51 class Accessibility_as {
   52     static function main() {
   53 
   54 // Tests to see if all the properties exist. All these do is test for
   55 // existance of a property, and don't test the functionality at all. This
   56 // is primarily useful only to test completeness of the API implementation.
   57 #if flash9
   58 // Should be:
   59 //      TBool
   60 //      null
   61 //      false
   62 //      false
   63 //      flash.accessibility.Accessibility
   64 //      sendEvent
   65     
   66     if (Type.typeof(Accessibility.active) == ValueType.TBool) {
   67         DejaGnu.pass("Accessibility::active property exists");
   68     } else {
   69         DejaGnu.fail("Accessibility::active property doesn't exist");
   70     }
   71 
   72     // Test for existence of updateProperties method
   73     // updateProperties throws error if Capabilities.hasAccessability == false
   74     if ( flash.system.Capabilities.hasAccessibility != false ) {
   75         if (Accessibility.updateProperties() != null) {
   76                 DejaGnu.pass("Accessibility::updateProperties() method exists");
   77         } else {
   78                 DejaGnu.fail("Accessibility::updateProperties() method doesn't exist");
   79         }
   80     }   
   81 #else
   82 
   83 
   84     if (Type.typeof(Accessibility.isActive) == ValueType.TFunction) {
   85         DejaGnu.pass("Accessibility::isActive method exists");
   86     } else {
   87         DejaGnu.fail("Accessibility::isActive method doesn't exist");
   88     }
   89     
   90     // Tests to see if all the methods exist. All these do is test for
   91     // existance of a method, and don't test the functionality at all. This
   92     // is primarily useful only to test completeness of the API implementation.
   93     DejaGnu.note("ME1A "   + Type.typeof(Accessibility.updateProperties()));
   94 
   95     if (Type.typeof(Accessibility.updateProperties) == ValueType.TFunction) {
   96         DejaGnu.pass("Accessibility::updateProperties() method exists");
   97     } else {
   98         DejaGnu.fail("Accessibility::updateProperties() method doesn't exist");
   99     }
  100 #end        
  101 //Si
  102 //Add more tests here.
  103 
  104 DejaGnu.note("\n The following tests come from the Ming test. \n " );
  105 //      Accessibility has no constructor 
  106 //  var accObj:Accessibility = new Accessibility();
  107 
  108 #if flash9
  109 #else
  110     var accobj = untyped __new__(Accessibility);
  111     if (Std.string(untyped __typeof__(accobj)) == 'undefined') {
  112         DejaGnu.pass("Type of accobj is undefined");
  113     } else {
  114         DejaGnu.fail("Type of accObj is not undefined");
  115     }
  116 #end
  117 
  118 //Check the prototype.
  119 #if flash9
  120     //Do Nothing!
  121 #else
  122     if ( Reflect.isObject(untyped Accessibility.__proto__)) {
  123         DejaGnu.pass("Accessibility.prototype.__proto_ field exists");
  124     } else {
  125         DejaGnu.fail("Accessibility.prototype.__proto__ field does not exist");
  126     }
  127     if ( untyped Accessibility.__proto__ == untyped Object.prototype) {
  128         DejaGnu.pass("Accessibility.prototype.__proto__ references Object.prototype");
  129     } else {
  130         DejaGnu.fail("Accessibility.prototype.__proto__ does not reference Object.prototype");
  131     }
  132 #end
  133 
  134 #if flash9
  135     if (untyped Accessibility.hasOwnProperty("active")) {
  136         DejaGnu.pass("Accessibility. 'active' property exists");
  137     } else {
  138         DejaGnu.fail("Accessibility. 'active' property does not exist");
  139     }
  140     if (Std.is(untyped Accessibility.active, Bool) ){
  141       DejaGnu.pass("Accessibility.active is a bool");
  142     } else {
  143         DejaGnu.fail("Accessibility.active is not a bool");
  144     }   
  145 #else
  146     if (untyped Accessibility.hasOwnProperty("isActive")) {
  147         DejaGnu.pass("Accessibility.prototype. 'isActive' property exists");
  148     } else {
  149         DejaGnu.fail("Accessibility.prototype. 'isActive' property does not exist");
  150     }
  151     if (Type.typeof(untyped Accessibility.isActive)== TFunction){
  152         DejaGnu.pass("System.security 'isActive' is a function");
  153     } else {
  154         DejaGnu.fail("System.security 'isActive' is not a function");
  155     }
  156     
  157 #if !flash6
  158     // This was set to xfail in the ming, but seems to pass now in both the pp
  159     // and gnash
  160     //xcheck_equals ( typeof(Accessibility.isActive()), 'boolean' );
  161     if ( untyped __typeof__(Reflect.callMethod(Accessibility, 
  162                                    Reflect.field(Accessibility, 'isActive'),
  163                                    []) == 'boolean') ){
  164         DejaGnu.pass("Accessibility.isActive should be a Bool!!!! WARNING!!!");
  165     } else {
  166         DejaGnu.fail("Accessibility.isActive is not a Bool.");
  167     }
  168 #end
  169 #end
  170 
  171     if (untyped Accessibility.hasOwnProperty("updateProperties")) {
  172     DejaGnu.pass("Accessibility.prototype. 'updateProperties' property exists");
  173     } else {
  174         DejaGnu.fail("Accessibility.prototype. 'updateProperties' property does not exist");
  175     }
  176     if (untyped Accessibility.hasOwnProperty("sendEvent")) {
  177     DejaGnu.pass("Accessibility.prototype. 'sendEvent' property exists");
  178     } else {
  179         DejaGnu.fail("Accessibility.prototype. 'sendEvent' property does not exist");
  180     }
  181     if (Type.typeof(untyped Accessibility.updateProperties)== TFunction){
  182         DejaGnu.pass("System.security 'updateProperties' is a function");
  183     } else {
  184         DejaGnu.fail("System.security 'updateProperties' is not a function");
  185     }
  186     if (Type.typeof(untyped Accessibility.sendEvent)== TFunction){
  187         DejaGnu.pass("System.security 'sendEvent' is a function");
  188     } else {
  189         DejaGnu.fail("System.security 'sendEvent' is not a function");
  190     }
  191     
  192     //These two methods are only defined in SWF 5. haxe does not compile SWF5!
  193     // Methods return void (just undefined in SWF 5).
  194     // Make sure the return type is reight.
  195     //  DejaGnu.note(""+untyped __typeof__(Accessibility.updateProperties()) );
  196     //  DejaGnu.note(""+untyped __typeof__(Accessibility.sendEvent()) );
  197 
  198 #if flash9
  199 #else
  200     if (untyped __typeof__(Reflect.callmethod(Accessibility,
  201                                Reflect.field(Accessibility, 'updateProperties'),
  202                                [] )) == 'undefined'){
  203         DejaGnu.pass("The return type of Accessibility.updateProperties is void (good).");
  204     } else {
  205         DejaGnu.fail("The rerurn type of Accessibility.updateProperties is somewhat defined (wrong).");
  206     }
  207 
  208     if (untyped __typeof__(Reflect.callmethod(Accessibility,
  209                                Reflect.field(Accessibility, 'sendEvent'),
  210                                [] )) == 'undefined'){
  211         DejaGnu.pass("The return type of Accessibility.sendEvent is void (good).");
  212     } else {
  213         DejaGnu.fail("The rerurn type of Accessibility.sendEvent() is somewhat defined (wrong).");
  214     }
  215 
  216 #end
  217 
  218 #if !flash9
  219     // This test crashes the pp in SWF 9 because Accessibility cannot be
  220     // instantiated
  221     
  222     // Accessibility object can't be instantiated !
  223 #if !flash6
  224     var accObj = untyped __new__(Accessibility);
  225     //check_equals(accObj, undefined);
  226     if (untyped __typeof__(accObj == 'undefined')) {
  227         DejaGnu.pass("Correctly did not instantiate an Accesibility object");
  228     } else {
  229         DejaGnu.fail("Unexpected return with call to new on Accessibility");
  230     }
  231 #end
  232 #end
  233 
  234         // Call this after finishing all tests. It prints out the totals.
  235         DejaGnu.done();
  236     }
  237 }
  238 
  239 // local Variables:
  240 // mode: C++
  241 // indent-tabs-mode: t
  242 // End:
  243