big merge from master, fix rpm creation, drop fetching swfdec
[gnash.git] / testsuite / misc-ming.all / NetStream-SquareTestRunner.cpp
blobc7409742e86464611a8e5a7e653efe48f8ed9d80
1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
3 *
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.
8 *
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
19 */
21 #define INPUT_FILENAME "NetStream-SquareTest.swf"
23 #include "MovieTester.h"
24 #include "VM.h"
25 #include "string_table.h"
26 #include "MovieClip.h"
27 #include "DisplayObject.h"
28 #include "DisplayList.h"
29 #include "log.h"
30 #include "GnashSleep.h"
32 #include "check.h"
33 #include <string>
34 #include <cassert>
35 #include "GnashSystemIOHeaders.h"
37 using namespace gnash;
38 using namespace std;
40 int
41 main(int /*argc*/, char** /*argv*/)
43 string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
44 MovieTester tester(filename);
46 gnash::RcInitFile& rc = gnash::RcInitFile::getDefaultInstance();
47 rc.addLocalSandboxPath(MEDIADIR);
49 gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
50 dbglogfile.setVerbosity(1);
52 MovieClip* root = tester.getRootMovie();
53 assert(root);
55 if ( ! tester.canTestVideo() )
57 cout << "UNTESTED: NetStream video (not supported by this build)."
58 << endl;
59 return EXIT_SUCCESS;
62 // On NetStatus.Play.Stop we jump to last frame and stop,
63 // so this loop is about equivalent to running a
64 // generic self-contained test.
66 // When all possible tests are implemented as self-contained, we'll
67 // add tests that can't be self-contained.
69 VM& vm = tester.vm();
71 const ObjectURI& k = getURI(vm, "startNotified");
72 as_value tmp;
73 while (!getObject(root)->get_member(k, &tmp) )
75 tester.advance();
77 // sleep to give the NetStream a chance to load
78 // data and trigger notifications
79 // needs more analisys to find a good way for doing this..
80 gnashSleep(10000); // 10 milliseconds should be enough for loading
83 cout << "Pressing space" << endl;
84 tester.pressKey(key::SPACE);
85 tester.releaseKey(key::SPACE);
87 while (root->get_current_frame() < 2)
89 tester.advance();
91 // sleep to give the NetStream a chance to
92 // load data and trigger notifications
93 // needs more analisys to find a good way for doing this..
94 gnashSleep(10000); // 10 milliseconds should be enough for loading
97 // Consistency check
98 as_value eot;
99 bool endOfTestFound = getObject(root)->get_member(getURI(vm, "end_of_test"),
100 &eot);
101 check(endOfTestFound);