[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/testsuite/misc-ming.all masks_test.c mask...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash/testsuite/misc-ming.all masks_test.c mask... |
Date: |
Mon, 21 Jan 2008 11:43:55 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/01/21 11:43:54
Modified files:
testsuite/misc-ming.all: masks_test.c masks_testrunner.cpp
Log message:
Add tests for mouse events effects on hitTest
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/masks_test.c?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/masks_testrunner.cpp?cvsroot=gnash&r1=1.14&r2=1.15
Patches:
Index: masks_test.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/masks_test.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- masks_test.c 21 Jan 2008 10:20:43 -0000 1.8
+++ masks_test.c 21 Jan 2008 11:43:54 -0000 1.9
@@ -464,10 +464,69 @@
check(mo, "!dynamicmc5.hitTest(240, 310, true)");
check(mo, "!dynamicmc5.hitTest(280, 350, true)");
- add_actions(mo, "_root.totals(134); stop();");
+ add_actions(mo,
+ "note(' - Press any key to continue -');"
+ "stop();"
+ );
SWFMovie_nextFrame(mo);
+ add_actions(mo,
+ "var clips = [staticmc2, staticmc3, staticmc4, staticmc5,
dynamicmc2, dynamicmc3, dynamicmc4, dynamicmc5];"
+ "for (i=0; i<clips.length; ++i) {"
+ " clips[i].onRollOver = function() { this._alpha = 50; };"
+ " clips[i].onRollOut = function() { this._alpha = 100; };"
+ "}"
+ "note('Made all characters mouse-sensitive');"
+ );
+
+ // Red rect is a mask, but has mouse events !
+ xcheck(mo, "staticmc2.hitTest(10, 210, true)");
+ xcheck(mo, "staticmc2.hitTest(50, 250, true)");
+
+ // Yellow rect is now masked by Red rect
+ // Yellow rect (staticmc3) is at 30,200-90,260
+ // Red rect (staticmc2) is at 0,200-60,260
+ // Intersection is 30,200-60,260
+ check(mo, "staticmc3.hitTest(40, 210, true)");
+ check(mo, "!staticmc3.hitTest(80, 250, true)"); // out of masked area
+ check(mo, "staticmc3.hitTest(80, 250, false)");
+
+ // Green rect is now masked by Cyan
+ // Green rect (staticmc4) is at 200,200-260,260
+ // Cyan rect (staticmc5) is at 230,200-290,260
+ // Intersection is 230,200-260,260
+ check(mo, "!staticmc4.hitTest(210, 210, true)"); // out of masked area
+ check(mo, "staticmc4.hitTest(250, 250, true)");
+ check(mo, "staticmc4.hitTest(210, 210, false)");
+
+ // Cyan rect is a mask but has mouse events !
+ xcheck(mo, "staticmc5.hitTest(240, 210, true)");
+ xcheck(mo, "staticmc5.hitTest(280, 250, true)");
+
+ // Blue rect is a mask but has mouse events !
+ xcheck(mo, "dynamicmc2.hitTest(10, 310, true)");
+ xcheck(mo, "dynamicmc2.hitTest(50, 350, true)");
+
+ // Violet rect is now masked by Blue rect
+ check(mo, "dynamicmc3.hitTest(40, 310, true)");
+ check(mo, "!dynamicmc3.hitTest(80, 350, true)");
+ check(mo, "dynamicmc3.hitTest(80, 350, false)");
+
+ // Dark green rect is masked by Light blue
+ check(mo, "!dynamicmc4.hitTest(210, 310, true)");
+ check(mo, "dynamicmc4.hitTest(210, 310, false)");
+ check(mo, "dynamicmc4.hitTest(250, 350, true)");
+
+ // Light blue is a mask but has mouse events !
+ xcheck(mo, "dynamicmc5.hitTest(240, 310, true)");
+ xcheck(mo, "dynamicmc5.hitTest(280, 350, true)");
+
+ add_actions(mo, "_root.totals(154); stop();");
+
+ SWFMovie_nextFrame(mo);
+
+
// TODO:
// - test mask layers !!
Index: masks_testrunner.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/masks_testrunner.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- masks_testrunner.cpp 21 Jan 2008 10:20:43 -0000 1.14
+++ masks_testrunner.cpp 21 Jan 2008 11:43:54 -0000 1.15
@@ -51,7 +51,7 @@
// FRAME 1 (start)
- check_equals(root->get_frame_count(), 5);
+ check_equals(root->get_frame_count(), 6);
check_equals(root->get_play_state(), sprite_instance::PLAY);
check_equals(root->get_current_frame(), 0);
check_equals(root->getDisplayList().size(), 1); // dejagnu clip
@@ -227,7 +227,51 @@
tester.advance();
check_equals(root->get_current_frame(), 4); // 0-based
- // TODO: test setMask effects after swapping mask/maskee
+ // 14,232 = white (yellow not covered by its red mask)
+ check( invalidated.contains(14, 232) );
+ check_pixel(14,232, 2, white, 2);
+ // 48,232 = yellow (visible in the red mask)
+ check( invalidated.contains(48, 232) );
+ check_pixel(48,232, 2, yellow, 2);
+ // 80,232 = white (yellow not covered by its red mask)
+ check( invalidated.contains(80, 232) );
+ check_pixel(80,232, 2, white, 2);
+
+ // 214,232 = white (green not covered by its cyan mask)
+ check( invalidated.contains(214, 232) );
+ check_pixel(214,232, 2, white, 2);
+ // 248,232 = green (visible in its cyan mask)
+ check( invalidated.contains(248, 232) );
+ check_pixel(248,232, 2, green, 2);
+ // 276,232 = white (green not covered by its cyan mask)
+ check( invalidated.contains(276, 232) );
+ check_pixel(276,232, 2, white, 2);
+
+ // 14,331 = white (violet not covered by its blue mask)
+ check( invalidated.contains(14, 331) );
+ check_pixel(14,331, 2, white, 2);
+ // 48,331 = violet (visible in its blue mask)
+ check( invalidated.contains(48, 331) );
+ check_pixel(48,331, 2, violet, 2);
+ // 80,331 = white (violet not covered by its blue mask)
+ check( invalidated.contains(80, 331) );
+ check_pixel(80,331, 2, white, 2);
+
+ // 214,331 = white (dark_green not covered by its light_blue mask)
+ check( invalidated.contains(214, 331) );
+ check_pixel(214,331, 2, white, 2);
+ // 248,331 = dark_green (visible in its light_blue mask)
+ check( invalidated.contains(248, 331) );
+ check_pixel(248,331, 2, dark_green, 2);
+ // 276,331 = white (dark_green not covered by its light_blue mask)
+ check( invalidated.contains(276, 331) );
+ check_pixel(276,331, 2, white, 2);
+
+ // FRAME 6
+ tester.pressKey(gnash::key::ENTER);
+ tester.releaseKey(gnash::key::ENTER);
+ tester.advance();
+ check_equals(root->get_current_frame(), 5); // 0-based
// 14,232 = white (yellow not covered by its red mask)
check( invalidated.contains(14, 232) );
@@ -269,5 +313,6 @@
check( invalidated.contains(276, 331) );
check_pixel(276,331, 2, white, 2);
+ // TODO: test effects of rollOver/rollOut events here
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash/testsuite/misc-ming.all masks_test.c mask...,
Sandro Santilli <=