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, 29 May 2007 07:28:32 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  07/05/29 07:28:32

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

Log message:
        new testcase for key listeners

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3388&r2=1.3389
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.132&r2=1.133
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test3.c?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test3runner.cpp?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3388
retrieving revision 1.3389
diff -u -b -r1.3388 -r1.3389
--- ChangeLog   29 May 2007 05:37:17 -0000      1.3388
+++ ChangeLog   29 May 2007 07:28:31 -0000      1.3389
@@ -1,5 +1,11 @@
 2007-05-29 Zou Lunkai <address@hidden>
 
+       * testsuite/misc-ming.all: Makefile.am, key_event_test3.c, 
+         key_event_test3runner.cpp: new testcase for key listeners.
+
+       
+2007-05-29 Zou Lunkai <address@hidden>
+
        * testsuite/misc-ming.all/key_event_test2runner.cpp: remove obsolete 
comments
          
 2007-05-29 Zou Lunkai <address@hidden>

Index: testsuite/misc-ming.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -b -r1.132 -r1.133
--- testsuite/misc-ming.all/Makefile.am 28 May 2007 10:04:54 -0000      1.132
+++ testsuite/misc-ming.all/Makefile.am 29 May 2007 07:28:31 -0000      1.133
@@ -141,6 +141,8 @@
        key_event_testrunner \
        key_event_test2 \
        key_event_test2runner \
+       key_event_test3 \
+       key_event_test3runner \
        static_vs_dynamic1 \
        static_vs_dynamic2 \
        getTimer_test \
@@ -482,7 +484,6 @@
        $(top_builddir)/testsuite/libtestsuite.la \
        $(NULL)
 
-
 key_event_test2_SOURCES = key_event_test2.c
 key_event_test2_LDADD = libgnashmingutils.la
 
@@ -504,6 +505,27 @@
        $(top_builddir)/testsuite/libtestsuite.la \
        $(NULL)
 
+key_event_test3_SOURCES = key_event_test3.c
+key_event_test3_LDADD = libgnashmingutils.la
+
+key_event_test3.swf: key_event_test3
+       ./key_event_test3 $(top_srcdir)/testsuite/media
+
+key_event_test3runner_SOURCES = \
+       key_event_test3runner.cpp \
+       $(NULL)
+key_event_test3runner_LDADD = \
+       $(top_builddir)/testsuite/libtestsuite.la \
+       $(NULL)
+key_event_test3runner_CXXFLAGS = \
+       -DSRCDIR='"$(srcdir)"' \
+       -DTGTDIR='"$(abs_builddir)"' \
+       $(NULL)
+key_event_test3runner_DEPENDENCIES = \
+       key_event_test3.swf \
+       $(top_builddir)/testsuite/libtestsuite.la \
+       $(NULL)
+
 place_object_test_SOURCES = place_object_test.c        
 place_object_test_LDADD = libgnashmingutils.la
 
@@ -1490,6 +1512,7 @@
        masks_testrunner \
        key_event_testrunner \
        key_event_test2runner \
+       key_event_test3runner \
        static_vs_dynamic1_testrunner \
        static_vs_dynamic2_testrunner \
        getTimer_testrunner \

