gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/Makefil...


From: Zou Lunkai
Subject: [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/Makefil...
Date: Tue, 10 Jul 2007 11:45:34 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  07/07/10 11:45:34

Modified files:
        .              : ChangeLog 
        testsuite/misc-ming.all: Makefile.am key_event_test5.c 
Added files:
        testsuite/misc-ming.all: Key_event_test5runner.cpp 

Log message:
        more tests for key listeners and a new testrunner

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3696&r2=1.3697
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.139&r2=1.140
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test5.c?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Key_event_test5runner.cpp?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3696
retrieving revision 1.3697
diff -u -b -r1.3696 -r1.3697
--- ChangeLog   10 Jul 2007 05:05:11 -0000      1.3696
+++ ChangeLog   10 Jul 2007 11:45:33 -0000      1.3697
@@ -1,3 +1,10 @@
+2007-07-10 Zou Lunkai <address@hidden>
+
+       * testsuite/misc-ming.all/key_event_test5.c: more tests.
+       * testsuite/misc-ming.all/key_event_test5runner.c: add a testrunner.
+       * testsuite/misc-ming.all/Makefile.am: enable key_event_test4runner,
+         enable key_event_test5runner
+         
 2007-07-10 Sandro Santilli <address@hidden>
 
        * testsuite/misc-ming.all/Makefile.am: add rules for building

Index: testsuite/misc-ming.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -b -r1.139 -r1.140
--- testsuite/misc-ming.all/Makefile.am 10 Jul 2007 05:05:12 -0000      1.139
+++ testsuite/misc-ming.all/Makefile.am 10 Jul 2007 11:45:34 -0000      1.140
@@ -145,7 +145,9 @@
        key_event_test3 \
        key_event_test3runner \
        key_event_test4 \
+       key_event_test4runner \
        key_event_test5 \
+       key_event_test5runner \
        static_vs_dynamic1 \
        static_vs_dynamic2 \
        getTimer_test \
@@ -569,12 +571,42 @@
 key_event_test4.swf: key_event_test4
        ./key_event_test4 $(top_srcdir)/testsuite/media
 
+key_event_test4runner_SOURCES = \
+       key_event_test4runner.cpp \
+       $(NULL)
+key_event_test4runner_LDADD = \
+       $(top_builddir)/testsuite/libtestsuite.la \
+       $(NULL)
+key_event_test4runner_CXXFLAGS = \
+       -DSRCDIR='"$(srcdir)"' \
+       -DTGTDIR='"$(abs_builddir)"' \
+       $(NULL)
+key_event_test4runner_DEPENDENCIES = \
+       key_event_test4.swf \
+       $(top_builddir)/testsuite/libtestsuite.la \
+       $(NULL)
+       
 key_event_test5_SOURCES = key_event_test5.c
 key_event_test5_LDADD = libgnashmingutils.la
 
 key_event_test5.swf: key_event_test5
        ./key_event_test5 $(top_srcdir)/testsuite/media
 
+key_event_test5runner_SOURCES = \
+       key_event_test5runner.cpp \
+       $(NULL)
+key_event_test5runner_LDADD = \
+       $(top_builddir)/testsuite/libtestsuite.la \
+       $(NULL)
+key_event_test5runner_CXXFLAGS = \
+       -DSRCDIR='"$(srcdir)"' \
+       -DTGTDIR='"$(abs_builddir)"' \
+       $(NULL)
+key_event_test5runner_DEPENDENCIES = \
+       key_event_test5.swf \
+       $(top_builddir)/testsuite/libtestsuite.la \
+       $(NULL)
+       
 place_object_test_SOURCES = place_object_test.c        
 place_object_test_LDADD = libgnashmingutils.la
 
@@ -1562,6 +1594,8 @@
        key_event_testrunner \
        key_event_test2runner \
        key_event_test3runner \
+       key_event_test4runner \
+       key_event_test5runner \
        static_vs_dynamic1_testrunner \
        static_vs_dynamic2_testrunner \
        getTimer_testrunner \

Index: testsuite/misc-ming.all/key_event_test5.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/key_event_test5.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/misc-ming.all/key_event_test5.c   10 Jul 2007 02:52:42 -0000      
1.1
+++ testsuite/misc-ming.all/key_event_test5.c   10 Jul 2007 11:45:34 -0000      
1.2
@@ -57,20 +57,22 @@
   // frame1
   dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 
800, 600);
   SWFMovie_add(mo, (SWFBlock)dejagnuclip);
