Add automated tests on function-type FSCommand parameter passing.
[gnash.git] / testsuite / misc-ming.all / PrototypeEventListenersTestRunner.cpp
blob0d53ff9c13aa2ee06f45a7876357a76ff820304d
1 /*
2 * Copyright (C) 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 "PrototypeEventListeners.swf"
24 #include "MovieTester.h"
25 #include "MovieClip.h"
26 #include "DisplayObject.h"
27 #include "DisplayList.h"
28 #include "log.h"
29 #include "VM.h"
30 #include "string_table.h"
31 #include "GnashKey.h" // gnash::key::code
33 #include "check.h"
34 #include <string>
35 #include <cassert>
36 #include <sstream>
38 using namespace gnash;
39 using namespace gnash::geometry;
40 using namespace std;
42 TRYMAIN(_runtest);
43 int
44 trymain(int /*argc*/, char** /*argv*/)
46 string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
47 MovieTester tester(filename);
49 gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
50 dbglogfile.setVerbosity(1);
52 MovieClip* root = tester.getRootMovie();
53 assert(root);
55 // for variables lookup (consistency checking)
56 VM& vm = getVM(*getObject(root));
58 check_equals(root->get_frame_count(), 2);
59 check_equals(root->get_current_frame(), 0);
61 // first frame is just Dejagnu clip...
62 tester.advance();
64 check_equals(root->get_current_frame(), 1);
66 tester.pressKey(gnash::key::A); // Should do nothing.
68 tester.click();
70 tester.click();
72 tester.pressKey(gnash::key::A);
74 // Consistency check !!
75 as_value eot;
76 // It's an swf6, so lowercase 'ENDOFTEST'
77 bool endOfTestFound = getObject(root)->get_member(getURI(vm, "endoftest"), &eot);
78 check(endOfTestFound);
80 if ( endOfTestFound )
82 cerr << eot << endl;
83 check_equals(eot.to_bool(8), true);
85 else
87 cerr << "Didn't find ENDOFTEST... dumping all members" << endl;
88 // root->dump_members();
91 return 0;