Add parameter type tests on getURL()-based FSCommand.
[gnash.git] / testsuite / movies.all / tic_tac2-TestRunner.cpp
blob7013d8100bd141483c72aa3ba9f65447b0aacdaf
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 "tic_tac2.swf"
24 #include "MovieTester.h"
25 #include "MovieClip.h"
26 #include "Button.h"
27 #include "DisplayObject.h"
28 #include "DisplayList.h"
29 #include "log.h"
30 #include "VM.h"
31 #include "TextField.h"
33 #include "check.h"
34 #include <string>
35 #include <cassert>
36 #include <sstream>
38 using namespace gnash;
39 using namespace std;
41 TRYMAIN(_runtest);
42 int
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();
52 assert(root);
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"));
59 check(slides);
61 const Button* button = dynamic_cast<const Button*>(
62 tester.findDisplayItemByTarget("_level0.b1"));
63 check(button);
65 tester.advance();
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);
74 // Should start now
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;
81 tester.advance();
82 check_equals_label(s.str(), root->get_current_frame(), 2+i);
83 check_equals_label(s.str(), slides->get_current_frame(), 0);
86 #if USE_SOUND
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);
104 // It's stuck there
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);
108 #endif // USE_SOUND
110 return 0;