gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog testsuite/misc-swfc.all/Dejagnu...


From: Zou Lunkai
Subject: [Gnash-commit] gnash ChangeLog testsuite/misc-swfc.all/Dejagnu...
Date: Thu, 09 Aug 2007 06:38:16 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  07/08/09 06:38:16

Modified files:
        .              : ChangeLog 
Added files:
        testsuite/misc-swfc.all: Dejagnu.sc Makefile.am check.sc 
                                 hello.sc sound.sc sound.wav 

Log message:
        apply patch#6147 from davr, a test framework by using swfc.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3971&r2=1.3972
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-swfc.all/Dejagnu.sc?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-swfc.all/Makefile.am?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-swfc.all/check.sc?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-swfc.all/hello.sc?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-swfc.all/sound.sc?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-swfc.all/sound.wav?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3971
retrieving revision 1.3972
diff -u -b -r1.3971 -r1.3972
--- ChangeLog   9 Aug 2007 04:18:37 -0000       1.3971
+++ ChangeLog   9 Aug 2007 06:38:15 -0000       1.3972
@@ -1,3 +1,9 @@
+2007-08-09 David Rorex  <address@hidden>
+
+       * testsuite/misc-swfc.all: new directory for testcases.
+       * testsuite/misc-swfc.all/check.sc, Dejagnu.sc, sound.sc, hello.sc,
+         sound.wav, Makefile.am: new test framework by using swfc.
+
 2007-08-09 Sandro Santilli <address@hidden>
 
        * server/stream.h (ensureBytes): be more verbose about the lack of

