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: Mon, 12 Nov 2007 07:55:42 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  07/11/12 07:55:42

Modified files:
        .              : ChangeLog 
        testsuite/misc-ming.all: Makefile.am key_event_test.c 
                                 key_event_testrunner.cpp 

Log message:
        * testsuite/misc-ming.all/Makefile.am, key_event_test.c, 
key_event_testrunner.cpp:
         merge all key related tests to key_event_test.c. deprecated 
key_event_test2,3,4,5
         and KeyTest.as to speed up 'make check'.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4828&r2=1.4829
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.165&r2=1.166
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_test.c?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/key_event_testrunner.cpp?cvsroot=gnash&r1=1.9&r2=1.10

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4828
retrieving revision 1.4829
diff -u -b -r1.4828 -r1.4829
--- ChangeLog   11 Nov 2007 18:01:12 -0000      1.4828
+++ ChangeLog   12 Nov 2007 07:55:41 -0000      1.4829
@@ -1,3 +1,9 @@
+2007-11-12 Zou Lunkai <address@hidden>
+
+       * testsuite/misc-ming.all/Makefile.am, key_event_test.c, 
key_event_testrunner.cpp:
+         merge all key related tests to key_event_test.c. deprecated 
key_event_test2,3,4,5
+         and KeyTest.as to speed up 'make check'.
+         
 2007-11-11 Sandro Santilli <address@hidden>
 
        * server/sprite_instance.cpp (sprite_attach_movie): mark the character

Index: testsuite/misc-ming.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -b -r1.165 -r1.166
--- testsuite/misc-ming.all/Makefile.am 6 Nov 2007 13:25:38 -0000       1.165
+++ testsuite/misc-ming.all/Makefile.am 12 Nov 2007 07:55:41 -0000      1.166
@@ -30,7 +30,6 @@
        testrun.log
 
 EXTRA_DIST = VarAndCharClashTest.as \
-       KeyTest.as \
        gotoFrame2Test.as \
        DrawingApiTest.as \
        FlashVarsTest.as \
@@ -149,14 +148,6 @@
        masks_testrunner \
        key_event_test \
        key_event_testrunner \
-       key_event_test2 \
-       key_event_test2runner \
-       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 \
@@ -176,8 +167,7 @@
 endif
 
 if MAKESWF_SUPPORTS_PREBUILT_CLIPS
-check_PROGRAMS += KeyTest-Runner \
-       intervalTestRunner 
+check_PROGRAMS += intervalTestRunner 
 endif
 
 if MING_SUPPORTS_INIT_ACTIONS
@@ -609,90 +599,6 @@
        $(top_builddir)/testsuite/libtestsuite.la \
        $(NULL)
 
-key_event_test2_SOURCES = key_event_test2.c
-key_event_test2_LDADD = libgnashmingutils.la
-
-key_event_test2.swf: key_event_test2
-       ./key_event_test2 $(top_srcdir)/testsuite/media
-
-key_event_test2runner_SOURCES = \
-       key_event_test2runner.cpp \
-       $(NULL)
-key_event_test2runner_LDADD = \
-       $(top_builddir)/testsuite/libtestsuite.la \
-       $(NULL)
-key_event_test2runner_CXXFLAGS = \
-       -DSRCDIR='"$(srcdir)"' \
-       -DTGTDIR='"$(abs_builddir)"' \
-       $(NULL)
-key_event_test2runner_DEPENDENCIES = \
-       key_event_test2.swf \
-       $(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)
-
-key_event_test4_SOURCES = key_event_test4.c
-key_event_test4_LDADD = libgnashmingutils.la
-
-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
 
@@ -1551,26 +1457,6 @@
        intervalTest.swf        \
        $(NULL)
 
-# This will only work with Ming-0.4.0beta2 (support for prebuilt clips 
inclusion)
-# Uses a low frame rate to test immediate redraw on key event
-KeyTest.swf: $(srcdir)/../media/green.swf Dejagnu.swf $(srcdir)/KeyTest.as 
-       $(MAKESWF) -o $@ Dejagnu.swf $(srcdir)/../media/green.swf 
$(srcdir)/KeyTest.as
-#
-KeyTest_Runner_SOURCES = \
-       KeyTest-Runner.cpp \
-       $(NULL)
-KeyTest_Runner_CXXFLAGS = \
-       -DSRCDIR='"$(srcdir)"' \
-       -DTGTDIR='"$(abs_builddir)"' \
-       $(NULL)
-KeyTest_Runner_LDADD = \
-       $(top_builddir)/testsuite/libtestsuite.la \
-       $(NULL)
-KeyTest_Runner_DEPENDENCIES = \
-       $(top_builddir)/testsuite/libtestsuite.la \
-       KeyTest.swf     \
-       $(NULL)
-
 gotoFrame2Test.swf: $(srcdir)/../media/green.swf Dejagnu.swf 
