2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #define INPUT_FILENAME "RollOverOutTest.swf"
23 #include "MovieTester.h"
24 #include "MovieClip.h"
25 #include "DisplayObject.h"
26 #include "DisplayList.h"
33 using namespace gnash
;
37 main(int /*argc*/, char** /*argv*/)
39 string filename
= string(TGTDIR
) + string("/") + string(INPUT_FILENAME
);
40 MovieTester
tester(filename
);
42 gnash::LogFile
& dbglogfile
= gnash::LogFile::getDefaultInstance();
43 dbglogfile
.setVerbosity(1);
45 MovieClip
* root
= tester
.getRootMovie();
48 check_equals(root
->get_frame_count(), 4);
49 check_equals(root
->getPlayState(), MovieClip::PLAYSTATE_PLAY
);
50 check_equals(root
->get_current_frame(), 0);
52 tester
.advance(); // advance to the second frame.
54 const DisplayObject
* mc1
= tester
.findDisplayItemByName(*root
, "square1");
56 const DisplayObject
* mc2
= tester
.findDisplayItemByName(*root
, "square2");
59 check_equals(mc1
->visible(), true);
60 check_equals(mc2
->visible(), false);
61 check_equals(root
->getPlayState(), MovieClip::PLAYSTATE_STOP
);
62 check_equals(root
->get_current_frame(), 1);
64 // we're in stop mode, so advance should not advance anything
66 check_equals(root
->get_current_frame(), 1);
68 check_equals(root
->get_current_frame(), 1);
70 // roll over the middle of the square, this should trigger
71 // the addition of a goto_frame(3) action, which is executed
73 tester
.movePointerTo(60, 60);
75 check_equals(root
->get_current_frame(), 2);
76 check_equals(root
->getPlayState(), MovieClip::PLAYSTATE_STOP
);
78 check_equals(root
->get_current_frame(), 2);
80 // keep the pointer inside
81 tester
.movePointerTo(41, 60);
83 check_equals(root
->get_current_frame(), 2);
85 // pointer on the border (corner case)
86 tester
.movePointerTo(40, 60);
88 check_equals(root
->get_current_frame(), 2);
90 // pointer out of the square.
91 tester
.movePointerTo(300, 60);
92 //tester.advance(); // mouse event handler should drive the movie
93 check_equals(root
->get_current_frame(), 1);
95 // pointer back to the square again.
96 tester
.movePointerTo(60, 60);
98 //tester.advance(); // mouse event handler should drive the movie
99 check_equals(root
->get_current_frame(), 3);