Add automated tests on function-type FSCommand parameter passing.
[gnash.git] / testsuite / libcore.all / DisplayListTest.cpp
blobdcc632859018d57a070bb98e4984190b2a421e54
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.
14 //
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
19 #ifdef HAVE_CONFIG_H
20 #include "gnashconfig.h"
21 #endif
23 #include "DisplayList.h"
24 #include "movie_root.h"
25 #include "as_value.h"
26 #include "DisplayObject.h"
27 #include "log.h"
28 #include "VM.h"
29 #include "DummyMovieDefinition.h"
30 #include "DummyCharacter.h"
31 #include "movie_definition.h"
32 #include "ManualClock.h"
33 #include "RunResources.h"
34 #include "StreamProvider.h"
36 #include <iostream>
37 #include <sstream>
38 #include <cassert>
39 #include <string>
41 #include "check.h"
43 using namespace std;
44 using namespace gnash;
46 TRYMAIN(_runtest);
47 int
48 trymain(int /*argc*/, char** /*argv*/)
50 gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
51 dbglogfile.setVerbosity();
53 // Initialize gnash lib
55 RunResources ri;
56 const URL url("");
57 ri.setStreamProvider(
58 std::shared_ptr<StreamProvider>(new StreamProvider(url, url)));
60 // Initialize a VM
61 boost::intrusive_ptr<movie_definition> md5(new DummyMovieDefinition(ri, 5));
62 boost::intrusive_ptr<movie_definition> md6(new DummyMovieDefinition(ri, 6));
64 ManualClock clock;
65 movie_root stage(clock, ri);
67 MovieClip::MovieVariables v;
68 stage.init(md5.get(), v);
70 DisplayList dlist1;
72 check_equals(dlist1, dlist1);
74 DisplayList dlist2 = dlist1;
76 check_equals(dlist1, dlist2);
78 MovieClip* root = const_cast<Movie*>(&stage.getRootMovie());
80 // just a couple of DisplayObjects
81 as_object* ob1 = createObject(getGlobal(*getObject(root)));
82 as_object* ob2 = createObject(getGlobal(*getObject(root)));
84 DisplayObject* ch1 ( new DummyCharacter(ob1, root) );
85 DisplayObject* ch2 ( new DummyCharacter(ob2, root) );
87 dlist1.placeDisplayObject(ch1, 1);
88 dlist1.placeDisplayObject(ch2, 2);
90 check(dlist1 != dlist2);
92 dlist2.placeDisplayObject(ch2, 1);
93 dlist2.placeDisplayObject(ch1, 2);
95 return 0;