big merge from master, fix rpm creation, drop fetching swfdec
[gnash.git] / testsuite / misc-ming.all / RollOverOutTest-Runner.cpp
blobe8f142894b9009c2db9cfa310f53628a19dece6c
1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
3 *
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.
8 *
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
19 */
21 #define INPUT_FILENAME "RollOverOutTest.swf"
23 #include "MovieTester.h"
24 #include "MovieClip.h"
25 #include "DisplayObject.h"
26 #include "DisplayList.h"
27 #include "log.h"
29 #include "check.h"
30 #include <string>
31 #include <cassert>
33 using namespace gnash;
34 using namespace std;
36 int
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();
46 assert(root);
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");
55 check(mc1);
56 const DisplayObject* mc2 = tester.findDisplayItemByName(*root, "square2");
57 check(mc2);
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
65 tester.advance();
66 check_equals(root->get_current_frame(), 1);
67 tester.advance();
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
72 // at advance() time.
73 tester.movePointerTo(60, 60);
74 tester.advance();
75 check_equals(root->get_current_frame(), 2);
76 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
77 tester.advance();
78 check_equals(root->get_current_frame(), 2);
80 // keep the pointer inside
81 tester.movePointerTo(41, 60);
82 tester.advance();
83 check_equals(root->get_current_frame(), 2);
85 // pointer on the border (corner case)
86 tester.movePointerTo(40, 60);
87 tester.advance();
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);
97 tester.click();
98 //tester.advance(); // mouse event handler should drive the movie
99 check_equals(root->get_current_frame(), 3);