$(srcdir)/gotoFrame2Test.as 
        $(MAKESWF) -o $@ -iDejagnu.swf:dejagnu 
$(srcdir)/../actionscript.all/dejagnu_so_init.as \
                $(srcdir)/gotoFrame2Test.as 
@@ -1767,10 +1653,6 @@
        masks_testrunner \
        masks_test2runner \
        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 \
@@ -1796,8 +1678,7 @@
 endif
 
 if MAKESWF_SUPPORTS_PREBUILT_CLIPS
-TEST_CASES += KeyTest-Runner \
-       VarAndCharClashTest-Runner \
+TEST_CASES += VarAndCharClashTest-Runner \
        FlashVarsTest-Runner \
        intervalTestRunner \
        gotoFrame2Test-Runner 

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.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- testsuite/misc-ming.all/key_event_test.c    1 Jul 2007 10:54:54 -0000       
1.3
+++ testsuite/misc-ming.all/key_event_test.c    12 Nov 2007 07:55:41 -0000      
1.4
@@ -16,13 +16,6 @@
  *
  */ 
 
-/*
- *  Key events are: KeyUp, KeyDown, KeyPress
- *  (1)KeyUp and KeyDown event handler is unrelated to any key;
- *  (2)KeyPress event handler should bind a valid key, which is hard-coded in 
the placement tag;
- *  (3)Use Key.addListener() to register user defined key event handler, 
otherwise it will not
- *     be triggered.
-*/
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -33,6 +26,24 @@
 #define OUTPUT_VERSION  6
 #define OUTPUT_FILENAME  "key_event_test.swf"
 
+SWFDisplayItem
+add_static_mc(SWFMovie mo, const char* name, int depth)
+{
+  SWFShape  sh;
+  SWFMovieClip mc;
+  SWFDisplayItem it;
+
+  mc = newSWFMovieClip();
+  sh = make_fill_square (300, 300, 60, 60, 255, 0, 0, 255, 0, 0);
+  SWFMovieClip_add(mc, (SWFBlock)sh);  
+  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)
@@ -40,7 +51,6 @@
   SWFMovie mo;
   SWFMovieClip  mc, dejagnuclip;
   SWFDisplayItem  it;
-  SWFShape  sh_red;
 
   const char *srcdir=".";
   if ( argc>1 ) 
@@ -54,70 +64,173 @@
   Ming_init();
   mo = newSWFMovieWithVersion(OUTPUT_VERSION);
   SWFMovie_setDimension(mo, 800, 600);
+  // low frame rate is needed for visual checking
   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; x2=0; x3=0; x4=0; x5=0; x6=0; ");
-  SWFMovie_nextFrame(mo);  /* 1st frame */
+  add_actions(mo, 
+    "test1=0; test2=0; test3=0; test4=0; test5=0; test6=0; "
+    "keyPressed=false; keyReleased=false;"
+    "haslooped1=false; haslooped2=false;");
+  SWFMovie_nextFrame(mo);  // _root frame1
+
+
+  // test1: 
+  //    (1)onKeyDown, onKeyPress and onKeyUp are not global functions
+  //    (2)test that global Key object can be overridden
+  //    (3)after overriden, previously registered handlers could still respond 
to new key events
+  add_actions(mo, 
+    "_root.var1 = 0; _root.var2 = 0;"
+    "l = new Object();"
+    "l.onKeyDown = function () {_root.var1+=1; _root.Play(); }; "
+    "l.onKeyUp = function () { _root.var2+=1;}; "
+    " Key.addListener(l);"
+    "check_equals(typeof(Key), 'object');"
+    "check_equals(typeof(onKeyUp), 'undefined');"
+    "check_equals(typeof(onKeyDown), 'undefined');"
+    "check_equals(typeof(onKeyPress), 'undefined');"
+    "stop();"
+    "_root.note('press a single key to continue the test');"
+  );
+  SWFMovie_nextFrame(mo);  // _root frame2
 
+  SWFMovie_nextFrame(mo);  // _root frame3
   