Index: testsuite/misc-ming.all/key_event_test3.c
===================================================================
RCS file: testsuite/misc-ming.all/key_event_test3.c
diff -N testsuite/misc-ming.all/key_event_test3.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/key_event_test3.c   29 May 2007 07:28:31 -0000      
1.1
@@ -0,0 +1,84 @@
+/*
+ *   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
+ *
+ */ 
+
+/*
+ *  frame1: set _root.x1 to zero;
+ *  frame2: 
+ *    create a dynamic movieclip with a user defined onKeyDown event handler;
+ *    increase _root.x1 within the event handler;
+ *
+ *  KeyDown events are provided by the testrunner.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#include "ming_utils.h"
+
+#define OUTPUT_VERSION  6
+#define OUTPUT_FILENAME  "key_event_test3.swf"
+
+
+
+int
+main(int argc, char** argv)
+{
+  SWFMovie mo;
+  SWFMovieClip  dejagnuclip;
+  SWFDisplayItem  it;
+
+  const char *srcdir=".";
+  if ( argc>1 ) 
+    srcdir=argv[1];
+  else
+  {
+      fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
+      return 1;
+  }
+
+  Ming_init();
+  mo = newSWFMovieWithVersion(OUTPUT_VERSION);
+  SWFMovie_setDimension(mo, 800, 600);
+  SWFMovie_setRate (mo, 12.0);
+
+  dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 
800, 600);
+  SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+  add_actions(mo, "x1=0;");
+  SWFMovie_nextFrame(mo);  // 1st frame 
+       
+       add_actions(mo, 
+               "_root.createEmptyMovieClip('dynamic_mc', 10);"
+               "dynamic_mc.onKeyDown = function() "
+               "{"
+               "  _root.note('KeyDown triggered');"
+               "  _root.x1++;"
+               "  _root.note('_root.x1 is: ' + _root.x1);"
+               "};"
+               "Key.addListener(dynamic_mc);"
+       );
+       SWFMovie_nextFrame(mo);  // 2nd frame  
+  
+  //Output movie
+  puts("Saving " OUTPUT_FILENAME );
+  SWFMovie_save(mo, OUTPUT_FILENAME);
+
+  return 0;
+}
+
+

Index: testsuite/misc-ming.all/key_event_test3runner.cpp
===================================================================
RCS file: testsuite/misc-ming.all/key_event_test3runner.cpp
diff -N testsuite/misc-ming.all/key_event_test3runner.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/key_event_test3runner.cpp   29 May 2007 07:28:31 
-0000      1.1
@@ -0,0 +1,115 @@
+/* 
+ *   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_test3.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);
+
+  check_equals(root->get_frame_count(), 2);
+  check_equals(root->get_current_frame(), 0);
+
+  tester.advance();
+  check_equals(root->get_current_frame(), 1);
+
+  character* mc = const_cast<character*>(tester.findDisplayItemByName(*root, 
"dynamic_mc"));
+  check(mc);
+
+  as_value tmp;
+  check(root->get_member("x1", &tmp));
+  check_equals(tmp.to_number(), 0);
+  
+  // press key 'A' and checks
+  tester.pressKey(key::A);
+  tester.releaseKey(key::A);
+
+  // check that KeyDown have been triggered
+  check(root->get_member("x1", &tmp));
+  check_equals(tmp.to_number(), 1);
+
+  
+  tester.advance(); // loop back to frame1
+  // press key 'A' and checks
+   tester.pressKey(key::A);
+   tester.releaseKey(key::A);
+  // check that no KeyDown was triggered(no key event handler at frame1);
+  check(root->get_member("x1", &tmp));
+  // Gnash fails because the key listener didn't get removed by loop-back
+  xcheck_equals(tmp.to_number(), 0); 
+
+  tester.advance(); // advance to frame2
+  check_equals(root->get_current_frame(), 1);
+
+  // press key 'A' and checks
+  tester.pressKey(key::A);
+  tester.releaseKey(key::A);
+
+  // check that KeyDown have been triggered
+  check(root->get_member("x1", &tmp));
+  // gnash fails because the key listener didn't get removed by loop-back
+  // and get added to the listener list again;
+  xcheck_equals(tmp.to_number(), 1); 
+
+  tester.advance(); // loop back to frame1 again
+  // press key 'A' and checks
+  tester.pressKey(key::A);
+  tester.releaseKey(key::A);
+  // check that no KeyDown was triggered(no key event handler at frame1);
+  check(root->get_member("x1", &tmp));
+  // Gnash fails because the key listener didn't get removed by loop-back
+  xcheck_equals(tmp.to_number(), 0);
+
+  tester.advance(); // advance to frame2
+  check_equals(root->get_current_frame(), 1);
+
+  // press key 'A' and checks
+  tester.pressKey(key::A);
+  tester.releaseKey(key::A);
+
+  // check that KeyDown have been triggered
+  check(root->get_member("x1", &tmp));
+  // gnash fails because the key listener didn't get removed when loop back
+  // and get added to the list again;
+  xcheck_equals(tmp.to_number(), 1);
+  
+  return 0; 
+}




reply via email to

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