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/key_eve...


From: Zou Lunkai
Subject: [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/key_eve...
Date: Tue, 13 Nov 2007 03:18:22 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  07/11/13 03:18:22

Modified files:
        .              : ChangeLog 
        testsuite/misc-ming.all: key_event_test.c 
                                 key_event_testrunner.cpp 
Removed files:
        testsuite/misc-ming.all: KeyTest-Runner.cpp KeyTest.as 
                                 key_event_test2.c 
                                 key_event_test2runner.cpp 
                                 key_event_test3.c 
                                 key_event_test3runner.cpp 
                                 key_event_test4.c 
                                 key_event_test4runner.cpp 
                                 key_event_test5.c 
                                 key_event_test5runner.cpp 

Log message:
        * testsuite/misc-ming.all/key_event_test.c, key_event_testrunner.cpp:
          few more tests in both swf file and testrunner, invoked a bug.
        * testsuite/misc-ming.all/key_event_test2.c, key_event_test3.c, 
          key_event_test4.c, key_event_test5.c, key_event_test2runner.cpp,
          key_event_test3runner.cpp, key_event_test4runner.cpp, 
          key_event_test5runner.cpp, KeyTest.as, KeyTest-Runner.cpp: dropped
          10 file, we don't need them now, tests were merged to 
key_event_test.c.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4839&r2=1.4840
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test.c?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_testrunner.cpp?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/KeyTest-Runner.cpp?cvsroot=gnash&r1=1.7&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/KeyTest.as?cvsroot=gnash&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test2.c?cvsroot=gnash&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test2runner.cpp?cvsroot=gnash&r1=1.7&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test3.c?cvsroot=gnash&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test3runner.cpp?cvsroot=gnash&r1=1.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test4.c?cvsroot=gnash&r1=1.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test4runner.cpp?cvsroot=gnash&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test5.c?cvsroot=gnash&r1=1.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test5runner.cpp?cvsroot=gnash&r1=1.4&r2=0

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4839
retrieving revision 1.4840
diff -u -b -r1.4839 -r1.4840
--- ChangeLog   12 Nov 2007 23:17:21 -0000      1.4839
+++ ChangeLog   13 Nov 2007 03:18:20 -0000      1.4840
@@ -1,3 +1,13 @@
+2007-11-13 Zou Lunkai <address@hidden>
+
+       * testsuite/misc-ming.all/key_event_test.c, key_event_testrunner.cpp:
+         few more tests in both swf file and testrunner, invoked a bug.
+       * testsuite/misc-ming.all/key_event_test2.c, key_event_test3.c, 
+         key_event_test4.c, key_event_test5.c, key_event_test2runner.cpp,
+         key_event_test3runner.cpp, key_event_test4runner.cpp, 
+         key_event_test5runner.cpp, KeyTest.as, KeyTest-Runner.cpp: dropped
+         10 file, we don't need them now, tests were merged to 
key_event_test.c.
+         
 2007-11-13 Sandro Santilli <address@hidden>
 
        * server/StreamProvider.cpp (getStream): check security

Index: testsuite/misc-ming.all/key_event_test.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/key_event_test.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- testsuite/misc-ming.all/key_event_test.c    12 Nov 2007 07:55:41 -0000      
1.4
+++ testsuite/misc-ming.all/key_event_test.c    13 Nov 2007 03:18:21 -0000      
1.5
@@ -49,7 +49,7 @@
 main(int argc, char** argv)
 {
   SWFMovie mo;
-  SWFMovieClip  mc, dejagnuclip;
+  SWFMovieClip  dejagnuclip;
   SWFDisplayItem  it;
 
   const char *srcdir=".";
@@ -176,14 +176,17 @@
     "   if(!_root.haslooped2){"
     "       _root.haslooped2=true;"
     "       _root.gotoAndPlay(_root._currentframe-1);"
+    "       _root.check_equals(_root._currentframe, 11);"
     "   } else {"
     "       _root.gotoAndPlay(_root._currentframe+1);"
+    "       _root.check_equals(_root._currentframe, 13);"
     "   }"
     "};"
     "Key.addListener(dynamic_mc);"
   );
   SWFMovie_nextFrame(mo);  // _root frame12
   
+  check_equals(mo, "_root.test3", "2");
   add_actions(mo, "dynamic_mc.swapDepths(10);  dynamic_mc.removeMovieClip();");
   SWFMovie_nextFrame(mo);  // _root frame13
   

Index: testsuite/misc-ming.all/key_event_testrunner.cpp
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/key_event_testrunner.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- testsuite/misc-ming.all/key_event_testrunner.cpp    12 Nov 2007 10:17:19 
-0000      1.11
+++ testsuite/misc-ming.all/key_event_testrunner.cpp    13 Nov 2007 03:18:21 
-0000      1.12
@@ -125,7 +125,8 @@
   tester.releaseKey(key::F);
   
   // we have jumped backward to frame11
-  // check_equals(root->get_current_frame(), 10);
+  // Gnash failed on notifying an unloaded character listener
+  xcheck_equals(root->get_current_frame(), 10);
   
   tester.advance();
   // and we are in frame12 again

Index: testsuite/misc-ming.all/KeyTest-Runner.cpp
===================================================================
RCS file: testsuite/misc-ming.all/KeyTest-Runner.cpp
diff -N testsuite/misc-ming.all/KeyTest-Runner.cpp
--- testsuite/misc-ming.all/KeyTest-Runner.cpp  23 Sep 2007 08:48:19 -0000      
1.7
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,95 +0,0 @@
-/* 
- *   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
- *
- *
- */ 
-
-#define INPUT_FILENAME "KeyTest.swf"
-
-#include "MovieTester.h"
-#include "sprite_instance.h"
-#include "character.h"
-#include "dlist.h"
-#include "container.h"
-#include "log.h"
-#include "namedStrings.h"
-
-#include "check.h"
-#include <string>
-#include <cassert>
-
-using namespace gnash;
-using namespace std;
-
-int
-main(int /*argc*/, char** /*argv*/)
-{
-       string filename = string(TGTDIR) + string("/") + 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(), 3);
-       check_equals(root->get_current_frame(), 0);
-
-       tester.advance();
-       check_equals(root->get_current_frame(), 1);
-
-       // need non-const for calling get_member below
-       character* mc1 = 
const_cast<character*>(tester.findDisplayItemByName(*root, "green"));
-       check(mc1);
-
-       as_value tmp;
-
-       check(mc1->get_member(NSV::PROP_uX, &tmp));
-       check_equals(tmp.to_number(), 0);
-
-       tester.advance();
-       check_equals(root->get_current_frame(), 2);
-
-       check(mc1->get_member(NSV::PROP_uX, &tmp));
-       check_equals(tmp.to_number(), 200);
-
-       tester.pressKey(key::J);
-
-       check(mc1->get_member(NSV::PROP_uX, &tmp));
-       check_equals(tmp.to_number(), 250);
-
-       tester.pressKey(key::K);
-
-       check(mc1->get_member(NSV::PROP_uX, &tmp));
-       check_equals(tmp.to_number(), 300);
-
-       tester.releaseKey(key::A);
-
-       check(mc1->get_member(NSV::PROP_uX, &tmp));
-       check_equals(tmp.to_number(), 250);
-
-       tester.releaseKey(key::B);
-
-       check(mc1->get_member(NSV::PROP_uX, &tmp));
-       check_equals(tmp.to_number(), 200);
-
-       // TODO: test pressing and releases keys
-
-
-}
-

