[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/button_character_instanc...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/button_character_instanc... |
Date: |
Fri, 18 Apr 2008 22:32:57 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/04/18 22:32:57
Modified files:
. : ChangeLog
server : button_character_instance.cpp
testsuite/misc-ming.all: ButtonEventsTest-Runner.cpp
ButtonEventsTest.c
Log message:
* testsuite/misc-ming.all/: ButtonEventsTest.c,
ButtonEventsTest-Runner.cpp: Add test for shape-sensible
hitTest agains containing mouse-grabbing sprite, add
test code (not automated) for key events.
* server/button_character_instance.cpp:
Reduce direct access to the m_record_character member,
which will need to be changed for proper design.
As a side-effect, fix pointInShape so to consider
all characters for current state, not just the first one.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6326&r2=1.6327
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.cpp?cvsroot=gnash&r1=1.94&r2=1.95
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/ButtonEventsTest.c?cvsroot=gnash&r1=1.15&r2=1.16
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6326
retrieving revision 1.6327
diff -u -b -r1.6326 -r1.6327
--- ChangeLog 18 Apr 2008 21:30:53 -0000 1.6326
+++ ChangeLog 18 Apr 2008 22:32:56 -0000 1.6327
@@ -1,5 +1,17 @@
2008-04-18 Sandro Santilli <address@hidden>
+ * testsuite/misc-ming.all/: ButtonEventsTest.c,
+ ButtonEventsTest-Runner.cpp: Add test for shape-sensible
+ hitTest agains containing mouse-grabbing sprite, add
+ test code (not automated) for key events.
+ * server/button_character_instance.cpp:
+ Reduce direct access to the m_record_character member,
+ which will need to be changed for proper design.
+ As a side-effect, fix pointInShape so to consider
+ all characters for current state, not just the first one.
+
+2008-04-18 Sandro Santilli <address@hidden>
+
* server/button_character_instance.cpp,
server/parser/button_character_def.{cpp,h}:
Abstract access to button actions, now parser-private.
Index: server/button_character_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/button_character_instance.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -b -r1.94 -r1.95
--- server/button_character_instance.cpp 18 Apr 2008 21:30:54 -0000
1.94
+++ server/button_character_instance.cpp 18 Apr 2008 22:32:57 -0000
1.95
@@ -682,28 +682,12 @@
ranges.add(m_old_invalidated_ranges);
- // TODO: Instead of using these for loops again and again, wouldn't it be a
- // good idea to have a generic "get_record_character()" method?
- // NOTE: we do have that method now, it's called get_active_characters(state)
- for (size_t i = 0; i < m_def->m_button_records.size(); i++)
- {
- button_record& rec = m_def->m_button_records[i];
- assert(m_record_character.size() > i);
- if (m_record_character[i] == NULL)
- {
- continue;
- }
- if ((m_mouse_state == UP && rec.m_up)
- || (m_mouse_state == DOWN && rec.m_down)
- || (m_mouse_state == OVER && rec.m_over))
- {
-
/*bounds->expand_to_transformed_rect(get_world_matrix(),
- m_record_character[i]->get_bound());*/
- m_record_character[i]->add_invalidated_bounds(ranges,
- force||m_invalidated);
- }
- }
-
+ std::vector<character*> actChars;
+ get_active_characters(actChars);
+ std::for_each(actChars.begin(), actChars.end(),
+ boost::bind(&character::add_invalidated_bounds, _1,
+ boost::ref(ranges), force||m_invalidated)
+ );
}
geometry::Range2d<float>
@@ -712,30 +696,20 @@
typedef geometry::Range2d<float> Range;
Range allBounds(geometry::nullRange);
- for (size_t i = 0; i < m_def->m_button_records.size(); i++)
- {
- button_record& rec = m_def->m_button_records[i];
- assert(m_record_character.size() > i);
- character* ch = m_record_character[i].get();
-
- if (!ch) continue;
-
- if ((m_mouse_state == UP && rec.m_up)
- || (m_mouse_state == DOWN && rec.m_down)
- || (m_mouse_state == OVER && rec.m_over))
+ typedef std::vector<character*> CharVect;
+ CharVect actChars;
+
const_cast<button_character_instance*>(this)->get_active_characters(actChars);
+ for(CharVect::iterator i=actChars.begin(),e=actChars.end(); i!=e; ++i)
{
+ const character* ch = *i;
- // TODO: should we consider having multiple characters
- // for a single state ?
+ // Child bounds need be transformed in our coordinate space
Range lclBounds = ch->getBounds();
-
- // TODO: we transform the child bounds here, right ?
matrix m = ch->get_matrix();
m.transform(lclBounds);
allBounds.expandTo(lclBounds);
}
- }
return allBounds;
}
@@ -743,24 +717,15 @@
bool
button_character_instance::pointInShape(float x, float y) const
{
- for (size_t i = 0; i < m_def->m_button_records.size(); i++)
- {
- button_record& rec = m_def->m_button_records[i];
- assert(m_record_character.size() > i);
- if (m_record_character[i] == NULL)
+ typedef std::vector<character*> CharVect;
+ CharVect actChars;
+
const_cast<button_character_instance*>(this)->get_active_characters(actChars);
+ for(CharVect::iterator i=actChars.begin(),e=actChars.end(); i!=e; ++i)
{
- continue;
+ const character* ch = *i;
+ if ( ch->pointInShape(x,y) ) return true;
}
- if ((m_mouse_state == UP && rec.m_up)
- || (m_mouse_state == DOWN && rec.m_down)
- || (m_mouse_state == OVER && rec.m_over))
- {
- // TODO: should we consider having multiple characters
- // for a single state ?
- return m_record_character[i]->pointInShape(x, y);
- }
- }
- return false; // no shape
+ return false;
}
as_object*
Index: testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp
===================================================================
RCS file:
/sources/gnash/gnash/testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp 18 Apr 2008 09:47:55
-0000 1.27
+++ testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp 18 Apr 2008 22:32:57
-0000 1.28
@@ -233,7 +233,7 @@
sprite_instance* root = tester.getRootMovie();
assert(root);
- check_equals(root->get_frame_count(), 6);
+ check_equals(root->get_frame_count(), 7);
check_equals(root->get_current_frame(), 0);
@@ -264,6 +264,13 @@
tester.advance();
check_equals(root->get_current_frame(), 2);
+ tester.advance();
+ check_equals(root->get_current_frame(), 2); // need to roll out
+
+ tester.movePointerTo(60, 60); // roll over the square
+ check_equals(root->get_current_frame(), 2); // need to roll out
+ tester.movePointerTo(0, 0); // roll out, should go to next frame
+ check_equals(root->get_current_frame(), 3);
for (size_t fno=root->get_current_frame(); fno<root->get_frame_count();
fno++)
{
@@ -272,15 +279,15 @@
switch (fno)
{
- case 2:
+ case 3:
check(!square_back);
check(!square_front);
break;
- case 3:
+ case 4:
check(square_back);
check(!square_front);
break;
- case 4:
+ case 5:
check(square_back);
check(square_front);
break;
@@ -300,7 +307,7 @@
// last advance should not restart the loop (it's in STOP mode)
check_equals(root->get_play_state(), sprite_instance::STOP);
- check_equals(root->get_current_frame(), 5);
+ check_equals(root->get_current_frame(), 6);
}
Index: testsuite/misc-ming.all/ButtonEventsTest.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/ButtonEventsTest.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- testsuite/misc-ming.all/ButtonEventsTest.c 18 Apr 2008 16:04:34 -0000
1.15
+++ testsuite/misc-ming.all/ButtonEventsTest.c 18 Apr 2008 22:32:57 -0000
1.16
@@ -340,6 +340,16 @@
"}"
), SWFBUTTON_MOUSEUPOUTSIDE);
+ /* Keypress */
+ SWFButton_addAction(bu, compileSWFActionCode(
+ "_root.note('KeyPress: a');"
+ //"_root.check(Key.isDown('a'));"
+ ), SWFBUTTON_KEYPRESS('a'));
+ SWFButton_addAction(bu, compileSWFActionCode(
+ "_root.note('KeyPress: b');"
+ //"_root.check(Key.isDown('b'));"
+ ), SWFBUTTON_KEYPRESS('b'));
+
it = SWFMovieClip_add(mc, (SWFBlock)bu);
SWFDisplayItem_setName(it, "button");
SWFMovieClip_nextFrame(mc); /* showFrame */
@@ -571,17 +581,36 @@
add_actions(mo,
"stop();"
/*"_root.note('buttonChild is '+dumpObj(_root.buttonChild));"*/
+ "_root.testno=0;"
+ "_root.square1.onRollOut = function() { _root.testno++; delete
_root.square1.onRollOut; nextFrame(); };"
+ "_root.note('"
+ "0. Roll over and out the red square, not touching the small
dark-red square in it."
+ "');");
+
+ /* hitTest should work on every child, not just first added */
+ check(mo, "_level0.square1.hitTest(60,60,true)");
+
+ SWFMovie_nextFrame(mo); /* showFrame */
+
+ /*****************************************************
+ *
+ * On third frame, start the button event test
+ *
+ *****************************************************/
+
+ add_actions(mo,
+ "stop();"
+ /*"_root.note('buttonChild is '+dumpObj(_root.buttonChild));"*/
"_root.testno=1;"
"_root.note('"
"1. Roll over the red square."
"');");
-
SWFMovie_nextFrame(mo); /* showFrame */
/*****************************************************
*
- * On third frame, add a shape at lower depth,
+ * On fourth frame, add a shape at lower depth,
* and check bounds of square1
*
*
@@ -640,7 +669,7 @@
/*****************************************************
*
- * On fourth frame, add a shape at higher depth
+ * On fifth frame, add a shape at higher depth
*
*****************************************************/
@@ -694,7 +723,7 @@
/*****************************************************
*
- * On fifth frame, disable the button
+ * On sixth frame, disable the button
* and check total tests so far
*
*****************************************************/
@@ -704,7 +733,7 @@
add_actions(mo,
"square1.button.enabled = false;"
"stop();"
- "_root.totals(155);"
+ "_root.totals(156);"
"_root.note('-- Button disabled, try playing with it,
nothing should happen --');"
);
SWFMovie_nextFrame(mo); /* showFrame */
- [Gnash-commit] gnash ChangeLog server/button_character_instanc..., Sandro Santilli, 2008/04/12
- [Gnash-commit] gnash ChangeLog server/button_character_instanc..., Sandro Santilli, 2008/04/15
- [Gnash-commit] gnash ChangeLog server/button_character_instanc..., Sandro Santilli, 2008/04/15
- [Gnash-commit] gnash ChangeLog server/button_character_instanc..., Sandro Santilli, 2008/04/15
- [Gnash-commit] gnash ChangeLog server/button_character_instanc..., Sandro Santilli, 2008/04/16
- [Gnash-commit] gnash ChangeLog server/button_character_instanc..., Sandro Santilli, 2008/04/18
- [Gnash-commit] gnash ChangeLog server/button_character_instanc..., Sandro Santilli, 2008/04/18
- [Gnash-commit] gnash ChangeLog server/button_character_instanc...,
Sandro Santilli <=
- [Gnash-commit] gnash ChangeLog server/button_character_instanc..., Sandro Santilli, 2008/04/18
- [Gnash-commit] gnash ChangeLog server/button_character_instanc..., Sandro Santilli, 2008/04/19
- [Gnash-commit] gnash ChangeLog server/button_character_instanc..., Sandro Santilli, 2008/04/19
- [Gnash-commit] gnash ChangeLog server/button_character_instanc..., Sandro Santilli, 2008/04/22
- [Gnash-commit] gnash ChangeLog server/button_character_instanc..., Sandro Santilli, 2008/04/22