[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/event_id.h server/sprite...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/event_id.h server/sprite... |
Date: |
Thu, 10 May 2007 13:14:42 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/05/10 13:14:42
Modified files:
. : ChangeLog
server : event_id.h sprite_instance.cpp
sprite_instance.h
server/vm : action.cpp
testsuite/misc-ming.all: ButtonEventsTest-Runner.cpp
ButtonEventsTest.c
Log message:
* server/event_id.h, server/vm/action.cpp: add
event_id::is_button_event() method
* server/sprite_instance.{cpp,h}: add isEnabled() method,
(on_event): don't react to button events if not enabled.
* testsuite/misc-ming.all: ButtonEventsTest-Runner.cpp,
ButtonEventsTest.c: add test for Button.enable flag.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3153&r2=1.3154
http://cvs.savannah.gnu.org/viewcvs/gnash/server/event_id.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.266&r2=1.267
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.105&r2=1.106
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/action.cpp?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/ButtonEventsTest.c?cvsroot=gnash&r1=1.6&r2=1.7
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3153
retrieving revision 1.3154
diff -u -b -r1.3153 -r1.3154
--- ChangeLog 10 May 2007 12:14:14 -0000 1.3153
+++ ChangeLog 10 May 2007 13:14:41 -0000 1.3154
@@ -1,5 +1,14 @@
2007-05-10 Sandro Santilli <address@hidden>
+ * server/event_id.h, server/vm/action.cpp: add
+ event_id::is_button_event() method
+ * server/sprite_instance.{cpp,h}: add isEnabled() method,
+ (on_event): don't react to button events if not enabled.
+ * testsuite/misc-ming.all: ButtonEventsTest-Runner.cpp,
+ ButtonEventsTest.c: add test for Button.enable flag.
+
+2007-05-10 Sandro Santilli <address@hidden>
+
* testsuite/actionscript.all/MovieClip.as: more and better tests for
MovieClip.enabled.
* server/sprite_instance.cpp (attachMovieClipInterface): initialize
Index: server/event_id.h
===================================================================
RCS file: /sources/gnash/gnash/server/event_id.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/event_id.h 26 Apr 2007 11:36:34 -0000 1.6
+++ server/event_id.h 10 May 2007 13:14:42 -0000 1.7
@@ -137,10 +137,23 @@
/// (triggerable with a mouse activity)
bool is_mouse_event() const;
- /// \brief
/// Return true if this is a key event
bool is_key_event() const;
+ /// Return true if this is a button-like event
+ //
+ /// Button-like events are: PRESS, RELEASE, RELEASE_OUTSIDE,
+ /// ROLL_OVER, ROLL_OUT,
+ /// DRAG_OVER, DRAG_OUT,
+ /// KEY_PRESS
+ ///
+ /// TODO: check if we need anything more
+ /// The way to test is using the 'enabled'
+ /// property to see which ones are disabled
+ /// by setting it to false.
+ ///
+ bool is_button_event() const;
+
id_code id() const { return m_id; }
};
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.266
retrieving revision 1.267
diff -u -b -r1.266 -r1.267
--- server/sprite_instance.cpp 10 May 2007 10:08:32 -0000 1.266
+++ server/sprite_instance.cpp 10 May 2007 13:14:42 -0000 1.267
@@ -2135,6 +2135,13 @@
{
testInvariant();
+ if ( id.is_button_event() && ! isEnabled() )
+ {
+ log_debug("Sprite %s ignored button-like event %s as not
'enabled'",
+ getTarget().c_str(), id.get_function_name().c_str());
+ return false;
+ }
+
bool called = false;
// First, check for clip event handler.
@@ -3654,4 +3661,14 @@
return bounds;
}
+bool
+sprite_instance::isEnabled() const
+{
+ as_value enabled;
+ // const_cast needed due to get_member being non-const due to the
+ // possibility that a getter-setter would actually modify us ...
+ const_cast<sprite_instance*>(this)->get_member("enabled", &enabled);
+ return enabled.to_bool();
+}
+
} // namespace gnash
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -b -r1.105 -r1.106
--- server/sprite_instance.h 10 May 2007 09:26:56 -0000 1.105
+++ server/sprite_instance.h 10 May 2007 13:14:42 -0000 1.106
@@ -739,6 +739,18 @@
private:
+ /// \brief
+ /// Return value of the 'enabled' property, casted to a boolean value.
+ /// True if not found (undefined to bool evaluates to false).
+ //
+ /// When a MovieClip is "disabled", its handlers of button-like events
+ /// are disabled, and automatic tab ordering won't include it.
+ ///
+ /// See event_id::is_button_event().
+ ///
+ bool isEnabled() const;
+
+
/// Forbid copy
sprite_instance(const sprite_instance&)
:
Index: server/vm/action.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/action.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/vm/action.cpp 26 Apr 2007 12:31:44 -0000 1.18
+++ server/vm/action.cpp 10 May 2007 13:14:42 -0000 1.19
@@ -482,6 +482,25 @@
}
}
+bool
+event_id::is_button_event() const
+{
+ switch (m_id)
+ {
+ case event_id::PRESS:
+ case event_id::RELEASE :
+ case event_id::RELEASE_OUTSIDE:
+ case event_id::ROLL_OVER:
+ case event_id::ROLL_OUT:
+ case event_id::DRAG_OVER:
+ case event_id::DRAG_OUT:
+ case event_id::KEY_PRESS:
+ return true;
+ default:
+ return false;
+ }
+}
+
// Standard member lookup.
// TODO: move to character.h ?
// TODO: case-insensitive search ?
Index: testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp
===================================================================
RCS file:
/sources/gnash/gnash/testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp 5 May 2007 18:14:49
-0000 1.17
+++ testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp 10 May 2007 13:14:42
-0000 1.18
@@ -34,7 +34,7 @@
using namespace std;
void
-test_mouse_activity(MovieTester& tester, const character* text, const
character* text2, bool covered)
+test_mouse_activity(MovieTester& tester, const character* text, const
character* text2, bool covered, bool enabled)
{
rgba red(255,0,0,255);
rgba covered_red(127,126,0,255); // red, covered by 50% black
@@ -43,36 +43,63 @@
rgba green(0,255,0,255);
// roll over the middle of the square, this should change
- // the textfield value.
+ // the textfield value, if enabled
tester.movePointerTo(60, 60);
+ if ( enabled ) {
check_equals(string(text->get_text_value()), string("MouseOver"));
check_equals(string(text2->get_text_value()), string("RollOver"));
check(tester.isMouseOverMouseEntity());
// check that pixel @ 60,60 is yellow !
if ( covered ) { check_pixel(60, 60, 2, covered_yellow, 2); }
else { check_pixel(60, 60, 2, yellow, 2); }
+ } else {
+ check_equals(string(text->get_text_value()),
string("MouseOut"));
+ check_equals(string(text2->get_text_value()),
string("RollOut"));
+ check(!tester.isMouseOverMouseEntity());
+ // check that pixel @ 60,60 is red !
+ if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
+ else { check_pixel(60, 60, 2, red, 2); }
+ }
// press the mouse button, this should change
- // the textfield value.
+ // the textfield value, if enabled.
tester.pressMouseButton();
+ if ( enabled ) {
check_equals(string(text->get_text_value()), string("MouseDown"));
check_equals(string(text2->get_text_value()), string("Press"));
check(tester.isMouseOverMouseEntity());
// check that pixel @ 60,60 is green !
check_pixel(60, 60, 2, green, 2);
+ } else {
+ check_equals(string(text->get_text_value()),
string("MouseOut"));
+ check_equals(string(text2->get_text_value()),
string("RollOut"));
+ check(!tester.isMouseOverMouseEntity());
+ // check that pixel @ 60,60 is red !
+ if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
+ else { check_pixel(60, 60, 2, red, 2); }
+ }
// depress the mouse button, this should change
- // the textfield value.
+ // the textfield value, if enabled
tester.depressMouseButton();
+ if ( enabled ) {
check_equals(string(text->get_text_value()), string("MouseUp"));
check_equals(string(text2->get_text_value()), string("Release"));
check(tester.isMouseOverMouseEntity());
// check that pixel @ 60,60 is yellow !
if ( covered ) { check_pixel(60, 60, 2, covered_yellow, 2); }
else { check_pixel(60, 60, 2, yellow, 2); }
+ } else {
+ check_equals(string(text->get_text_value()),
string("MouseOut"));
+ check_equals(string(text2->get_text_value()),
string("RollOut"));
+ check(!tester.isMouseOverMouseEntity());
+ // check that pixel @ 60,60 is red !
+ if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
+ else { check_pixel(60, 60, 2, red, 2); }
+ }
// roll off the square, this should change
- // the textfield value.
+ // the textfield value, if enabled
tester.movePointerTo(39, 60);
check_equals(string(text->get_text_value()), string("MouseOut"));
check_equals(string(text2->get_text_value()), string("RollOut"));
@@ -102,26 +129,55 @@
else { check_pixel(60, 60, 2, red, 2); }
// Now press the mouse inside and release outside
+
tester.movePointerTo(60, 60);
+
+ if ( enabled ) {
check_equals(string(text->get_text_value()), string("MouseOver"));
check_equals(string(text2->get_text_value()), string("RollOver"));
check(tester.isMouseOverMouseEntity());
// check that pixel @ 60,60 is yellow !
if ( covered ) { check_pixel(60, 60, 2, covered_yellow, 2); }
else { check_pixel(60, 60, 2, yellow, 2); }
+ } else {
+ check_equals(string(text->get_text_value()),
string("MouseOut"));
+ check_equals(string(text2->get_text_value()),
string("RollOut"));
+ check(!tester.isMouseOverMouseEntity());
+ // check that pixel @ 60,60 is red !
+ if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
+ else { check_pixel(60, 60, 2, red, 2); }
+ }
tester.pressMouseButton();
+
+ if ( enabled ) {
check_equals(string(text->get_text_value()), string("MouseDown"));
check_equals(string(text2->get_text_value()), string("Press"));
check(tester.isMouseOverMouseEntity());
// check that pixel @ 60,60 is green !
check_pixel(60, 60, 2, rgba(0,255,0,255), 2);
+ } else {
+ check_equals(string(text->get_text_value()),
string("MouseOut"));
+ check_equals(string(text2->get_text_value()),
string("RollOut"));
+ check(!tester.isMouseOverMouseEntity());
+ // check that pixel @ 60,60 is red !
+ if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
+ else { check_pixel(60, 60, 2, red, 2); }
+ }
+
tester.movePointerTo(39, 60);
+
// The following might be correct, as the character still catches
releaseOutside events
//check(tester.isMouseOverMouseEntity());
tester.depressMouseButton();
+
+ if ( enabled ) {
xcheck_equals(string(text->get_text_value()), string("MouseUpOutside"));
xcheck_equals(string(text2->get_text_value()),
string("ReleaseOutside"));
+ } else {
+ check_equals(string(text->get_text_value()),
string("MouseOut"));
+ check_equals(string(text2->get_text_value()),
string("RollOut"));
+ }
}
int
@@ -136,7 +192,7 @@
sprite_instance* root = tester.getRootMovie();
assert(root);
- check_equals(root->get_frame_count(), 3);
+ check_equals(root->get_frame_count(), 4);
check_equals(root->get_current_frame(), 0);
@@ -185,7 +241,7 @@
check_equals(root->get_current_frame(), fno);
info (("testing mouse activity in frame %d",
root->get_current_frame()));
- test_mouse_activity(tester, text, text2, square_front!=NULL);
+ test_mouse_activity(tester, text, text2, square_front!=NULL,
fno != root->get_frame_count()-1);
// TODO: test key presses !
// They seem NOT to trigger immediate redraw
Index: testsuite/misc-ming.all/ButtonEventsTest.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/ButtonEventsTest.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- testsuite/misc-ming.all/ButtonEventsTest.c 19 Feb 2007 23:06:35 -0000
1.6
+++ testsuite/misc-ming.all/ButtonEventsTest.c 10 May 2007 13:14:42 -0000
1.7
@@ -256,6 +256,18 @@
/*****************************************************
*
+ * On third frame, add a shape at higher depth
+ *
+ *****************************************************/
+
+ {
+
+ add_actions(mo, "square1.button.enabled = false;");
+ SWFMovie_nextFrame(mo); /* showFrame */
+ }
+
+ /*****************************************************
+ *
* Save it...
*
*****************************************************/
- [Gnash-commit] gnash ChangeLog server/event_id.h server/sprite...,
Sandro Santilli <=