gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] Testsuite fail again


From: Benjamin Wolsey
Subject: [Gnash-commit] Testsuite fail again
Date: Mon, 10 Aug 2009 09:52:53 +0200

> +// setCursor is not in the specs for Camera (as2 or 3)
> +//    o.init_member("setCursor", gl->createFunction(camera_setCursor));
> 

setCursor is not in the spec, but *it is tested to exist*. Because you
didn't run the whole testsuite (again) it is broken (again). It's in the
swfdec testsuite.

> +        (fn.this_ptr);
> +    
> +    int numargs = fn.nargs;
> +    if (numargs > 1) {
> +        log_error("%s: Too many arguments", __FUNCTION__);

Using __FUNCTION__ doesn't produce good log messages, and shouldn't
replace the AS function in plain text.

> +    static size_t newcount = 0;
> +    static boost::intrusive_ptr<microphone_as_object> permaMicPtr;
> +    boost::intrusive_ptr<microphone_as_object> ptr;
> +    if (newcount == 0) {
> +        log_debug("creating a new microphone_as object");
> +        ptr = new microphone_as_object;
> +        newcount++;
> +        permaMicPtr = ptr;
> +        return as_value(ptr);
> +    } else {
> +        return as_value(permaMicPtr);
>      }
> -    return as_value(obj.get()); //will keep alive

This doesn't do what it's supposed to. It's supposed to return the same
object for each index, not the same object always. You must not do this
using static variables, because they will be shared across VMs. I'm
trying to get rid of all static variables in order to make the VM
reentrant.

Now a test passes, but it would be better if it continued to fail until
this is implemented properly.

>  microphone_getMicrophone(const fn_call& fn)
>  {
> +    boost::intrusive_ptr<microphone_as_object> ptr;
> +    try {
> +        ptr = ensureType<microphone_as_object> (fn.this_ptr);
> +    } catch (ActionTypeError& e) {
> +        ptr = new microphone_as_object;
> +    }
> 

The ensureType mechanism is designed to work by being caught remotely.
Don't catch it here. This code is for AS3 Microphone.getMicrophone,
which is a static method and does not expect a "this" pointer, so
shouldn't use ensureType anyway.

> +    boost::intrusive_ptr<microphone_as_object> ptr;
> +    try {
> +        ptr = ensureType<microphone_as_object> (fn.this_ptr);
> +    } catch (ActionTypeError& e) {
> +        log_error("%s: you must first initialize the microphone before 
> setting vals",
> +            __FUNCTION__);
> +        return as_value();
> +    }

This is wrong because ensureType causes creates an undefined return, and
the error message is inaccurate. Please just drop all the try/catch
statements again.


> +    std::string get_index() {
> +        char buffer[2];
> +        sprintf(buffer, "%i", _index);
> +        return buffer;};

sprintf is banned. If _index can be made to be more than 99 or less than
-9 this will cause a buffer overrun. Use stringstreams for conversion,
as coding guidelines specify. It is also good reason not to implement
the AS interface in libmedia. It is cleaner to return an int and convert
it for AS when it's needed.

>  Flashplayer ignores
> + the call to new Camera.
> + test the Camera constuctor

It doesn't ignore it. It returns an object with camera properties, as
the test shows.
> 
> +check_equals ( typeof(cam.index), 'string'); //differs from spec, testing 
> real bhvior

Good!

Many camera tests fail in the Adobe player if no camera is present.
Those tests should not be run if Camera.get() returns null, or the
correct result should be tested. They pass when the camera is plugged in
though, so good work there.
 
> +/*
> +There is no such thing as 'new Microphone'. If you ever want to get a new
> +Microphone object, the proper call is f = Microphone.get()
> +*/
> +//f = new Microphone;
>  
>  // Called with new, Microphone returns an object with static
>  // properties.
> -check_equals(typeof(f), 'object');
> -check_equals(typeof(f.setGain), 'function')
> -check_equals(typeof(f.gain), 'undefined')
> -check_equals(typeof(f.rate), 'undefined')
> +//check_equals(typeof(f), 'object');
> +//check_equals(typeof(f.setGain), 'function')
> +//check_equals(typeof(f.gain), 'undefined')
> +//check_equals(typeof(f.rate), 'undefined')

Yes there is such thing, and it produces an object with Microphone
properties, even if it doesn't seem to be very useful. Don't disable
tests. Fortunately it doesn't fail when restored.

bwy

--
Yes, YouTube does work in Gnash
http://www.gnu.org/software/gnash/

Benjamin Wolsey, Software Developer - http://benjaminwolsey.de

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]