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 "tic_tac2.swf"
24 #include "MovieTester.h"
25 #include "MovieClip.h"
27 #include "DisplayObject.h"
28 #include "DisplayList.h"
31 #include "TextField.h"
38 using namespace gnash
;
43 trymain(int /*argc*/, char** /*argv*/)
45 string filename
= string(SRCDIR
) + string("/") + string(INPUT_FILENAME
);
46 MovieTester
tester(filename
);
48 gnash::LogFile
& dbglogfile
= gnash::LogFile::getDefaultInstance();
49 dbglogfile
.setVerbosity(1);
51 const MovieClip
* root
= tester
.getRootMovie();
54 check_equals(root
->get_frame_count(), 10);
55 check_equals(root
->get_current_frame(), 0);
57 const MovieClip
* slides
= dynamic_cast<const MovieClip
*>(
58 tester
.findDisplayItemByTarget("_level0.slides"));
61 const Button
* button
= dynamic_cast<const Button
*>(
62 tester
.findDisplayItemByTarget("_level0.b1"));
66 check_equals(root
->get_current_frame(), 1);
67 check_equals(slides
->get_current_frame(), 0);
69 // Not much happens w/out clicking on the play button
70 for (int i
=0; i
<10; ++i
) tester
.advance();
71 check_equals(root
->get_current_frame(), 1);
72 check_equals(slides
->get_current_frame(), 0);
75 tester
.movePointerTo(395, 301); tester
.click();
76 check_equals(root
->get_current_frame(), 1);
77 check_equals(slides
->get_current_frame(), 0);
79 for (unsigned int i
=0; i
<3; ++i
) {
80 std::stringstream s
; s
<< "iteration " << i
;
82 check_equals_label(s
.str(), root
->get_current_frame(), 2+i
);
83 check_equals_label(s
.str(), slides
->get_current_frame(), 0);
87 // Tweak initial offset (dunno based on what really)
88 tester
.advanceClock(1000);
89 tester
.advance(false);
90 check_equals(root
->get_current_frame(), 4);
91 check_equals(slides
->get_current_frame(), 0);
93 for (unsigned int i
=0; i
<12; ++i
) {
94 tester
.advanceClock(1000);
95 tester
.advance(false);
96 std::stringstream s
; s
<< "i" << i
;
97 check_equals_label(s
.str(), slides
->get_current_frame(), i
);
98 // TODO: check invalidated bounds!
101 check_equals(slides
->get_current_frame(), 11);
102 check_equals(root
->get_current_frame(), 4);
105 for (int i
=0; i
<10; ++i
) tester
.advance();
106 check_equals(slides
->get_current_frame(), 11);
107 check_equals(root
->get_current_frame(), 4);