CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 08/01/11 13:18:21
Modified files: . : ChangeLog server : LoadVariablesThread.cpp testsuite/actionscript.all: MovieClip.as Log message: Newlines in loadVariables data files have no special meaning. Add tests for the MovieClip method and the GetUrl (load vars) calls. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5378&r2=1.5379 http://cvs.savannah.gnu.org/viewcvs/gnash/server/LoadVariablesThread.cpp?cvsroot=gnash&r1=1.3&r2=1.4 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/MovieClip.as?cvsroot=gnash&r1=1.113&r2=1.114 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.5378 retrieving revision 1.5379 diff -u -b -r1.5378 -r1.5379 --- ChangeLog 11 Jan 2008 11:42:43 -0000 1.5378 +++ ChangeLog 11 Jan 2008 13:18:20 -0000 1.5379 @@ -1,5 +1,12 @@ 2008-01-11 Sandro Santilli <[EMAIL PROTECTED]> + * server/LoadVariablesThread.cpp: don't handle newlines + in any special way... + * testsuite/actionscript.all/MovieClip.as: test loadVariables + method and tag (GETURL). + +2008-01-11 Sandro Santilli <[EMAIL PROTECTED]> + * server/sprite_instance.cpp: fix the MovieClip.meth() method to invoke toLowerString on first argument. * testsuite/actionscript.all/MovieClip.as: test that meth() Index: server/LoadVariablesThread.cpp =================================================================== RCS file: /sources/gnash/gnash/server/LoadVariablesThread.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- server/LoadVariablesThread.cpp 10 Oct 2007 17:49:45 -0000 1.3 +++ server/LoadVariablesThread.cpp 11 Jan 2008 13:18:21 -0000 1.4 @@ -41,6 +41,7 @@ // this is going to override any previous setting, // better do this inside a subclass (in a separate thread) _bytesLoaded = 0; + _bytesTotal = _stream->get_size(); string toparse; @@ -51,18 +52,6 @@ { //log_msg("Read %u bytes", read); - bool newlineFound = false; - - // found newline, discard anything before that - for (size_t t=0; t<read; ++t) - { - if ( buf[t] == '\n' ) - { - newlineFound = true; - buf[t] = '\0'; - } - } - // TODO: use read_string ? string chunk(buf, read); toparse += chunk; @@ -84,13 +73,6 @@ _bytesLoaded += read; //dispatchDataEvent(); - // found newline, discard anything before that - if ( newlineFound ) - { - if ( parsedLines ) break; - else toparse.clear(); - } - // eof, get out ! if ( _stream->get_eof() ) break; } @@ -102,7 +84,11 @@ _stream->go_to_end(); _bytesLoaded = _stream->get_position(); - _bytesTotal = _bytesLoaded; + if ( _bytesTotal != _bytesLoaded ) + { + log_error("Size of stream variables were loaded from advertised to be %d bytes long, while turned out to be only %d bytes long", + _bytesTotal, _bytesLoaded); + } //dispatchLoadEvent(); delete[] buf; Index: testsuite/actionscript.all/MovieClip.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/actionscript.all/MovieClip.as,v retrieving revision 1.113 retrieving revision 1.114 diff -u -b -r1.113 -r1.114 --- testsuite/actionscript.all/MovieClip.as 11 Jan 2008 11:42:44 -0000 1.113 +++ testsuite/actionscript.all/MovieClip.as 11 Jan 2008 13:18:21 -0000 1.114 @@ -20,10 +20,32 @@ // compile this test case with Ming makeswf, and then // execute it like this gnash -1 -r 0 -v out.swf -rcsid="$Id: MovieClip.as,v 1.113 2008/01/11 11:42:44 strk Exp $"; +rcsid="$Id: MovieClip.as,v 1.114 2008/01/11 13:18:21 strk Exp $"; #include "check.as" +// To be called at end of test +endOfTest = function() +{ +#if OUTPUT_VERSION <= 5 + check_totals(197); // SWF5 +#endif + +#if OUTPUT_VERSION == 6 + check_totals(594); // SWF6 +#endif + +#if OUTPUT_VERSION == 7 + check_totals(611); // SWF7 +#endif + +#if OUTPUT_VERSION >= 8 + check_totals(612); // SWF8+ +#endif + + play(); +}; + #if OUTPUT_VERSION < 6 note("WARNING: it has been reported that adobe flash player version 9 fails a few tests here."); note(" We belive those are actually adobe player bugs since older versions "); @@ -1347,17 +1369,49 @@ check_equals(typeof(ret), 'number'); check_equals(ret, 1); +//--------------------------------------------------------------------- +// Test the MovieClip.loadVariables function +//--------------------------------------------------------------------- -#if OUTPUT_VERSION < 6 - check_totals(189); // SWF5 -#else -#if OUTPUT_VERSION < 7 - check_totals(585); // SWF6 -#else -#if OUTPUT_VERSION < 8 - check_totals(602); // SWF7 -#else - check_totals(603); // SWF8+ -#endif -#endif +dataLoaded = 0; + +onData = function() +{ + note("onData called, dataLoaded: "+dataLoaded); + check_equals(arguments.length, 0); + check_equals(_root.var1, 'val1'); + check_equals(_root.var3, 'val3\n'); + _root.var1 = 'val1custom'; + _root.var2 = 'val2custom'; + + if ( dataLoaded++ ) + { + //note("Clearing data load interval "+dataLoadInterval); + clearInterval(dataLoadInterval); + endOfTest(); + } + else + { + // This should use GetURL + loadVariables(MEDIA(vars.txt), "_root"); + } +}; + +stop(); + +ret = _root.loadVariables(MEDIA(vars.txt), "GET"); +check_equals(dataLoaded, 0); +check_equals(typeof(ret), 'undefined'); + +#if OUTPUT_VERSION <= 5 + // It seems for SWF5 onData isn't invoked, + // neighter does onEnterFrame work.. + dataLoadInterval = setInterval(onData, 1000); #endif + + +//_root.loadVariables(MEDIA(vars.txt), "GET"); + +// Can't rely on this to call onData! + +//endOfTest(); _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit