big merge from master, fix rpm creation, drop fetching swfdec
[gnash.git] / testsuite / libcore.all / DisplayListTest.cpp
blob807ecbe68fd0c09d2f51c3f31dc431464957d433
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.
13 //
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
18 #ifdef HAVE_CONFIG_H
19 #include "gnashconfig.h"
20 #endif
22 #include "DisplayList.h"
23 #include "movie_root.h"
24 #include "as_value.h"
25 #include "DisplayObject.h"
26 #include "log.h"
27 #include "VM.h"
28 #include "DummyMovieDefinition.h"
29 #include "DummyCharacter.h"
30 #include "movie_definition.h"
31 #include "ManualClock.h"
32 #include "RunResources.h"
33 #include "StreamProvider.h"
35 #include <iostream>
36 #include <sstream>
37 #include <cassert>
38 #include <string>
40 #include "check.h"
42 using namespace std;
43 using namespace gnash;
45 int
46 main(int /*argc*/, char** /*argv*/)
48 gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
49 dbglogfile.setVerbosity();
51 // Initialize gnash lib
53 RunResources ri;
54 const URL url("");
55 ri.setStreamProvider(
56 boost::shared_ptr<StreamProvider>(new StreamProvider(url, url)));
58 // Initialize a VM
59 boost::intrusive_ptr<movie_definition> md5(new DummyMovieDefinition(ri, 5));
60 boost::intrusive_ptr<movie_definition> md6(new DummyMovieDefinition(ri, 6));
62 ManualClock clock;
63 movie_root stage(*md5, clock, ri);
65 MovieClip::MovieVariables v;
66 stage.init(md5.get(), v);
68 DisplayList dlist1;
70 check_equals(dlist1, dlist1);
72 DisplayList dlist2 = dlist1;
74 check_equals(dlist1, dlist2);
76 MovieClip* root = const_cast<Movie*>(&stage.getRootMovie());
78 // just a couple of DisplayObjects
79 as_object* ob1 = createObject(getGlobal(*getObject(root)));
80 as_object* ob2 = createObject(getGlobal(*getObject(root)));
82 DisplayObject* ch1 ( new DummyCharacter(ob1, root) );
83 DisplayObject* ch2 ( new DummyCharacter(ob2, root) );
85 dlist1.placeDisplayObject(ch1, 1);
86 dlist1.placeDisplayObject(ch2, 2);
88 check(dlist1 != dlist2);
90 dlist2.placeDisplayObject(ch2, 1);
91 dlist2.placeDisplayObject(ch1, 2);