Index: testsuite/misc-swfc.all/Dejagnu.sc
===================================================================
RCS file: testsuite/misc-swfc.all/Dejagnu.sc
diff -N testsuite/misc-swfc.all/Dejagnu.sc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-swfc.all/Dejagnu.sc  9 Aug 2007 06:38:15 -0000       1.1
@@ -0,0 +1,130 @@
+        // Dejagnu.sc - SWFC script for dejagnu-like testing.
+        //
+        //   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+        //
+        // This program is free software; you can redistribute it and/or modify
+        // it under the terms of the GNU General Public License as published by
+        // the Free Software Foundation; either version 3 of the License, or
+        // (at your option) any later version.
+        //
+        // This program is distributed in the hope that it will be useful,
+        // but WITHOUT ANY WARRANTY; without even the implied warranty of
+        // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        // GNU General Public License for more details.
+        //
+        // You should have received a copy of the GNU General Public License
+        // along with this program; if not, write to the Free Software
+        // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        //
+        //
+        // Original author: David Rorex - address@hidden
+        //
+        //
+
+        _root.Dejagnu = __global.Dejagnu = {
+            passed:0,
+            failed:0,
+            xpassed:0,
+            xfailed:0,
+            untest:0,
+            unresolve:0,
+
+            fail : function (why) {
+                this.failed++;
+                var msg = 'FAILED: '+why;
+                this.xtrace(msg);
+            },
+
+            xfail: function (why) {
+                this.xfailed++;
+                var msg = 'XFAILED: '+why;
+                this.xtrace(msg);
+            },
+
+            pass: function (why) {
+                this.passed++;
+                var msg = 'PASSED: '+why;
+                trace (msg);
+            },
+
+            xpass: function (why) {
+                this.xpassed++;
+                var msg = 'XPASSED: '+why;
+                trace (msg);
+            },
+
+            totals: function () {
+                this.xtrace('#passed: '+ this.passed);
+                this.xtrace('#failed: '+ this.failed);
+                if ( this.xpassed ) {
+                    this.xtrace('#unexpected successes: '+ this.xpassed);
+                }
+                if ( this.xfailed ) {
+                    this.xtrace('#expected failures: '+ this.xfailed);
+                }
+           
+            },
+
+            check_equals: function (obt, exp, msg) {
+                if(msg == null) msg = "";
+                if ( obt == exp ) 
+                    this.pass(obt+' == '+exp);
+                else 
+                    this.fail('expected: "'+exp+'" , obtained: "'+obt+'" 
'+msg);
+            },
+
+            xcheck_equals: function (obt, exp, msg) {
+                if(msg == null) msg = "";
+                if ( obt == exp ) 
+                    this.xpass(obt+' == '+exp);
+                else 
+                    this.xfail('expected: '+exp+' , obtained: '+obt+" "+msg);
+            },
+
+            check: function (a, msg) {
+                if ( a ) 
+                    this.pass(msg != undefined ? msg : a);
+                else 
+                    this.fail(msg != undefined ? msg : a);
+            },
+
+            xcheck: function (a, msg) {
+                if ( a ) 
+                    this.xpass(msg != undefined ? msg : a);
+                else 
+                    this.xfail(msg != undefined ? msg : a);
+            },
+
+            note: function (msg) {
+                this.xtrace(msg);
+            },
+
+            xtrace: function (msg) {
+                _level0.textout.text += msg + "\n";
+                trace(msg);
+            },
+
+            untested: function (msg) {
+                trace("UNTESTED: "+msg);
+            },
+
+            unresolved: function (msg) {
+                trace("UNRESOLVED: "+msg);
+            },
+
+            done: function () {
+                this.totals();
+                _root.stop();
+            }
+
+        };
+
+        if(_level0.dejagnu_module_initialized != 1) {
+            // create a textfield to output to
+            _level0.createTextField("textout", 99, 10, 10, 500, 500);
+            _level0.dejagnu_module_initialized = 1;
+        }
+
+// helper functions
+#include "check.sc"
+

Index: testsuite/misc-swfc.all/Makefile.am
===================================================================
RCS file: testsuite/misc-swfc.all/Makefile.am
diff -N testsuite/misc-swfc.all/Makefile.am
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-swfc.all/Makefile.am 9 Aug 2007 06:38:16 -0000       1.1
@@ -0,0 +1,86 @@
+## Process this fill with automake to generate Makefile.in
+# 
+# Copyright (C) 2007 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+AUTOMAKE_OPTIONS = dejagnu
+
+# These will get executed and parsed for test output
+SCTESTS = \
+       hello.sc \
+       sound.sc \
+       $(NULL)
+
+# These will get compiled to SWFs just as above, but will not be executed as a 
test
+# They are for secondary movies to be loaded by the above tests.
+AUXMOVIES = \
+           $(NULL)
+
+
+EXTRA_DIST = $(SCTESTS) $(AUXMOVIES) check.sc Dejagnu.sc
+
+#if ENABLE_SWFC
+
+SWFC = swfc
+SWFC_FLAGS = 
+SWFC_CPP = cpp -P -I$(srcdir)
+
+SCTESTS_OUT = $(SCTESTS:.sc=.swf)
+
+AUXMOVIES_OUT = $(AUXMOVIES:.sc=.swf)
+
+TEST_DRIVERS = ../simple.exp
+TEST_CASES = \
+       alltests-runner
+
+alltests-runner: $(srcdir)/../generic-testrunner.sh $(SCTESTS_OUT) 
$(AUXMOVIES_OUT)
+       sh $< -r 50 $(top_builddir) $(SCTESTS_OUT) > $@
+       chmod 755 $@
+
+.sc.swf:
+       $(SWFC_CPP) $< > $(@:%.swf=pp_%.sc) 
+       $(SWFC) $(SWFC_FLAGS) -o $@ $(@:%.swf=pp_%.sc)
+
+CLEANFILES =  \
+       gnash-dbg.log \
+       site.exp.bak \
+       alltests-runner \
+       testrun.* \
+       *.swf \
+       *.pp \
+       pp_*.sc \
+       *_testrunner \
+       *_Runner
+
+check-DEJAGNU: site-update $(TEST_CASES)
+       @runtest=$(RUNTEST); \
+       if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+           $$runtest $(RUNTESTFLAGS) $(TEST_DRIVERS); \
+       else \
+         echo "WARNING: could not find \`runtest'" 1>&2; \
+          for i in "$(TEST_CASES)"; do \
+           $(SHELL) $$i; \
+         done; \
+       fi
+
+site-update: site.exp
+       @rm -fr site.exp.bak
+       @cp site.exp site.exp.bak
+       @sed -e '/testcases/d' site.exp.bak > site.exp
+       @echo "# This is a list of the pre-compiled testcases" >> site.exp
+       @echo "set testcases \"$(TEST_CASES)\"" >> site.exp
+
+#endif

Index: testsuite/misc-swfc.all/check.sc
===================================================================
RCS file: testsuite/misc-swfc.all/check.sc
diff -N testsuite/misc-swfc.all/check.sc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-swfc.all/check.sc    9 Aug 2007 06:38:16 -0000       1.1
@@ -0,0 +1,48 @@
+// check.as - Include file for SWFC testcases providing common testing 
facilities
+//
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+//
+// Original author: David Rorex - address@hidden
+//
+
+#ifndef _CHECK_AS_
+#define _CHECK_AS_
+
+#define _INFO_ ' ['+__FILE__+':'+__LINE__+']'
+
+#define check_equals(a, b) Dejagnu.check_equals(a, b, _INFO_);
+//#define check_equals(a, b, msg) Dejagnu.check(a, b, msg + _INFO_);
+
+#define xcheck_equals(a, b) Dejagnu.xcheck_equals(a, b, _INFO_);
+//#define xcheck_equals(a, b, msg) Dejagnu.check(a, b, msg + _INFO_);
+
+#define check(a) Dejagnu.check(a, _INFO_);
+#define xcheck(a) Dejagnu.xcheck(a, _INFO_);
+
+#define pass(text) Dejagnu.pass(text + _INFO_)
+#define xpass(text) Dejagnu.xpass(text + _INFO_)
+#define fail(text) Dejagnu.fail(text + _INFO_)
+#define xfail(text) Dejagnu.xfail(text + _INFO_)
+#define pass(text) Dejagnu.pass(text + _INFO_)
+#define untested(text) Dejagnu.untested(text + _INFO_)
+#define unresolved(text) Dejagnu.unresolved(text + _INFO_)
+
+#define note(text) Dejagnu.note(text + _INFO_);
+
+
+#endif

Index: testsuite/misc-swfc.all/hello.sc
===================================================================
RCS file: testsuite/misc-swfc.all/hello.sc
diff -N testsuite/misc-swfc.all/hello.sc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-swfc.all/hello.sc    9 Aug 2007 06:38:16 -0000       1.1
@@ -0,0 +1,18 @@
+.flash bbox=200x200 filename="hello.swf" version=6 fps=30
+
+//load dejagnu library. This must go after the .flash tag
+
+.frame 1
+  .action:
+    #include "Dejagnu.sc"
+
+    trace("Hello World!");
+    var abc = 123;
+    check_equals(abc, 123);  // check something is equal
+    xcheck_equals(abc, 456); // check something is equal, but expect it to fail
+    var qux = true;
+    check(qux); // check a boolean is true
+    Dejagnu.done(); // don't forget to call this, or the test will not complete
+                    // Note that done() automatically calls stop();
+  .end
+.end

Index: testsuite/misc-swfc.all/sound.sc
===================================================================
RCS file: testsuite/misc-swfc.all/sound.sc
diff -N testsuite/misc-swfc.all/sound.sc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-swfc.all/sound.sc    9 Aug 2007 06:38:16 -0000       1.1
@@ -0,0 +1,54 @@
+.flash bbox=200x200 filename="sound_test.swf" version=6 fps=30
+
+.sound audio "sound.wav"
+
+.box b1 100 100 color=yellow fill=red
+
+.frame 1
+    .action:
+#include "Dejagnu.sc"
+    .end
+
+.frame 2
+       .put b1 pin=center scale=0%
+       .action:
+               var cubesize=0;
+               snd=new Sound();
+               snd.attachSound("audio");
+
+               trace("Sound duration is: ");
+               trace(snd.duration);
+               trace("Correct value should be 13740");
+                check_equals(snd.duration, 13740);
+       
+               trace("Now I'll get the position before starting it");
+               sndpos=snd.position;
+               trace("Position is:");
+               trace(sndpos);
+                check_equals(snd.position, 0);
+               snd.start(0,0);
+       .end
+
+.frame 6
+       .action:
+               cubesize+=1;
+               b1._width=cubesize;
+               b1._height=cubesize;
+               if (cubesize==50) {
+                       cubesize=0;
+               }
+
+               if ((snd.position+100)<snd.duration) {
+                       gotoandPlay(5);
+               } else {
+                       gotoandPlay(8);
+               }
+       .end
+
+.frame 8
+       .action:
+                Dejagnu.done();
+               snd.stop();
+       .end
+       .stop
+.end

Index: testsuite/misc-swfc.all/sound.wav
===================================================================
RCS file: testsuite/misc-swfc.all/sound.wav
diff -N testsuite/misc-swfc.all/sound.wav
Binary files /dev/null and /tmp/cvsACJOp7 differ




reply via email to

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