[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re[2]: [Gnash-dev] Testcase for gnash-embedded
From: |
Udo Giacomozzi |
Subject: |
Re[2]: [Gnash-dev] Testcase for gnash-embedded |
Date: |
Tue, 7 Nov 2006 11:05:13 +0100 |
Hi strk,
here's a new testcase. Code has been added to both buttons:
if (size == Math.round(size))
trace("PASSED: 'size' variable is rounded ("+size+")");
else
trace("FAILED: 'size' variable is not rounded ("+size+")");
Current CVS-HEAD passes.
However, I also added a new test (at startup) because I often get
strings that look like debugging info: "<as_object 0x811c898>"
The test was coded as follows:
var anumber=80;
var an_str = new String(anumber);
trace("anumber:"+typeof anumber+", an_str:"+an_str);
if (an_str==anumber)
trace("PASSED: number->string conversion succeeded");
else
trace("FAILED: number->string conversion failed
('"+an_str+"')");
Udo
Monday, November 6, 2006, 10:41:10 AM, you wrote:
s> mmm.. the testcsae is surely good to add to our testsuite,
s> anyway, for the specific case we were talking about what
s> I needed was to understand why a "rounded" number was *printed*
s> in the textfield.
s> If you round yourself that'd make no test for it.
s> The initial question was: how do you print the number into
s> the textfield ?
s> Do you assign _xscale to *it* (as a character reference) ?
s> --strk;
s> On Mon, Nov 06, 2006 at 09:00:42AM +0100, Udo Giacomozzi wrote:
>> 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
>> _______________________________________________
>> Gnash-dev mailing list
>> address@hidden
>> http://lists.gnu.org/mailman/listinfo/gnash-dev
Udo
gravity-embedded2.swf
Description: application/shockwave-flash