gnash-dev
[Top][All Lists]
Advanced

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

[Gnash-dev] Testcase for gnash-embedded


From: Udo Giacomozzi
Subject: [Gnash-dev] Testcase for gnash-embedded
Date: Mon, 6 Nov 2006 09:00:42 +0100

I open a new thread on this to keep discussion in one place.

I've attached the testcase you requested, strk. I hope it's what you
expected.

ActionScript code for reference:

--- frame 1 ---

var container:MovieClip = createEmptyMovieClip("container", 
getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
mcLoader.loadClip("gravity.swf", container);

function onLoadInit(mc:MovieClip) {
    trace("onLoadInit: " + mc);
        
        // just a quick test to see if Math.abs() works
        if (Math.abs(-9) == 9) {
                trace("PASSED: Math.abs() works");
        
                if (Math.abs(mc._xscale-100) < 1)
                        trace("PASSED: _xscale starts with 100");
                else
                        trace("FAILED: _xscale does not start with 100 
("+mc._xscale+")");
                
                if (Math.abs(mc._yscale-100) < 1)
                        trace("PASSED: _yscale starts with 100");
                else
                        trace("FAILED: _yscale does not start with 100 
("+mc._yscale+")");      
                        
                var start_w = mc._width;
                var start_h = mc._height;
                
                size=50*1;  // *not* VAR!
                mc._xscale = size;
                mc._yscale = size;
                
                if (Math.abs(mc._xscale-50) < 1)
                        trace("PASSED: _xscale successfully changed to 50");
                else
                        trace("FAILED: _xscale did not change to 50 
("+mc._xscale+")");
                
                if (Math.abs(mc._yscale-50) < 1)
                        trace("PASSED: _yscale successfully changed to 50");
                else
                        trace("FAILED: _yscale successfully changed to 50 
("+mc._yscale+")");   
                        
                if (Math.abs(mc._width - start_w/2) < 1) 
                        trace("PASSED: _width changed correctly");
                else
                        trace("FAILED: _width incorrect after scaling 
("+mc._width+")");
                        
                if (Math.abs(mc._height - start_h/2) < 1) 
                        trace("PASSED: _height changed correctly");
                else
                        trace("FAILED: _height incorrect after scaling 
("+mc._height+")");
                        
        } else {
                trace("FAILED: Math.abs() not available or buggy");
        }
        
}


--- button "smaller" ---

on (release) {
        size = (size*1)-2;
        container._xscale = size;
        container._yscale = size;
        
        if (Math.abs(container._xscale - size) < 1)
                trace("PASSED: _xscale changed successfully");
        else
                trace("FAILED: _xscale incorrect after change");
        
        if (Math.abs(container._yscale - size) < 1)
                trace("PASSED: _yscale changed successfully");
        else
                trace("FAILED: _yscale incorrect after change");
}



--- button "larger" ---

on (release) {
        size = (size*1)+2;
        container._xscale = size;
        container._yscale = size;
                
        if (Math.abs(container._xscale - size) < 1)
                trace("PASSED: _xscale changed successfully");
        else
                trace("FAILED: _xscale incorrect after change");
        
        if (Math.abs(container._yscale - size) < 1)
                trace("PASSED: _yscale changed successfully");
        else
                trace("FAILED: _yscale incorrect after change");
        
}




Udo

Attachment: gravity-embedded2.swf
Description: application/shockwave-flash


reply via email to

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