// Camera_as.hx:  ActionScript 3 "Camera" class, for Gnash.
//
// Generated by gen-as3.sh on: 20090503 by "rob". Remove this
// after any hand editing loosing changes.
//
//   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//

// This test case must be processed by CPP before compiling to include the
//  DejaGnu.hx header file for the testing framework support.

#if flash9
import flash.media.Camera;
import flash.display.MovieClip;
import flash.media.Video;
#else
import flash.Camera;
import flash.MovieClip;
#end
import flash.Lib;
import Type;

import DejaGnu;

// Class must be named with the PP prefix, as that's the name the
// file passed to haxe will have after the preprocessing step
class Camera_as {
    static function typeof(thing:Dynamic) {
        return ("" + untyped __typeof__(thing));
    }
    
    static function main() {
        #if flash9
		var x1:Camera = Camera.getCamera();
        #end
		#if !flash9
		var x1:Camera = Camera.get();
		#end
		
        // Make sure we actually get a valid class        
        if (x1 != null) {
            DejaGnu.pass("Camera class exists");
        } else {
            DejaGnu.xfail("Camera class doesn't exist");
        }
// Tests to see if all the properties exist. All these do is test for
// existance of a property, and don't test the functionality at all. This
// is primarily useful only to test completeness of the API implementation.

	#if flash9
	if (typeof(x1.activityLevel) == "number") {
	    DejaGnu.pass("Camera::activityLevel property exists");
	} else {
	    DejaGnu.fail("Camera::activityLevel property doesn't exist");
	}
	if (Type.typeof(x1.bandwidth) == ValueType.TInt) {
	    DejaGnu.pass("Camera::bandwidth property exists");
	} else {
	    DejaGnu.fail("Camera::bandwidth property doesn't exist");
	}
	if (typeof(x1.currentFPS) == "number") {
	    DejaGnu.pass("Camera::currentFPS property exists");
	} else {
	    DejaGnu.fail("Camera::currentFPS property doesn't exist");
	}
	if (typeof(x1.fps) == "number") {
	    DejaGnu.pass("Camera::fps property exists");
	} else {
	    DejaGnu.fail("Camera::fps property doesn't exist");
	}
	if (Type.typeof(x1.height) == ValueType.TInt) {
	    DejaGnu.pass("Camera::height property exists");
	} else {
	    DejaGnu.fail("Camera::height property doesn't exist");
	}
	if (Type.typeof(x1.index) == ValueType.TInt) {
	    DejaGnu.pass("Camera::index property exists");
	} else {
	    DejaGnu.fail("Camera::index property doesn't exist");
	}
	if (Type.typeof(x1.keyFrameInterval) == ValueType.TInt) {
	    DejaGnu.pass("Camera::keyFrameInterval property exists");
	} else {
	    DejaGnu.fail("Camera::keyFrameInterval property doesn't exist");
	}
	if (typeof(x1.loopback) == "boolean") {
	    DejaGnu.pass("Camera::loopback property exists");
	} else {
	    DejaGnu.fail("Camera::loopback property doesn't exist");
	}
	if (Type.typeof(x1.motionLevel) == ValueType.TInt) {
	    DejaGnu.pass("Camera::motionLevel property exists");
	} else {
	    DejaGnu.fail("Camera::motionLevel property doesn't exist");
	}
	if (Type.typeof(x1.motionTimeout) == ValueType.TInt) {
	    DejaGnu.pass("Camera::motionTimeout property exists");
	} else {
	    DejaGnu.fail("Camera::motionTimeout property doesn't exist");
	}
	if (typeof(x1.muted) == "boolean") {
	    DejaGnu.pass("Camera::muted property exists");
	} else {
	    DejaGnu.fail("Camera::muted property doesn't exist");
	}
	//FIXME: it would be nice if this checked to make sure the name is 
	//a string
	if (typeof(x1.name) == "string") {
	    DejaGnu.pass("Camera::name property exists");
	} else {
	    DejaGnu.fail("Camera::name property doesn't exist");
	}
	if (Type.typeof(x1.quality) == ValueType.TInt) {
	    DejaGnu.pass("Camera::quality property exists");
	} else {
	    DejaGnu.fail("Camera::quality property doesn't exist");
	}
	if (Type.typeof(x1.width) == ValueType.TInt) {
	    DejaGnu.pass("Camera::width property exists");
	} else {
	    DejaGnu.fail("Camera::width property doesn't exist");
	}
	#end
	#if !flash9
	if (typeof(x1.activityLevel) == "number") {
	    DejaGnu.pass("Camera::activityLevel property exists");
	} else {
	    DejaGnu.fail("Camera::activityLevel property doesn't exist");
	}
	if (typeof(x1.bandwidth) == "number") {
	    DejaGnu.pass("Camera::bandwidth property exists");
	} else {
	    DejaGnu.fail("Camera::bandwidth property doesn't exist");
	}
	if (typeof(x1.currentFps) == "number") {
	    DejaGnu.pass("Camera::currentFPS property exists");
	} else {
	    DejaGnu.fail("Camera::currentFPS property doesn't exist");
	}
	if (typeof(x1.fps) == "number") {
	    DejaGnu.pass("Camera::fps property exists");
	} else {
	    DejaGnu.fail("Camera::fps property doesn't exist");
	}
	if (typeof(x1.height) == "number") {
	    DejaGnu.pass("Camera::height property exists");
	} else {
	    DejaGnu.fail("Camera::height property doesn't exist");
	}
	if (typeof(x1.index) == "string") {
	    DejaGnu.pass("Camera::index property exists");
	} else {
	    DejaGnu.fail("Camera::index property doesn't exist ");
	}
	if (typeof(x1.motionLevel) == "number") {
	    DejaGnu.pass("Camera::motionLevel property exists");
	} else {
	    DejaGnu.fail("Camera::motionLevel property doesn't exist");
	}
	if (typeof(x1.muted) == "boolean") {
	    DejaGnu.pass("Camera::muted property exists");
	} else {
	    DejaGnu.fail("Camera::muted property doesn't exist");
	}
    if (typeof(x1.name) == "string") {
        DejaGnu.pass("Camera::name property exists");
    } else {
        DejaGnu.fail("Camera::name property doesn't exist");
    }
    
	if (typeof(x1.quality) == "number") {
	    DejaGnu.pass("Camera::quality property exists");
	} else {
	    DejaGnu.fail("Camera::quality property doesn't exist");
	}
	if (typeof(x1.width) == "number") {
	    DejaGnu.pass("Camera::width property exists");
	} else {
	    DejaGnu.fail("Camera::width property doesn't exist");
	}
    
    x1.setMode(800, 600, 30);
	#end
// Tests to see if all the methods exist. All these do is test for
// existance of a method, and don't test the functionality at all. This
// is primarily useful only to test completeness of the API implementation.
	#if flash9
	if (Type.typeof(x1.setKeyFrameInterval) == ValueType.TFunction) {
	    DejaGnu.pass("Camera::setKeyFrameInterval() method exists");
	} else {
	    DejaGnu.fail("Camera::setKeyFrameInterval() method doesn't exist");
	}
	if (Type.typeof(x1.setLoopback) == ValueType.TFunction) {
	    DejaGnu.pass("Camera::setLoopback() method exists");
	} else {
	    DejaGnu.fail("Camera::setLoopback() method doesn't exist");
	}
	if (Type.typeof(x1.setMode) == ValueType.TFunction) {
	    DejaGnu.pass("Camera::setMode() method exists");
	} else {
	    DejaGnu.fail("Camera::setMode() method doesn't exist");
	}
	if (Type.typeof(x1.setMotionLevel) == ValueType.TFunction) {
	    DejaGnu.pass("Camera::setMotionLevel() method exists");
	} else {
	    DejaGnu.fail("Camera::setMotionLevel() method doesn't exist");
	}
	if (Type.typeof(x1.setQuality) == ValueType.TFunction) {
	    DejaGnu.pass("Camera::setQuality() method exists");
	} else {
	    DejaGnu.fail("Camera::setQuality() method doesn't exist");
	}
	//FIXME: we should add tests to check that Events in this class are
	//being properly handled.
    
	#end
        // Call this after finishing all tests. It prints out the totals.
        DejaGnu.done();
    }
}
