Update with current status
[gnash.git] / testsuite / misc-ming.all / NetStream-SquareTestRunner.cpp
bloba2220533f956c9c5dc6d559f597511f89a3d98f5
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 "NetStream-SquareTest.swf"
24 #include "MovieTester.h"
25 #include "VM.h"
26 #include "string_table.h"
27 #include "MovieClip.h"
28 #include "DisplayObject.h"
29 #include "DisplayList.h"
30 #include "log.h"
31 #include "GnashSleep.h"
33 #include "check.h"
34 #include <string>
35 #include <cassert>
36 #include "GnashSystemIOHeaders.h"
38 using namespace gnash;
39 using namespace std;
41 TRYMAIN(_runtest);
42 int
43 trymain(int /*argc*/, char** /*argv*/)
45 string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
46 MovieTester tester(filename);
48 gnash::RcInitFile& rc = gnash::RcInitFile::getDefaultInstance();
49 rc.addLocalSandboxPath(MEDIADIR);
51 gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
52 dbglogfile.setVerbosity(1);
54 MovieClip* root = tester.getRootMovie();
55 assert(root);
57 if ( ! tester.canTestVideo() )
59 cout << "UNTESTED: NetStream video (not supported by this build)."
60 << endl;
61 return EXIT_SUCCESS;
64 // On NetStatus.Play.Stop we jump to last frame and stop,
65 // so this loop is about equivalent to running a
66 // generic self-contained test.
68 // When all possible tests are implemented as self-contained, we'll
69 // add tests that can't be self-contained.
71 VM& vm = tester.vm();
73 const ObjectURI& k = getURI(vm, "startNotified");
74 as_value tmp;
75 while (!getObject(root)->get_member(k, &tmp) )
77 tester.advance();
79 // sleep to give the NetStream a chance to load
80 // data and trigger notifications
81 // needs more analisys to find a good way for doing this..
82 gnashSleep(10000); // 10 milliseconds should be enough for loading
85 cout << "Pressing space" << endl;
86 tester.pressKey(key::SPACE);
87 tester.releaseKey(key::SPACE);
89 while (root->get_current_frame() < 2)
91 tester.advance();
93 // sleep to give the NetStream a chance to
94 // load data and trigger notifications
95 // needs more analisys to find a good way for doing this..
96 gnashSleep(10000); // 10 milliseconds should be enough for loading
99 // Consistency check
100 as_value eot;
101 bool endOfTestFound = getObject(root)->get_member(getURI(vm, "end_of_test"),
102 &eot);
103 check(endOfTestFound);
105 return 0;