-  mc = newSWFMovieClip();
-  sh_red = make_fill_square (300, 300, 60, 60, 255, 0, 0, 255, 0, 0);
-  SWFMovieClip_add(mc, (SWFBlock)sh_red);  
-  SWFMovieClip_nextFrame(mc);
+  add_actions(mo, 
+    "stop();"
+    "check_equals(var1, 1); "
+    "check_equals(var2, 1); "
+    "Key = 3;"
+    "check_equals(typeof(Key), 'number');"
+    "_root.note('press a single key to continue the test');"
+    );
+  SWFMovie_nextFrame(mo);  // _root frame4
 
+  SWFMovie_nextFrame(mo);  // _root frame5
 
-  it = SWFMovie_add(mo, (SWFBlock)mc); 
-  SWFDisplayItem_setDepth(it, 20); 
-  SWFDisplayItem_setName(it, "mc"); 
-  /* Define onClipKeyDown */
+  add_actions(mo,
+    "stop();"
+    "check_equals(var1, 2); "
+    "check_equals(var2, 2);"
+    "delete Key; "
+    "check_equals(typeof(Key), 'object');"
+    "Key.removeListener(l);"
+    "_root.note('press a single key to continue the test');"
+    "obj1=new Object(); "
+    " obj1.onKeyDown=function() {"
+    "   _root.play();"
+    "}; "
+    " Key.addListener(obj1); "
+  );
+  SWFMovie_nextFrame(mo);  // _root frame6
+   
+  add_actions(mo, 
+    "check_equals(var1, 2);"
+    "check_equals(var2, 2);"
+    "Key.removeListener(obj1);"
+    "delete l; delete obj1; "
+  );
+  SWFMovie_nextFrame(mo);  // _root frame7
+  
+  // test2:
+  //    test removing of static clip key listeners
+  SWFMovie_nextFrame(mo);  // _root frame8
+  
+  it = add_static_mc(mo, "listenerClip1", 20);
   SWFDisplayItem_addAction(it,
-    newSWFAction(" _root.x1 = Key.getAscii(); "
-                " _root.note('onClipKeyDown triggered'); "
-                " _root.note('key ASCII value: ' + _root.x1); "), 
+    newSWFAction(" _root.note('onClipKeyDown triggered'); "
+                 " _root.test2++; "
+                 "if(!_root.haslooped1){"
+                 "   _root.haslooped1=true;"
+                 "   _root.gotoAndPlay(_root._currentframe-1);"
+                 "} else {"
+                 "   _root.gotoAndPlay(_root._currentframe+1);"
+                 "}"
+                ), 
     SWFACTION_KEYDOWN); 