-  add_actions(mo, " hasKeyPressed = false; x1 = 0;" );
+  add_actions(mo, " hasKeyPressed = false; " );
 
   add_actions(mo, " obj = new Object(); "
+                                                               "       obj.x = 
1; "
                   " obj.onKeyDown = function () "
                   " { "
                   "   _root.note('key listener invoked'); "
-                  "   _root.x1 = 1; "
+                  "   hasKeyPressed = true; "
+                  "   _root.objRef = this; "
                   " };" 
                   " Key.addListener(obj); "
                   // After deleting obj, we still have a key listener kept 
alive!
                   " delete obj; " );
   SWFMovie_nextFrame(mo); 
 
-  for(i=1; i<10; i++)
+  for(i=1; i<5; i++)
   {
     SWFMovie_nextFrame(mo); 
   }
@@ -81,8 +83,32 @@
   
   add_actions(mo, "if(hasKeyPressed)"
                    "{"
-                   "  check_equals(_root.x1, 1); "
-                   "}" );
+                   "  check_equals(typeof(objRef), 'object');"
+                   "  check_equals(objRef.x, 1);"
+                   // reset testing variables
+                   "   hasKeyPressed = false;"
+                   "   _root.x1 = 0; "
+                   "  objRef.x = 0; "
+                   // remove the key listener from the global key
+                   "   Key.removeListener(objRef); "
+                   // check that objRef is still alive
+                   "  check_equals(typeof(objRef), 'object');"
+                   // delete the objRef, no object and no key listener now.
+                   "   delete objRef;"
+                   "}" 
+                   "else"
+                   "{"
+                   "   check_equals(typeof(objRef), 'undefined');"
+                   "}");
+  
+  for(i=5; i<10; i++)
+  {
+    SWFMovie_nextFrame(mo); 
+  }          
+  
+  check_equals(mo, "hasKeyPressed", "false");   
+  check_equals(mo, "typeof(obj)", "'undefined'"); 
+  check_equals(mo, "typeof(objRef)", "'undefined'"); 
                    
   add_actions(mo, "stop(); total();");
   SWFMovie_nextFrame(mo);  

Index: testsuite/misc-ming.all/Key_event_test5runner.cpp
===================================================================
RCS file: testsuite/misc-ming.all/Key_event_test5runner.cpp
diff -N testsuite/misc-ming.all/Key_event_test5runner.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/Key_event_test5runner.cpp   10 Jul 2007 11:45:34 
-0000      1.1
@@ -0,0 +1,85 @@
+/* 
+ *   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 2 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
+ *
+ *
+ */ 
+
+#define INPUT_FILENAME "key_event_test5.swf"
+
+#include "MovieTester.h"
+#include "sprite_instance.h"
+#include "character.h"
+#include "dlist.h"
+#include "container.h"
+#include "log.h"
+
+#include "check.h"
+#include <string>
+#include <cassert>
+
+using namespace gnash;
+using namespace std;
+
+int
+main(int /*argc*/, char** /*argv*/)
+{
+  string filename =  string(INPUT_FILENAME);
+  MovieTester tester(filename);
+
+  gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+  dbglogfile.setVerbosity(1);
+
+  sprite_instance* root = tester.getRootMovie();
+  assert(root);
+
+  tester.advance();
+  tester.advance();
+  tester.advance();
+  
+  as_value tmp;
+  // ???, can not find 'hasKeyPressed'?
+  xcheck(root->get_member("hasKeyPressed", &tmp));
+  check_equals(tmp.to_number(), 0.0);
+  
+  // Provide a key event and that's all.
+  // testing will be done in the SWF file.
+  tester.pressKey(key::A);
+  tester.releaseKey(key::A);
+
+  // advance to the 8th frame
+  for(int i=0; i<5; i++)
+  {
+    tester.advance();
+  }
+  check_equals(root->get_current_frame(), 8);
+  
+  // ???, can not find 'hasKeyPressed'?
+  xcheck(root->get_member("hasKeyPressed", &tmp));
+  xcheck_equals(tmp.to_number(), 1.0);
+  
+  // Provide a key event. 
+  tester.pressKey(key::A);
+  tester.releaseKey(key::A);
+  
+  // advance to the last frame
+  for(int i=0; i<5; i++)
+  {
+    tester.advance();
+  }
+  check_equals(root->get_current_frame(), root->get_frame_count()-1);
+   
+  return 0; 
+}




reply via email to

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