Add automated tests on function-type FSCommand parameter passing.
[gnash.git] / testsuite / misc-ming.all / root_stop_testrunner.cpp
blobc9248b4fdcc59266d3073de1d728a25f239c75a9
1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 * Free Software Foundation, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
22 #define INPUT_FILENAME "root_stop_test.swf"
24 #define HAVE_CONFIG_H 1
26 #include "MovieTester.h"
27 #include "MovieClip.h"
28 #include "DisplayObject.h"
29 #include "DisplayList.h"
30 #include "log.h"
32 #include "check.h"
33 #include <string>
34 #include <cassert>
36 using namespace gnash;
37 using namespace std;
39 TRYMAIN(_runtest);
40 int
41 trymain(int /*argc*/, char** /*argv*/)
43 string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
44 MovieTester tester(filename);
46 MovieClip* root = tester.getRootMovie();
47 assert(root);
49 check_equals(root->get_frame_count(), 2);
50 check_equals(root->get_current_frame(), 0);
51 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
53 const DisplayObject* ch = tester.findDisplayItemByName(*root, "mc_in_root");
54 check(ch);
55 const MovieClip* mc = dynamic_cast<const MovieClip*>(ch);
56 check(mc);
57 check_equals(mc->get_current_frame(), 0);
58 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
60 tester.advance();
61 check_equals(root->get_current_frame(), 0); // we were in stop mode
62 check_equals(mc->get_current_frame(), 1);
63 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
64 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
66 tester.advance();
67 check_equals(root->get_current_frame(), 0); // we were in stop mode
68 check_equals(mc->get_current_frame(), 2);
69 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
70 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
72 tester.advance();
73 check_equals(root->get_current_frame(), 0); // we were in stop mode
74 check_equals(mc->get_current_frame(), 0);
75 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
76 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
78 tester.advance();
79 check_equals(root->get_current_frame(), 1);
80 check_equals(mc->get_current_frame(), 1);
81 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
82 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
84 tester.advance();
85 check_equals(root->get_current_frame(), 0); // looped
86 check_equals(mc->get_current_frame(), 2);
87 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
88 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
90 tester.advance();
91 check_equals(root->get_current_frame(), 1);
92 check_equals(mc->get_current_frame(), 0);
93 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
94 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
96 tester.advance();
97 check_equals(root->get_current_frame(), 0); // looped again
98 check_equals(mc->get_current_frame(), 1);
99 check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
100 check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
102 return 0;