-  /* Define onClipKeyUp */
-  SWFDisplayItem_addAction(it,
-    newSWFAction(" _root.x2 = Key.getCode(); "
-                 " _root.note('onClipKeyUp triggered'); "
-                 " _root.note('key code: ' + _root.x2); "), 
-    SWFACTION_KEYUP); 
-  /* Define onClipKeyUp. Question: how to bind a key code with the KeyPress 
event??? */ 
-  SWFDisplayItem_addAction(it,
-    newSWFAction(" _root.note('onClipKeyPress triggered'); "
-                 " _root.x3 = _root.x1; "), 
-    SWFACTION_KEYPRESS);     
-    
-  /* add user defined events */
-  add_actions(mo, " mc.onKeyDown = function () { " 
-                  " _root.x4 = Key.getAscii(); "
-                  " _root.note('user defined onKeyDown triggered');  "
-                  " _root.note('key ASCII value: ' + _root.x4); }; "
-                  
-                  " mc.onKeyUp = function () { "
-                  " _root.x5 = Key.getCode(); "
-                  " _root.note('user defined onKeyUp triggered'); "
-                  " _root.note('key code: ' +  _root.x5);  }; "
-                  
-                  " mc.onKeyPress = function () { "
-                  " _root.x6 = _root.x3; "
-                  " _root.note('user defined onKeyPress triggered'); }; "
+  add_actions(mo,
+    "stop();"
+    "_root.note('press a single key to continue the test');"
               );
+  SWFMovie_nextFrame(mo);  // _root frame9
   
-  SWFMovie_nextFrame(mo); /* 2nd frame */
+  check_equals(mo, "_root.test2", "2");
+  SWFDisplayItem_remove(it);
+  SWFMovie_nextFrame(mo);  // _root frame10
+  
+  
+  // test3:
+  //    test removing of dynamic sprite key listeners 
+  SWFMovie_nextFrame(mo);  // _root frame11
+  
+  add_actions(mo, 
+    "stop();"
+    "_root.note('press a single key to continue the test');"
+    "_root.createEmptyMovieClip('dynamic_mc', -10);"
+    "dynamic_mc.onKeyDown = function() "
+    "{"
+    "   _root.check_equals(this, _root.dynamic_mc);"
+    "   _root.note('user defined KeyDown triggered');"
+    "   _root.test3++;"
+    "   if(!_root.haslooped2){"
+    "       _root.haslooped2=true;"
+    "       _root.gotoAndPlay(_root._currentframe-1);"
+    "   } else {"
+    "       _root.gotoAndPlay(_root._currentframe+1);"
+    "   }"
+    "};"
+    "Key.addListener(dynamic_mc);"
+  );
+  SWFMovie_nextFrame(mo);  // _root frame12
   
-  int frame_num = 3;
-  for(frame_num; frame_num<=30; frame_num++)
-  {
-      SWFMovie_nextFrame(mo); 
-  }
+  add_actions(mo, "dynamic_mc.swapDepths(10);  dynamic_mc.removeMovieClip();");
+  SWFMovie_nextFrame(mo);  // _root frame13
   
-  add_actions(mo, "_root.note('mc registered by addListener()'); ");
-  /* register "mc" to receive onKeyDown and onKeyUp notification after 30 
seconds(30 frames). */
-  add_actions(mo, " Key.addListener(mc); stop(); ");
-  SWFMovie_nextFrame(mo); /* 31th frame */
+  // test4:
+  //    GC test
+  add_actions(mo, 
+    "_root.note('press a single key to continue the test');"
+    " obj2 = new Object(); "
+    " obj2.x = 100; "
+    " obj2.onKeyDown = function () { "
+    "   _root.note('user defined KeyDown triggered');"
+    "   _root.test4++; "
+    "   _root.objRef = this; "
+    "   _root.play();"
+    " };" 
+    " Key.addListener(obj2); "
+    // After deleting obj2, we still have a key listener kept alive!
+    " delete obj2; "
+    " stop();"
+  );
+  check_equals(mo, "_root.test4", "0");
+  SWFMovie_nextFrame(mo);  // _root frame14
   
+  check_equals(mo, "objRef.x", "100");
+  check_equals(mo, "_root.test4", "1");
+  add_actions(mo,
+    "stop();"
+    "_root.note('press a single key to continue the test');"
+    "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;"
+    "obj3=new Object(); "
+    "obj3.onKeyDown=function() {"
+    "   _root.play();"
+    "}; "
+    "Key.addListener(obj3); "
+  );
+  SWFMovie_nextFrame(mo);  // _root frame15
+  
+  check_equals(mo, "_root.test4", "1");
+  add_actions(mo, 
+    "Key.removeListener(obj3);"
+    "delete obj3; "
+    "totals(); stop();");
+  SWFMovie_nextFrame(mo);  // _root frame16
   
   //Output movie
   puts("Saving " OUTPUT_FILENAME );
@@ -127,3 +240,4 @@
 }
 
 
+

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.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- testsuite/misc-ming.all/key_event_testrunner.cpp    20 Sep 2007 06:57:02 
-0000      1.9
+++ testsuite/misc-ming.all/key_event_testrunner.cpp    12 Nov 2007 07:55:41 
-0000      1.10
@@ -47,69 +47,114 @@
   sprite_instance* root = tester.getRootMovie();
   assert(root);
 
-  check_equals(root->get_frame_count(), 31);
+  check_equals(root->get_frame_count(), 16);
   check_equals(root->get_current_frame(), 0);
 
   tester.advance();
+  tester.advance();
+  // check we are stopped at frame2
   check_equals(root->get_current_frame(), 1);
 
-  character* mc = const_cast<character*>(tester.findDisplayItemByName(*root, 
"mc"));
-  check(mc);
+  // provide a key press to continue the test
+  tester.pressKey(key::A);
+  tester.releaseKey(key::A);
 
-  as_value tmp;
-  string_table& st = VM::get().getStringTable();
-  string_table::key x1key = st.find("x1");
+  tester.advance();
+  check_equals(root->get_current_frame(), 2);
 
-  check(root->get_member(x1key, &tmp));
-  check_equals(tmp.to_number(), 0);
+  tester.advance();
+  tester.advance();
+  // check we are stopped at frame4
+  check_equals(root->get_current_frame(), 3);
   
-  // press key 'A' and checks
-  tester.pressKey(key::A);
-  tester.releaseKey(key::A);
+  // provide a key press to continue the test
+  tester.pressKey(key::B);
+  tester.releaseKey(key::B);
 
