[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11410: fixed test cases to conform
From: |
Ben Limmer |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11410: fixed test cases to conform with Adobe player and changed some implementations to Camera and Microphone classes |
Date: |
Wed, 12 Aug 2009 09:25:48 -0600 |
User-agent: |
Bazaar (1.16.1) |
------------------------------------------------------------
revno: 11410
committer: Ben Limmer <address@hidden>
branch nick: trunk
timestamp: Wed 2009-08-12 09:25:48 -0600
message:
fixed test cases to conform with Adobe player and changed some
implementations to Camera and Microphone classes
modified:
libcore/asobj/flash/media/Camera_as.cpp
libcore/asobj/flash/media/Camera_as.h
libcore/asobj/flash/media/Microphone_as.cpp
libmedia/VideoInput.h
testsuite/misc-haxe.all/classes.all/media/Camera_as.hx
testsuite/misc-haxe.all/classes.all/media/Microphone_as.hx
=== modified file 'libcore/asobj/flash/media/Camera_as.cpp'
--- a/libcore/asobj/flash/media/Camera_as.cpp 2009-08-10 09:19:01 +0000
+++ b/libcore/asobj/flash/media/Camera_as.cpp 2009-08-12 15:25:48 +0000
@@ -30,6 +30,7 @@
#include "builtin_function.h" // need builtin_function
#include "Object.h" // for getObjectInterface
#include "Array_as.h"
+#include <sstream>
#ifdef USE_GST
#include "gst/VideoInputGst.h"
@@ -153,8 +154,7 @@
}
#ifdef USE_GST
-class camera_as_object: public as_object, public media::gst::VideoInputGst
-{
+class camera_as_object: public as_object, public media::gst::VideoInputGst {
public:
@@ -162,21 +162,17 @@
:
as_object(getCameraInterface())
{}
-
};
#endif
#ifdef USE_FFMPEG
-class camera_as_object: public as_object, public media::VideoInput
-{
-
+class camera_as_object: public as_object, public media::VideoInput {
public:
camera_as_object()
:
as_object(getCameraInterface())
{}
-
};
#endif
@@ -508,7 +504,18 @@
if ( fn.nargs == 0 ) // getter
{
- return as_value(ptr->get_index());
+ //livedocs say that this function should return an integer, but in
testing
+ //the pp appears to, in practice, return the value as a string
+ int value = ptr->get_index();
+ char val = value + '0';
+
+ std::stringstream ss;
+ std::string str;
+ ss << val;
+ ss >> str;
+ as_value name(str);
+ name.convert_to_string();
+ return (name);
}
else // setter
{
=== modified file 'libcore/asobj/flash/media/Camera_as.h'
--- a/libcore/asobj/flash/media/Camera_as.h 2009-07-28 11:58:27 +0000
+++ b/libcore/asobj/flash/media/Camera_as.h 2009-08-12 15:25:48 +0000
@@ -22,6 +22,10 @@
#include <memory> // for auto_ptr
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
namespace gnash {
class as_object;
@@ -30,6 +34,14 @@
/// Initialize the global Camera class
void camera_class_init(as_object& where, const ObjectURI& uri);
+#ifdef USE_GST
+class camera_as_object;
+#endif
+
+#ifdef USE_FFMPEG
+class camera_as_object;
+#endif
+
/// Return a Camera instance (in case the core lib needs it)
//std::auto_ptr<as_object> init_camera_instance();
=== modified file 'libcore/asobj/flash/media/Microphone_as.cpp'
--- a/libcore/asobj/flash/media/Microphone_as.cpp 2009-08-07 19:56:42
+0000
+++ b/libcore/asobj/flash/media/Microphone_as.cpp 2009-08-12 15:25:48
+0000
@@ -255,12 +255,19 @@
ptr->set_gain(argument);
#endif
} else {
- //set to default gain if bad value was passed
+ //set to highest or lowest gain if bad value was passed
#ifdef USE_GST
+ if (argument < 0) {
+ ptr->set_gain(-60);
+ } else if (argument > 100) {
+ ptr->set_gain(60);
+ }
+#endif
+#ifdef USE_FFMPEG
+ if (argument < 0) {
ptr->set_gain(0);
-#endif
-#ifdef USE_FFMPEG
- ptr->set_gain(50);
+ } else if (arument > 100) {
+ ptr->set_gain(100);
#endif
}
}
@@ -628,12 +635,18 @@
ptr->set_silenceLevel(argument);
} else {
log_error("%s: argument 1 out of acceptable range",
__FUNCTION__);
+ if (argument < 0) {
+ ptr->set_silenceLevel(0);
+ } else if (argument > 100) {
+ ptr->set_silenceLevel(100);
+ }
}
double argument2 = fn.arg(1).to_number();
- if (argument2 > 0) {
+ if (argument2 >= 0) {
ptr->set_silenceTimeout(argument2);
} else {
log_error("%s: argument 2 out of acceptable range",
__FUNCTION__);
+ ptr->set_silenceTimeout(0);
}
} else {
double argument = fn.arg(0).to_number();
@@ -642,6 +655,11 @@
ptr->set_silenceLevel(argument);
} else {
log_error("%s: argument 1 out of acceptable range",
__FUNCTION__);
+ if (argument < 0) {
+ ptr->set_silenceLevel(0);
+ } else if (argument > 100) {
+ ptr->set_silenceLevel(100);
+ }
}
}
}
=== modified file 'libmedia/VideoInput.h'
--- a/libmedia/VideoInput.h 2009-08-08 12:43:49 +0000
+++ b/libmedia/VideoInput.h 2009-08-12 15:25:48 +0000
@@ -24,13 +24,15 @@
#include <vector>
#include <ostream>
#include <cstdio>
+#include <map>
+
+#include "asobj/flash/media/Camera_as.h"
namespace gnash {
namespace media {
-
class VideoInput {
-
+
public:
VideoInput();
@@ -55,13 +57,7 @@
int get_height() {return _height;};
void set_index(int i) {_index = i;};
- // livedocs say that this should return a number, but when testing with
- // flashplayer it appears to actually return a string.
- std::string get_index() {
- char buffer[2];
- sprintf(buffer, "%i", _index);
- return buffer;
- };
+ int get_index() {return _index;};
void set_keyFrameInterval(int i) {_keyFrameInterval = i;};
int get_keyFrameInterval() {return _keyFrameInterval;};
@@ -107,6 +103,8 @@
int _quality;
int _width;
+ //TODO: use this map to implement the Camera::get function
+ //static std::map<int, camera_as_object*> _mapGet;
};
=== modified file 'testsuite/misc-haxe.all/classes.all/media/Camera_as.hx'
--- a/testsuite/misc-haxe.all/classes.all/media/Camera_as.hx 2009-07-31
21:06:37 +0000
+++ b/testsuite/misc-haxe.all/classes.all/media/Camera_as.hx 2009-08-12
15:25:48 +0000
@@ -62,7 +62,7 @@
// is primarily useful only to test completeness of the API implementation.
#if flash9
- if (Type.typeof(x1.activityLevel) == ValueType.TFloat) {
+ if (typeof(x1.activityLevel) == "number") {
DejaGnu.pass("Camera::activityLevel property exists");
} else {
DejaGnu.fail("Camera::activityLevel property doesn't exist");
@@ -72,12 +72,12 @@
} else {
DejaGnu.fail("Camera::bandwidth property doesn't exist");
}
- if (Type.typeof(x1.currentFPS) == ValueType.TFloat) {
+ if (typeof(x1.currentFPS) == "number") {
DejaGnu.pass("Camera::currentFPS property exists");
} else {
DejaGnu.fail("Camera::currentFPS property doesn't exist");
}
- if (Type.typeof(x1.fps) == ValueType.TFloat) {
+ if (typeof(x1.fps) == "number") {
DejaGnu.pass("Camera::fps property exists");
} else {
DejaGnu.fail("Camera::fps property doesn't exist");
@@ -97,7 +97,7 @@
} else {
DejaGnu.fail("Camera::keyFrameInterval property doesn't exist");
}
- if (x1.loopback == (false||true)) {
+ if (typeof(x1.loopback) == "boolean") {
DejaGnu.pass("Camera::loopback property exists");
} else {
DejaGnu.fail("Camera::loopback property doesn't exist");
@@ -112,14 +112,14 @@
} else {
DejaGnu.fail("Camera::motionTimeout property doesn't exist");
}
- if (x1.muted == (false || true)) {
+ 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 (Type.typeof(x1.name) == ValueType.TObject) {
+ if (typeof(x1.name) == "string") {
DejaGnu.pass("Camera::name property exists");
} else {
DejaGnu.fail("Camera::name property doesn't exist");
@@ -161,10 +161,10 @@
} else {
DejaGnu.fail("Camera::height property doesn't exist");
}
- if (typeof(x1.index) == "number") {
+ if (typeof(x1.index) == "string") {
DejaGnu.pass("Camera::index property exists");
} else {
- DejaGnu.fail("Camera::index property doesn't exist");
+ DejaGnu.fail("Camera::index property doesn't exist ");
}
if (typeof(x1.motionLevel) == "number") {
DejaGnu.pass("Camera::motionLevel property exists");
=== modified file 'testsuite/misc-haxe.all/classes.all/media/Microphone_as.hx'
--- a/testsuite/misc-haxe.all/classes.all/media/Microphone_as.hx
2009-08-05 20:24:59 +0000
+++ b/testsuite/misc-haxe.all/classes.all/media/Microphone_as.hx
2009-08-12 15:25:48 +0000
@@ -130,18 +130,23 @@
} else {
DejaGnu.xfail("Microphone::silenceTimeout property doesn't exist");
}
+ if (typeof(x1.useEchoSuppression) == "boolean") {
+ DejaGnu.pass("Microphone::useEchoSuppression property exists");
+ } else {
+ DejaGnu.fail("Microphone::useEchoSuppression property doesn't
exist");
+ }
#else
- if (typeof(x1.silenceTimeOut) == "number") {
+ if (typeof(untyped x1.silenceTimeout) == "number") {
DejaGnu.pass("Microphone::silenceTimeOut property exists");
} else {
DejaGnu.fail("Microphone::silenceTimeOut property doesn't exist");
}
-#end
- if (typeof(x1.useEchoSuppression) == "boolean") {
+ if (typeof(x1.useEchoSuppression) == "number") {
DejaGnu.pass("Microphone::useEchoSuppression property exists");
} else {
DejaGnu.fail("Microphone::useEchoSuppression property doesn't
exist");
}
+#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
@@ -205,16 +210,16 @@
//now try bad values
x1.setRate(10000000);
- if (x1.rate == 11) {
+ if (x1.rate == 44) {
DejaGnu.pass("setRate(10000000) returned the proper default");
} else {
- DejaGnu.fail("setRate(10000000) didn't return the proper default
(11)");
+ DejaGnu.fail("setRate(10000000) didn't return the proper default
(44)");
}
x1.setRate(-1);
- if (x1.rate == 11) {
+ if (x1.rate == 5) {
DejaGnu.pass("setRate(-1) returned the proper default");
} else {
- DejaGnu.fail("setRate(-1) didn't return the proper default (11)");
+ DejaGnu.fail("setRate(-1) didn't return the proper default (5)");
}
//test setgain
@@ -241,13 +246,13 @@
//try bad values
x1.setGain(300);
- if (x1.gain == 50) {
+ if (x1.gain == 100) {
DejaGnu.pass("setGain(300) returned the default value");
} else {
DejaGnu.fail("setGain(300) didn't return the default value");
}
x1.setGain(-20);
- if (x1.gain == 50) {
+ if (x1.gain == 0) {
DejaGnu.pass("setGain(-20) returned the default value");
} else {
DejaGnu.fail("setGain(-20) didn't return the default value");
@@ -267,13 +272,13 @@
#if !flash9
//try some values now
x1.setSilenceLevel(0, 2000);
- if ((x1.silenceLevel == 0) && (x1.silenceTimeOut == 2000)) {
+ if ((x1.silenceLevel == 0) && (untyped x1.silenceTimeout == 2000)) {
DejaGnu.pass("setSilenceLevel(0,2000) worked");
} else {
DejaGnu.fail("setSilenceLevel(0,2000) failed");
}
x1.setSilenceLevel(100, 5500);
- if ((x1.silenceLevel == 100) && (x1.silenceTimeOut == 5500)) {
+ if ((x1.silenceLevel == 100) && (untyped x1.silenceTimeout == 5500)) {
DejaGnu.pass("setSilenceLevel(100,5500) worked");
} else {
DejaGnu.fail("setSilenceLevel(100,5500) failed");
@@ -281,14 +286,14 @@
//try bad values now
x1.setSilenceLevel(200, -1000);
- if ((x1.silenceLevel == 100) && (x1.silenceTimeOut == 5500)) {
+ if ((x1.silenceLevel == 100) && (untyped x1.silenceTimeout == 0)) {
DejaGnu.pass("setSilenceLevel(200,-1000) worked as intended");
} else {
DejaGnu.fail("setSilenceLevel(200,-1000) didn't work as intended");
}
x1.setSilenceLevel(-10000, 8000);
- if ((x1.silenceLevel == 100) && (x1.silenceTimeOut == 8000)) {
+ if ((x1.silenceLevel == 0) && (untyped x1.silenceTimeout == 8000)) {
DejaGnu.pass("setSilenceLevel(-10000, 8000) worked as intended");
} else {
DejaGnu.fail("setSilenceLevel(-10000, 8000) didn't work as intended");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11410: fixed test cases to conform with Adobe player and changed some implementations to Camera and Microphone classes,
Ben Limmer <=