gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/dlist.cpp server/dlist.h...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/dlist.cpp server/dlist.h...
Date: Wed, 28 Feb 2007 14:10:26 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/02/28 14:10:26

Modified files:
        .              : ChangeLog 
        server         : dlist.cpp dlist.h 
        testsuite      : Makefile.am 
        testsuite/server: Makefile.am 
Added files:
        testsuite      : DummyCharacter.h 
        testsuite/server: DisplayListTest.cpp 

Log message:
                * testsuite/: Makefile.am, DummyCharacter.h:
                  Dummy character instance for use in test cases.
                * testsuite/server/: Makefile.am, DisplayListTest.cpp:
                  Initial test for DisplayList (just tests equality
                  and inequality operators).
                * server/dlist.{cpp,h}: Add equality, inequality
                  and output operators.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2496&r2=1.2497
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.49&r2=1.50
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.h?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/Makefile.am?cvsroot=gnash&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/DummyCharacter.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/server/Makefile.am?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/server/DisplayListTest.cpp?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2496
retrieving revision 1.2497
diff -u -b -r1.2496 -r1.2497
--- ChangeLog   28 Feb 2007 13:00:04 -0000      1.2496
+++ ChangeLog   28 Feb 2007 14:10:25 -0000      1.2497
@@ -1,5 +1,15 @@
 2007-02-28 Sandro Santilli <address@hidden>
 
+       * testsuite/: Makefile.am, DummyCharacter.h:
+         Dummy character instance for use in test cases.
+       * testsuite/server/: Makefile.am, DisplayListTest.cpp:
+         Initial test for DisplayList (just tests equality
+         and inequality operators).
+       * server/dlist.{cpp,h}: Add equality, inequality
+         and output operators.
+
+2007-02-28 Sandro Santilli <address@hidden>
+
        * server/array.cpp: use builtin_method for builtin
          methods :) ensure the 'this' pointer passed
          to builtin methods is valid.

Index: server/dlist.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- server/dlist.cpp    16 Feb 2007 12:27:27 -0000      1.49
+++ server/dlist.cpp    28 Feb 2007 14:10:25 -0000      1.50
@@ -199,13 +199,13 @@
 
        if ( it == _characters.end() || (*it)->get_depth() != depth )
        {
-               //IF_VERBOSE_DEBUG(dbglogfile << "This is a new character" << 
std::endl );
+               //log_msg("place_character: new character at depth %d", depth);
                // add the new char
                _characters.insert(it, DisplayItem(ch));
        }
        else
        {
-               //IF_VERBOSE_DEBUG(dbglogfile << "Replacing existing character" 
<< std::endl );
+               //log_msg("place_character: replacing existing character at 
depth %d", depth);
                // replace existing char
                *it = DisplayItem(ch);
        }
@@ -731,6 +731,23 @@
        _characters.sort(DisplayItemDepthLess());
 }
 
+std::ostream& operator<< (std::ostream& os, const DisplayList& dl)
+{
+       for (DisplayList::const_iterator it = dl._characters.begin(),
+                       itEnd = dl._characters.end();
+                       it != itEnd;
+                       ++it)
+       {
+               const DisplayItem& item = *it; 
+               if ( it != dl._characters.begin() ) os << " | ";
+               os << "Character id:" << item->get_id()
+                       << " name:" << item->get_name()
+                       << " depth:" << item->get_depth();
+       }
+
+       return os;
+}
+
 } // namespace gnash
 
 

Index: server/dlist.h
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- server/dlist.h      16 Feb 2007 12:27:27 -0000      1.27
+++ server/dlist.h      28 Feb 2007 14:10:25 -0000      1.28
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -46,6 +46,9 @@
 
 public:
 
+       /// Output operator
+       friend std::ostream& operator<< (std::ostream&, const DisplayList&);
+
        /// \brief
        /// Place a new character in this display list
        /// replacing any other char at the same depth.
@@ -298,6 +301,10 @@
        ///
        void sort ();
 
+       bool operator==(const DisplayList& other) const { return _characters == 
other._characters; }
+
+       bool operator!=(const DisplayList& other) const { return _characters != 
other._characters; }
+
 private:
 
        typedef std::list<DisplayItem> container_type;
@@ -359,7 +366,9 @@
        }
 }
 
-}
+std::ostream& operator<< (std::ostream&, const DisplayList&);
+
+} // namespace gnash
 
 
 #endif // GNASH_DLIST_H

Index: testsuite/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/Makefile.am,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- testsuite/Makefile.am       27 Feb 2007 09:10:20 -0000      1.29
+++ testsuite/Makefile.am       28 Feb 2007 14:10:25 -0000      1.30
@@ -13,7 +13,7 @@
        actionscript.all        \
        $(NULL)
 
-EXTRA_DIST = check.h media
+EXTRA_DIST = check.h DummyMovieDefinition.h DummyCharacter.h media
 
 dist_noinst_SCRIPTS = anaylse-results.sh
 

Index: testsuite/server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/server/Makefile.am,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- testsuite/server/Makefile.am        15 Jan 2007 14:19:18 -0000      1.21
+++ testsuite/server/Makefile.am        28 Feb 2007 14:10:25 -0000      1.22
@@ -1,6 +1,6 @@
 ## Process this fill with automake to generate Makefile.in
 # 
-#   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+#   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
@@ -37,6 +37,7 @@
        PropertyListTest \
        GetterSetterTest \
        as_prop_flagsTest \
+       DisplayListTest \
        $(NULL)
 
 CLEANFILES = \
@@ -75,6 +76,13 @@
        $(top_builddir)/libbase/libgnashbase.la \
        $(NULL)
 
+DisplayListTest_SOURCES = DisplayListTest.cpp
+DisplayListTest_LDADD = \
+       $(top_builddir)/server/libgnashserver.la \
+       $(top_builddir)/server/vm/libgnashvm.la \
+       $(top_builddir)/libbase/libgnashbase.la \
+       $(NULL)
+
 TEST_DRIVERS = ../simple.exp
 TEST_CASES = \
        $(check_PROGRAMS) \

Index: testsuite/DummyCharacter.h
===================================================================
RCS file: testsuite/DummyCharacter.h
diff -N testsuite/DummyCharacter.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/DummyCharacter.h  28 Feb 2007 14:10:25 -0000      1.1
@@ -0,0 +1,63 @@
+// 
+//   Copyright (C) 2007 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// 
+//
+
+
+#ifndef GNASH_DUMMYCHARACTER_H
+#define GNASH_DUMMYCHARACTER_H
+
+#include "character.h" // for inheritance
+#include "rect.h" // for composition
+#include "movie_instance.h" // for create_movie_instance
+
+#include <string>
+#include <memory> // for auto_ptr
+
+// Forward declarations
+namespace gnash {
+       //class bitmap_character_def;
+}
+
+namespace gnash
+{
+
+/// A dummy character instance, for use by unit tests
+//
+/// This class provides implementation of all virtual
+/// methods of movie_definition by returning user-defined
+/// values for XXXXXXXXXXXXXXXXXXXXXXXXXX etc..
+///
+///
+class DummyCharacter : public character
+{
+
+public:
+
+       DummyCharacter()
+               :
+               character(NULL, -1)
+       {
+       }
+
+       void get_invalidated_bounds(rect* /*bounds*/, bool /*force*/) {}
+
+};
+
+} // namespace gnash
+
+#endif // GNASH_DUMMYCHARACTER_H

Index: testsuite/server/DisplayListTest.cpp
===================================================================
RCS file: testsuite/server/DisplayListTest.cpp
diff -N testsuite/server/DisplayListTest.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/server/DisplayListTest.cpp        28 Feb 2007 14:10:25 -0000      
1.1
@@ -0,0 +1,81 @@
+// 
+//   Copyright (C) 2007 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "check.h"
+#include "dlist.h"
+#include "as_value.h"
+#include "character.h"
+#include "log.h"
+#include "VM.h"
+#include "DummyMovieDefinition.h"
+#include "DummyCharacter.h"
+#include "movie_definition.h"
+
+#include <iostream>
+#include <sstream>
+#include <cassert>
+#include <string>
+
+using namespace std;
+using namespace gnash;
+
+int
+main(int /*argc*/, char** /*argv*/)
+{
+       cxform color;
+       matrix mat;
+
+
+       gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+       dbglogfile.setVerbosity();
+
+       // Initialize a VM
+       boost::intrusive_ptr<movie_definition> md5 ( new 
DummyMovieDefinition(5) );
+       boost::intrusive_ptr<movie_definition> md6 ( new 
DummyMovieDefinition(6) );
+       VM& vm = VM::init(*md5);
+
+       DisplayList dlist1;
+
+       check_equals(dlist1, dlist1);
+
+       DisplayList dlist2 = dlist1;
+
+       check_equals(dlist1, dlist2);
+
+       // just a couple of characters
+       boost::intrusive_ptr<character> ch1 ( new DummyCharacter() );
+       boost::intrusive_ptr<character> ch2 ( new DummyCharacter() );
+
+       dlist1.place_character( ch1.get(), 1, color, mat, 0.0f, 0);
+       dlist1.place_character( ch2.get(), 2, color, mat, 0.0f, 0);
+
+       check(dlist1 != dlist2);
+
+       dlist2.place_character( ch2.get(), 1, color, mat, 0.0f, 0);
+       dlist2.place_character( ch1.get(), 2, color, mat, 0.0f, 0);
+
+       // Resort dlist1 as depth of it's chars has been changed
+       // by place_character calls above :/
+       dlist1.sort();
+
+       check_equals(dlist1, dlist2);
+
+}
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]