Merge branch 'master' of git.sv.gnu.org:/srv/git/gnash
[gnash.git] / testsuite / misc-ming.all / root_stop_testrunner.cpp
blobfbcc53d693da94fbda8b1245e3d34af419eca63f
1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 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 "root_stop_test.swf"
23 #define HAVE_CONFIG_H 1
25 #include "MovieTester.h"
26 #include "MovieClip.h"
27 #include "DisplayObject.h"
28 #include "DisplayList.h"
29 #include "log.h"
31 #include "check.h"
32 #include <string>
33 #include <cassert>
35 using namespace gnash;
36 using namespace std;
38 int
39 main(int /*argc*/, char** /*argv*/)
41 string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
42 MovieTester tester(filename);
44 MovieClip* root = tester.getRootMovie();
45 assert(root);
47 check_equals(root->get_frame_count(), 2);
48 check_equals(root->get_current_frame(), 0);
49 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
51 const DisplayObject* ch = tester.findDisplayItemByName(*root, "mc_in_root");
52 check(ch);
53 const MovieClip* mc = dynamic_cast<const MovieClip*>(ch);
54 check(mc);
55 check_equals(mc->get_current_frame(), 0);
56 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
58 tester.advance();
59 check_equals(root->get_current_frame(), 0); // we were in stop mode
60 check_equals(mc->get_current_frame(), 1);
61 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
62 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
64 tester.advance();
65 check_equals(root->get_current_frame(), 0); // we were in stop mode
66 check_equals(mc->get_current_frame(), 2);
67 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
68 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
70 tester.advance();
71 check_equals(root->get_current_frame(), 0); // we were in stop mode
72 check_equals(mc->get_current_frame(), 0);
73 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
74 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
76 tester.advance();
77 check_equals(root->get_current_frame(), 1);
78 check_equals(mc->get_current_frame(), 1);
79 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
80 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
82 tester.advance();
83 check_equals(root->get_current_frame(), 0); // looped
84 check_equals(mc->get_current_frame(), 2);
85 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
86 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
88 tester.advance();
89 check_equals(root->get_current_frame(), 1);
90 check_equals(mc->get_current_frame(), 0);
91 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
92 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
94 tester.advance();
95 check_equals(root->get_current_frame(), 0); // looped again
96 check_equals(mc->get_current_frame(), 1);
97 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
98 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
100 return 0;