[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/movie_root.cpp testsuite...
From: |
Zou Lunkai |
Subject: |
[Gnash-commit] gnash ChangeLog server/movie_root.cpp testsuite... |
Date: |
Thu, 21 Jun 2007 05:09:13 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Zou Lunkai <zoulunkai> 07/06/21 05:09:13
Modified files:
. : ChangeLog
server : movie_root.cpp
Added files:
testsuite/misc-ming.all: key_event_test4.c
key_event_test4runner.cpp
Log message:
tests for key event handler and fix
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3590&r2=1.3591
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test4.c?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test4runner.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.68&r2=1.69
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3590
retrieving revision 1.3591
diff -u -b -r1.3590 -r1.3591
--- ChangeLog 21 Jun 2007 02:03:46 -0000 1.3590
+++ ChangeLog 21 Jun 2007 05:09:12 -0000 1.3591
@@ -1,5 +1,11 @@
2007-06-21 Zou Lunkai <address@hidden>
+ * testsuite/misc-ming.all/key_event_test4.c, key_event_test4runner.cpp,
Makefile.am:
+ new testcase for "this" context in a user defined key event handler.
+ * server/movie_root.cpp: correctly set the context.
+
+2007-06-21 Zou Lunkai <address@hidden>
+
* testsuite/actionscript.all/enumerate.as: new testcase, Gnash fails.
2007-06-20 Sandro Santilli <address@hidden>
Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- server/movie_root.cpp 16 Jun 2007 11:27:40 -0000 1.68
+++ server/movie_root.cpp 21 Jun 2007 05:09:13 -0000 1.69
@@ -741,7 +741,7 @@
method =
ch->getUserDefinedEventHandler("onKeyDown");
if ( method )
{
-
call_method0(as_value(method.get()), &(_movie->get_environment()),
_movie.get());
+
call_method0(as_value(method.get()), &(_movie->get_environment()), ch);
}
}
// invoke onClipKeyPress handler
@@ -759,7 +759,7 @@
method =
ch->getUserDefinedEventHandler("onKeyUp");
if ( method )
{
-
call_method0(as_value(method.get()), &(_movie->get_environment()),
_movie.get());
+
call_method0(as_value(method.get()), &(_movie->get_environment()), ch);
}
}
}
Index: testsuite/misc-ming.all/key_event_test4.c
===================================================================
RCS file: testsuite/misc-ming.all/key_event_test4.c
diff -N testsuite/misc-ming.all/key_event_test4.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/key_event_test4.c 21 Jun 2007 05:09:13 -0000
1.1
@@ -0,0 +1,82 @@
+/*
+ * 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 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
+ *
+ */
+
+/*
+ * zou lunkai address@hidden
+ *
+ * Test "this" context in a user defined event handler, self-contained.
+ * The testrunner just provide a key press event.
+ */
+
+#include "ming_utils.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#define OUTPUT_VERSION 6
+#define OUTPUT_FILENAME "key_event_test4.swf"
+
+int
+main(int argc, char** argv)
+{
+ SWFMovie mo;
+ SWFMovieClip dejagnuclip;
+ int i;
+
+
+ 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, 3);
+
+ dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0,
800, 600);
+ SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+ add_actions(mo, " hasKeyPressed = false; thisPtr = 0; ");
+ add_actions(mo, " _root.createEmptyMovieClip('clip', 3); "
+ " clip.onKeyDown = function () { hasKeyPressed = true;
_root.thisPtr = this; }; "
+ " Key.addListener(clip); ");
+ SWFMovie_nextFrame(mo); // frame1
+
+ for(i=1; i<10; i++)
+ {
+ SWFMovie_nextFrame(mo);
+ }
+
+ add_actions(mo, " if(hasKeyPressed == true) "
+ " { "
+ " check_equals(thisPtr, _level0.clip); "
+ " } "
+ " total(); stop(); ");
+ SWFMovie_nextFrame(mo);
+
+ //Output movie
+ puts("Saving " OUTPUT_FILENAME );
+ SWFMovie_save(mo, OUTPUT_FILENAME);
+
+ return 0;
+}
Index: testsuite/misc-ming.all/key_event_test4runner.cpp
===================================================================
RCS file: testsuite/misc-ming.all/key_event_test4runner.cpp
diff -N testsuite/misc-ming.all/key_event_test4runner.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/key_event_test4runner.cpp 21 Jun 2007 05:09:13
-0000 1.1
@@ -0,0 +1,65 @@
+/*
+ * 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_test4.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();
+
+ // Provide a key event and that's all.
+ // testing will be done in the SWF file.
+ tester.pressKey(key::A);
+ tester.releaseKey(key::A);
+
+ //make sure to advance to the last frame.
+ for(int i=0; i<10; i++)
+ {
+ tester.advance();
+ }
+ check_equals(root->get_current_frame(), root->get_frame_count()-1);
+
+ return 0;
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/movie_root.cpp testsuite...,
Zou Lunkai <=