Index: testsuite/misc-ming.all/KeyTest.as
===================================================================
RCS file: testsuite/misc-ming.all/KeyTest.as
diff -N testsuite/misc-ming.all/KeyTest.as
--- testsuite/misc-ming.all/KeyTest.as  8 Feb 2007 00:38:51 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,37 +0,0 @@
-//
-// This ActionScript code is intended to be compiled in the third frame
-// of a movie so composed:
-//     frame1) Dejagnu.swf
-//     frame2) A bitmap character named 'green'
-//
-// The aim is testing use of Key.addListener
-// It is expected that any keypress in the movie makes the 'green' character 
move
-// on the right, and any keyrelease will move it back on the left.
-// Pressing multiple keys down will result in a longer right-shift, but
-// when releasing all keys, the bitmap returns to its original position.
-//
-
-
-check_equals(typeof(green), 'movieclip');
-
-// Move the 'green' character on the right 
-// so that Dejagnu.swf xtrace window is visible
-green._x = 200;
-
-l = new Object;
-l.onKeyDown = function ()
-{
-       green._x += 50;
-};
-l.onKeyUp = function ()
-{
-       green._x -= 50;
-};
-
-check_equals(typeof(Key), 'object');
-Key.addListener(l);
-Key = 4;
-check_equals(typeof(Key), 'number');
-
-totals();
-stop();

