[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/ButtonE...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/ButtonE... |
Date: |
Wed, 31 Jan 2007 09:17:33 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/01/31 09:17:33
Modified files:
. : ChangeLog
testsuite/misc-ming.all: ButtonEventsTest-Runner.cpp
ButtonEventsTest.c
Log message:
* testsuite/misc-ming.all/: ButtonEventTest.c,
ButtonEventTest-Runner.cpp: added some (failing)
tests for user defined event handlers.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2202&r2=1.2203
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/ButtonEventsTest.c?cvsroot=gnash&r1=1.4&r2=1.5
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2202
retrieving revision 1.2203
diff -u -b -r1.2202 -r1.2203
--- ChangeLog 31 Jan 2007 09:01:19 -0000 1.2202
+++ ChangeLog 31 Jan 2007 09:17:32 -0000 1.2203
@@ -1,4 +1,10 @@
-2007-01-29 Zou Lunkai <address@hidden>
+2007-01-31 Sandro Santilli <address@hidden>
+
+ * testsuite/misc-ming.all/: ButtonEventTest.c,
+ ButtonEventTest-Runner.cpp: added some (failing)
+ tests for user defined event handlers.
+
+2007-01-30 Zou Lunkai <address@hidden>
* testsuite/misc-ming.all/goto_frame_test.c:
add test for consecutive goto
Index: testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp
===================================================================
RCS file:
/sources/gnash/gnash/testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp 29 Nov 2006 08:23:45
-0000 1.8
+++ testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp 31 Jan 2007 09:17:32
-0000 1.9
@@ -34,12 +34,13 @@
using namespace std;
void
-test_mouse_activity(MovieTester& tester, const character* text)
+test_mouse_activity(MovieTester& tester, const character* text, const
character* text2)
{
// roll over the middle of the square, this should change
// the textfield value.
tester.movePointerTo(60, 60);
check_equals(string(text->get_text_value()), string("MouseOver"));
+ xcheck_equals(string(text2->get_text_value()), string("RollOver"));
check(tester.isMouseOverMouseEntity());
// TODO: check that pixel @ 60,60 is yellow !
@@ -47,6 +48,7 @@
// the textfield value.
tester.pressMouseButton();
check_equals(string(text->get_text_value()), string("MouseDown"));
+ xcheck_equals(string(text2->get_text_value()), string("Press"));
check(tester.isMouseOverMouseEntity());
// TODO: check that pixel @ 60,60 is green !
@@ -54,6 +56,7 @@
// the textfield value.
tester.depressMouseButton();
check_equals(string(text->get_text_value()), string("MouseUp"));
+ xcheck_equals(string(text2->get_text_value()), string("Release"));
check(tester.isMouseOverMouseEntity());
// TODO: check that pixel @ 60,60 is yellow !
@@ -61,6 +64,7 @@
// the textfield value.
tester.movePointerTo(39, 60);
check_equals(string(text->get_text_value()), string("MouseOut"));
+ xcheck_equals(string(text2->get_text_value()), string("RollOut"));
check(!tester.isMouseOverMouseEntity());
// TODO: check that pixel @ 60,60 is red !
@@ -68,6 +72,7 @@
// as we're outside of the button.
tester.pressMouseButton();
check_equals(string(text->get_text_value()), string("MouseOut"));
+ xcheck_equals(string(text2->get_text_value()), string("RollOut"));
check(!tester.isMouseOverMouseEntity());
// TODO: check that pixel @ 60,60 is red !
@@ -75,8 +80,27 @@
// as we're outside of the button.
tester.depressMouseButton();
check_equals(string(text->get_text_value()), string("MouseOut"));
+ xcheck_equals(string(text2->get_text_value()), string("RollOut"));
check(!tester.isMouseOverMouseEntity());
// TODO: check that pixel @ 60,60 is red !
+
+ // Now press the mouse inside and release outside
+ tester.movePointerTo(60, 60);
+ check_equals(string(text->get_text_value()), string("MouseOver"));
+ xcheck_equals(string(text2->get_text_value()), string("RollOver"));
+ check(tester.isMouseOverMouseEntity());
+ // TODO: check that pixel @ 60,60 is yellow !
+ tester.pressMouseButton();
+ check_equals(string(text->get_text_value()), string("MouseDown"));
+ xcheck_equals(string(text2->get_text_value()), string("Press"));
+ check(tester.isMouseOverMouseEntity());
+ // TODO: check that pixel @ 60,60 is green !
+ tester.movePointerTo(39, 60);
+ // The following might be correct, as the character still catches
releaseOutside events
+ //check(tester.isMouseOverMouseEntity());
+ tester.depressMouseButton();
+ xcheck_equals(string(text->get_text_value()), string("MouseUpOutside"));
+ xcheck_equals(string(text2->get_text_value()),
string("ReleaseOutside"));
}
int
@@ -85,6 +109,8 @@
string filename = INPUT_FILENAME;
MovieTester tester(filename);
+ std::string idleString = "Idle";
+
sprite_instance* root = tester.getRootMovie();
assert(root);
@@ -99,11 +125,19 @@
const character* text = tester.findDisplayItemByName(*root,
"textfield");
check(text);
- check_equals(string(text->get_text_value()), string("Play with the
button"));
+ const character* text2 = tester.findDisplayItemByName(*root,
"textfield2");
+ check(text2);
+
+ const character* text3 = tester.findDisplayItemByName(*root,
"textfield3");
+ check(text3);
+
+ check_equals(string(text->get_text_value()), idleString);
+ check_equals(string(text2->get_text_value()), idleString);
+ check_equals(string(text3->get_text_value()), idleString);
check(!tester.isMouseOverMouseEntity());
// TODO: check that pixel @ 60,60 is red !
- for (int fno=0; fno<root->get_frame_count(); fno++)
+ for (size_t fno=0; fno<root->get_frame_count(); fno++)
{
const character* square_back =
tester.findDisplayItemByDepth(*root, 1);
const character* square_front =
tester.findDisplayItemByDepth(*root, 3);
@@ -127,10 +161,11 @@
check_equals(root->get_current_frame(), fno);
info (("testing mouse activity in frame %d",
root->get_current_frame()));
- test_mouse_activity(tester, text);
+ test_mouse_activity(tester, text, text2);
+
+ // TODO: test key presses !
+ // They seem NOT to trigger immediate redraw
- // TODO: check why we need this !!
- // I wouldn't want the first advance to be needed
tester.advance();
}
Index: testsuite/misc-ming.all/ButtonEventsTest.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/ButtonEventsTest.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- testsuite/misc-ming.all/ButtonEventsTest.c 22 Nov 2006 11:44:40 -0000
1.4
+++ testsuite/misc-ming.all/ButtonEventsTest.c 31 Jan 2007 09:17:32 -0000
1.5
@@ -50,7 +50,7 @@
void add_event(SWFMovie mo, const char* name, const char* event, const char*
action);
void add_code(SWFMovie mo, const char* code);
-void add_text_field(SWFMovie mo, const char* name, int depth);
+void add_text_field(SWFMovie mo, const char* name, const char* varname, const
char* initial_label, int depth, int x, int y);
void set_text(SWFMovie mo, const char* text);
SWFDisplayItem add_square(SWFMovie mo, byte r, byte g, byte b, int depth);
@@ -104,8 +104,10 @@
SWFButton_addAction(bu,
compileSWFActionCode("_root.msg=\"MouseOver\";"), SWFBUTTON_MOUSEOVER);
SWFButton_addAction(bu,
compileSWFActionCode("_root.msg=\"MouseDown\";"), SWFBUTTON_MOUSEDOWN);
SWFButton_addAction(bu, compileSWFActionCode("_root.msg=\"MouseUp\";"),
SWFBUTTON_MOUSEUP);
+ SWFButton_addAction(bu,
compileSWFActionCode("_root.msg=\"MouseUpOutside\";"),
SWFBUTTON_MOUSEUPOUTSIDE);
- SWFMovieClip_add(mc, (SWFBlock)bu);
+ it = SWFMovieClip_add(mc, (SWFBlock)bu);
+ SWFDisplayItem_setName(it, "button");
SWFMovieClip_nextFrame(mc); /* showFrame */
it = SWFMovie_add(mo, (SWFBlock)mc);
@@ -113,23 +115,31 @@
}
void
-add_text_field(SWFMovie mo, const char* name, int depth)
+add_text_field(SWFMovie mo, const char* name, const char* varname, const char*
initial_label, int depth, int x, int y)
{
SWFDisplayItem it;
SWFTextField tf = newSWFTextField();
- /*SWFTextField_setFlags(tf, SWFTEXTFIELD_DRAWBOX);*/
-
SWFTextField_setFont(tf, (void*)font);
SWFTextField_addChars(tf, "
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345689:.,/address@hidden");
- SWFTextField_addString(tf, "Play with the button");
- SWFTextField_setVariableName(tf, name);
+ SWFTextField_setVariableName(tf, varname);
+ SWFTextField_addString(tf, "Idle");
+ SWFTextField_setBounds(tf, 120, 12);
+ SWFTextField_setFlags(tf, SWFTEXTFIELD_DRAWBOX|SWFTEXTFIELD_NOEDIT);
it = SWFMovie_add(mo, (SWFBlock)tf);
- //SWFDisplayItem_scale(it, 0.3, 0.3);
- SWFDisplayItem_moveTo(it, 0, 10);
- //SWFTextField_setBounds(tf, 120*(1/0.3), 10*(1/0.3));
+ SWFDisplayItem_moveTo(it, x, y+2);
SWFDisplayItem_setDepth(it, depth);
- SWFDisplayItem_setName(it, "textfield");
+ SWFDisplayItem_setName(it, name); // "textfield");
+
+ // Label
+ tf = newSWFTextField();
+ SWFTextField_setFont(tf, (void*)font);
+ SWFTextField_addString(tf, initial_label);
+ SWFTextField_setFlags(tf, SWFTEXTFIELD_DRAWBOX|SWFTEXTFIELD_NOEDIT);
+ it = SWFMovie_add(mo, (SWFBlock)tf);
+ SWFDisplayItem_scale(it, 0.3, 0.3);
+ SWFDisplayItem_setDepth(it, depth*10);
+ SWFDisplayItem_moveTo(it, x, y);
}
void
@@ -162,7 +172,7 @@
mo = newSWFMovie();
SWFMovie_setDimension(mo, 120, 120);
- SWFMovie_setRate(mo, 0.2);
+ SWFMovie_setRate(mo, 1);
if ( argc>1 ) srcdir=argv[1];
else
@@ -181,7 +191,9 @@
/*SWFBrowserFont bfont = newSWFBrowserFont("_sans");*/
font = loadSWFFontFromFile(font_file);
- add_text_field(mo, "_root.msg", 10);
+ add_text_field(mo, "textfield", "_root.msg", "Button events", 10, 0, 5);
+ add_text_field(mo, "textfield2", "_root.msg2", "Key events", 11, 0,
100);
+ add_text_field(mo, "textfield3", "_root.msg3", "Mouse events", 12, 0,
80);
/*****************************************************
*
@@ -190,10 +202,27 @@
*****************************************************/
it = add_button(mo);
- SWFDisplayItem_moveTo(it, 40, 40);
+ SWFDisplayItem_moveTo(it, 40, 30);
SWFDisplayItem_setName(it, "square1");
SWFDisplayItem_setDepth(it, 2);
+ // Mouse pointer events
+ add_actions(mo, "square1.button.onRollOver = function() { _root.msg2 =
'RollOver'; };");
+ add_actions(mo, "square1.button.onRollOut = function() { _root.msg2 =
'RollOut'; };");
+
+ // Mouse buttons events
+ add_actions(mo, "square1.button.onPress = function() { _root.msg2 =
'Press'; };");
+ add_actions(mo, "square1.button.onRelease = function() { _root.msg2 =
'Release'; };");
+ add_actions(mo, "square1.button.onReleaseOutside = function() {
_root.msg2 = 'ReleaseOutside'; };");
+
+ // Focus events
+ add_actions(mo, "square1.button.onSetFocus = function() { _root.msg3 =
'SetFocus'; };");
+
+ // Key events - button needs focus for these to work
+ add_actions(mo, "square1.button.onKeyDown = function() { _root.msg3 =
'KeyDown'; };");
+ add_actions(mo, "square1.button.onKeyUp = function() { _root.msg3 =
'KeyUp'; };");
+
+
SWFMovie_nextFrame(mo); /* showFrame */
/*****************************************************
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/ButtonE...,
Sandro Santilli <=