-  // check that onClipKeyUp/KeyDown have been triggered
-  check(root->get_member(x1key, &tmp));
-  check_equals(tmp.to_string(), "65");
-  check(root->get_member(st.find("x2"), &tmp));
-  check_equals(tmp.to_number(), key::A);
-
-  // check that user defined onKeyUp/KeyDown were not triggered
-  check(root->get_member(st.find("x4"), &tmp));
-  check_equals(tmp.to_number(), 0);
-  check(root->get_member(st.find("x5"), &tmp));
-  check_equals(tmp.to_number(), 0);
-
-  for(int i=1; i<30; i++)
-  {
     tester.advance();
-  }
+  check_equals(root->get_current_frame(), 4);
 
-  check_equals(root->get_current_frame(), 30); // the 31th frame
-  check_equals(root->get_play_state(), sprite_instance::STOP);
+  tester.advance();
+  tester.advance();
+  // check we are stopped at frame6
+  check_equals(root->get_current_frame(), 5);
 
-  // press key 'C' and checks
+  // provide a key press to continue the test
   tester.pressKey(key::C);
   tester.releaseKey(key::C);
 
-  // check that onClipKeyUp/KeyDown have been triggered
-  check(root->get_member(x1key, &tmp));
-  check_equals(tmp.to_string(), "67");
-  check(root->get_member(st.find("x2"), &tmp));
-  check_equals(tmp.to_number(), key::C);
-  
-  // check that user defined onKeyUp/KeyDown have been triggered
-  check(root->get_member(st.find("x4"), &tmp));
-  check_equals(tmp.to_string(), "67");
-  check(root->get_member(st.find("x5"), &tmp));
-  check_equals(tmp.to_number(), key::C);
-       
-  // check that user onClipKeyPress and user defined onKeyPress were not 
triggered
-  // onClipKeyPress was not triggered because the event handler binds a 
invalid key code
-  check(root->get_member(st.find("x3"), &tmp));
-  check_equals(tmp.to_number(), 0);
-  // onKeyPress was not triggered because I think there is no user defined
-  // KeyPress event handler at all( the defined onKeyPress is just a normal 
function).
-  check(root->get_member(st.find("x6"), &tmp));
-  check_equals(tmp.to_number(), 0);
+  tester.advance();
+  check_equals(root->get_current_frame(), 6);
+  
+  tester.advance();
+  check_equals(root->get_current_frame(), 7);
+  
+  tester.advance();
+  tester.advance();
+  // check we are stopped at frame9
+  check_equals(root->get_current_frame(), 8);
+  
+  // provide a key press to continue the test
+  tester.pressKey(key::D);
+  tester.releaseKey(key::D);
   
+  // we have jumped back to frame7
+  check_equals(root->get_current_frame(), 7);
+  
+  tester.advance();
+  // and we are in frame8 again
+  check_equals(root->get_current_frame(), 8);
+  
+  // provide a key press to continue the test
+  tester.pressKey(key::E);
+  tester.releaseKey(key::E);
+       
+  tester.advance();
+  check_equals(root->get_current_frame(), 9);
+  
+  tester.advance();
+  check_equals(root->get_current_frame(), 10);
+  
+  tester.advance();
+  tester.advance();
+  // check we are stopped at frame12
+  check_equals(root->get_current_frame(), 11);
+  
+  // provide a key press to continue the test
+  tester.pressKey(key::F);
+  tester.releaseKey(key::F);
+  
+  // we have jumped back to frame11
+  check_equals(root->get_current_frame(), 11);
+  
+  tester.advance();
+  // and we are in frame12 again
+  check_equals(root->get_current_frame(), 12);
+  
+  // provide a key press to continue the test
+  tester.pressKey(key::G);
+  tester.releaseKey(key::G);
+       
+  tester.advance();
+  tester.advance();
+  // check we are stopped at frame14
+  check_equals(root->get_current_frame(), 13);
+  
+  // provide a key press to continue the test
+  tester.pressKey(key::H);
+  tester.releaseKey(key::H);
+    
+  tester.advance();
+  tester.advance();
+  // check we are stopped at frame15
+  check_equals(root->get_current_frame(), 14);
+  
+  // provide a key press to continue the test
+  tester.pressKey(key::I);
+  tester.releaseKey(key::I);
+  
+  tester.advance();
+  tester.advance();
+  // check we are stopped at frame16, finish testing
+  check_equals(root->get_current_frame(), 15);
 }




reply via email to

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