Index: testsuite/misc-ming.all/key_event_test2.c
===================================================================
RCS file: testsuite/misc-ming.all/key_event_test2.c
diff -N testsuite/misc-ming.all/key_event_test2.c
--- testsuite/misc-ming.all/key_event_test2.c   1 Jul 2007 10:54:54 -0000       
1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,104 +0,0 @@
-/*
- *   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
- *
- */ 
-
-/*
- *  frame1: set _root.x1 to zero;
- *  frame2: check that _root.x1 is still zero;
- *  frame3: 
- *    place a static movieclip "mc" at depth 20 with a onClipKeyDown event 
handler;
- *    increases _root.x1;
- *
- *  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_test2.swf"
-
-
-SWFDisplayItem
-add_static_mc(SWFMovie mo, const char* name, int depth)
-{
-  SWFMovieClip mc;
-  SWFDisplayItem it;
-
-  mc = newSWFMovieClip();
-  SWFMovieClip_nextFrame(mc);
-
-  it = SWFMovie_add(mo, (SWFBlock)mc);
-  SWFDisplayItem_setDepth(it, depth); 
-  SWFDisplayItem_setName(it, name);
-
-  return it;
-}
-
-
-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, 1.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 
-  
-  check_equals(mo, "x1", "0");
-  SWFMovie_nextFrame(mo);  // 2nd frame 
-  
-  // place a static movieclip "mc" at depth 20
-  it = add_static_mc(mo, "mc", 20);
-  
-  // Define onClipKeyDown for "mc"
-  SWFDisplayItem_addAction(it,
-    newSWFAction(" _root.note('onClipKeyDown triggered'); "
-                 " _root.x1++; "
-                ), 
-    SWFACTION_KEYDOWN);    
-  SWFMovie_nextFrame(mo); // 3rd frame
-  
-  
-  //Output movie
-  puts("Saving " OUTPUT_FILENAME );
-  SWFMovie_save(mo, OUTPUT_FILENAME);
-
-  return 0;
-}
-
-

Index: testsuite/misc-ming.all/key_event_test2runner.cpp
===================================================================
RCS file: testsuite/misc-ming.all/key_event_test2runner.cpp
diff -N testsuite/misc-ming.all/key_event_test2runner.cpp
--- testsuite/misc-ming.all/key_event_test2runner.cpp   19 Sep 2007 14:20:51 
-0000      1.7
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,116 +0,0 @@
-/* 
- *   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
- *
- *
- */ 
-
-#define INPUT_FILENAME "key_event_test2.swf"
-
-#include "MovieTester.h"
-#include "sprite_instance.h"
-#include "character.h"
-#include "dlist.h"
-#include "container.h"
-#include "log.h"
-#include "VM.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(), 3);
-  check_equals(root->get_current_frame(), 0);
-
-  tester.advance();
-  check_equals(root->get_current_frame(), 1);
-
-  tester.advance();
-  check_equals(root->get_current_frame(), 2);
-
-  character* mc = const_cast<character*>(tester.findDisplayItemByName(*root, 
"mc"));
-  check(mc);
-
-  as_value tmp;
-  string_table& st = VM::get().getStringTable();
-  check(root->get_member(st.find("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(st.find("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(st.find("x1"), &tmp));
-  check_equals(tmp.to_number(), 0);
-
-  tester.advance(); // advance to frame2
-  tester.advance(); // advance to frame3
-  check_equals(root->get_current_frame(), 2);
-
-  // press key 'A' and checks
-  tester.pressKey(key::A);
-  tester.releaseKey(key::A);
-
-  // check that KeyDown have been triggered
-  check(root->get_member(st.find("x1"), &tmp));
-  check_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(st.find("x1"), &tmp));
-  check_equals(tmp.to_number(), 0);
-
-  tester.advance(); // advance to frame2
-  tester.advance(); // advance to frame3
-  check_equals(root->get_current_frame(), 2);
-
-  // press key 'A' and checks
-  tester.pressKey(key::A);
-  tester.releaseKey(key::A);
-
-  // check that KeyDown have been triggered
-  check(root->get_member(st.find("x1"), &tmp));
-  check_equals(tmp.to_number(), 1);
-  
-  return 0; 
-}

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
--- testsuite/misc-ming.all/key_event_test3.c   1 Jul 2007 10:54:55 -0000       
1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,82 +0,0 @@
-/*
- *   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
- *
- */ 
-
-/*
- *  frame1: set _root.x1 to zero;
- *  frame2: 
- *    create a dynamic movieclip at the static depth zone 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, 0.5);
-
-  dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 
800, 600);
-  SWFMovie_add(mo, (SWFBlock)dejagnuclip);
-  add_actions(mo, "_root.note('at frame1'); 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
--- testsuite/misc-ming.all/key_event_test3runner.cpp   19 Sep 2007 14:20:51 
-0000      1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,112 +0,0 @@
-/* 
- *   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
- *
- *
- */ 
-
-#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 "VM.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;
-  string_table& st = VM::get().getStringTable();
-  string_table::key x1key = st.find("x1");
-  check(root->get_member(x1key, &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(x1key, &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(x1key, &tmp));
-  check_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(x1key, &tmp));
-  check_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(x1key, &tmp));
-  check_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(x1key, &tmp));
-  check_equals(tmp.to_number(), 1);
-  
-  return 0; 
-}

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
--- testsuite/misc-ming.all/key_event_test4.c   11 Jul 2007 06:43:08 -0000      
1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,82 +0,0 @@
-/* 
- *   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
- *
- */ 
-
-/* 
- *  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); "   
-                  " } "
-                  " totals();  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
--- testsuite/misc-ming.all/key_event_test4runner.cpp   1 Jul 2007 10:54:55 
-0000       1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,65 +0,0 @@
-/* 
- *   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
- *
- *
- */ 
-
-#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; 
-}

