2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 * Free Software Foundation, Inc.
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.
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
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"
36 using namespace gnash
;
41 trymain(int /*argc*/, char** /*argv*/)
43 string filename
= string(TGTDIR
) + string("/") + string(INPUT_FILENAME
);
44 MovieTester
tester(filename
);
46 MovieClip
* root
= tester
.getRootMovie();
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");
55 const MovieClip
* mc
= dynamic_cast<const MovieClip
*>(ch
);
57 check_equals(mc
->get_current_frame(), 0);
58 check_equals(mc
->getPlayState(), MovieClip::PLAYSTATE_PLAY
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);