2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 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 "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"
35 using namespace gnash
;
39 main(int /*argc*/, char** /*argv*/)
41 string filename
= string(TGTDIR
) + string("/") + string(INPUT_FILENAME
);
42 MovieTester
tester(filename
);
44 MovieClip
* root
= tester
.getRootMovie();
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");
53 const MovieClip
* mc
= dynamic_cast<const MovieClip
*>(ch
);
55 check_equals(mc
->get_current_frame(), 0);
56 check_equals(mc
->getPlayState(), MovieClip::PLAYSTATE_PLAY
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);