Index: testsuite/misc-ming.all/key_event_test5.c
===================================================================
RCS file: testsuite/misc-ming.all/key_event_test5.c
diff -N testsuite/misc-ming.all/key_event_test5.c
--- testsuite/misc-ming.all/key_event_test5.c   17 Jul 2007 07:42:23 -0000      
1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,129 +0,0 @@
-/* 
- *   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
- *
- */
-
-#include "ming_utils.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <ming.h>
-
-#define OUTPUT_VERSION 6
-#define OUTPUT_FILENAME "key_event_test5.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, 1);
-
-  // 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; _root.frmNum = 0;" );
-
-  add_actions(mo, " obj = new Object(); "
-                  " obj.x = 1; "
-                  " obj.onKeyDown = function () "
-                  " { "
-                  "   _root.note('key listener invoked'); "
-                  "   hasKeyPressed = true; "
-                  "   _root.objRef = this; "
-                  "   _root.frmNum = _root._currentframe; "
-                  " };" 
-                  " Key.addListener(obj); "
-                  // After deleting obj, we still have a key listener kept 
alive!
-                  " delete obj; " );
-  SWFMovie_nextFrame(mo); 
-
-  for(i=1; i<5; i++)
-  {
-    SWFMovie_nextFrame(mo); 
-  }
-
-  // Check that the explicity reference('obj') has been deleted.
-  // But the object is still alive as a key listener!
-  check_equals(mo, "typeof(obj)", "'undefined'");
-  
-  add_actions(mo, "if(hasKeyPressed)"
-                   "{"
-                   "  check_equals(typeof(objRef), 'object');"
-                   "  check_equals(objRef.x, 1);"
-                   // 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');"
-                   "}"
-                   // reset testing variables
-                   "hasKeyPressed = false;");
-  
-  for(i=5; i<10; i++)
-  {
-    SWFMovie_nextFrame(mo); 
-  }          
-  
-  check_equals(mo, "typeof(obj)", "'undefined'");   
-  
-  add_actions(mo, "if(_root.frmNum < 6)"
-                  "{"
-                  "   check_equals(hasKeyPressed, false); "
-                  "   check_equals(typeof(objRef), 'undefined'); "
-                  "} else"
-                  "{"
-                  "   check_equals(hasKeyPressed, true); "
-                  "   check_equals(typeof(objRef), 'object'); "
-                  "}");
-
-  
-  add_actions(mo, "stop(); totals();");
-  SWFMovie_nextFrame(mo);  
-  
-  //Output movie
-  puts("Saving " OUTPUT_FILENAME );
-  SWFMovie_save(mo, OUTPUT_FILENAME);
-
-  return 0;
-}
-
-

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
--- testsuite/misc-ming.all/key_event_test5runner.cpp   19 Sep 2007 14:20:51 
-0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,89 +0,0 @@
-/* 
- *   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 "VM.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;
-  string_table& st = VM::get().getStringTable();
-  // Gnash fails because it forget to do the case conversion.
-  // A big old bug!
-  xcheck(root->get_member(st.find("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);
-  
-  // Gnash fails because it forget to do the case conversion.
-  // A big old bug!
-  xcheck(root->get_member(st.find("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]