gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash testsuite/Makefile.am ChangeLog testsuite...


From: Sandro Santilli
Subject: [Gnash-commit] gnash testsuite/Makefile.am ChangeLog testsuite...
Date: Wed, 11 Oct 2006 13:56:08 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/10/11 13:56:08

Modified files:
        testsuite      : Makefile.am 
        .              : ChangeLog 
Added files:
        testsuite      : MovieTester.cpp MovieTester.h 

Log message:
        initial implementation of a movie tester class.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/Makefile.am?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/MovieTester.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/MovieTester.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1139&r2=1.1140

Patches:
Index: testsuite/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/Makefile.am,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- testsuite/Makefile.am       11 Oct 2006 09:09:03 -0000      1.8
+++ testsuite/Makefile.am       11 Oct 2006 13:56:08 -0000      1.9
@@ -11,3 +11,20 @@
        $(NULL)
 
 EXTRA_DIST = check.h
+
+# could not find a way to only build this on make check
+noinst_LTLIBRARIES = libtestsuite.la 
+
+libtestsuite_la_SOURCES = \
+       MovieTester.h \
+       MovieTester.cpp \
+       $(NULL)
+libtestsuite_la_LIBADD = \
+       ../server/libgnashserver.la \
+       ../libbase/libgnashbase.la \
+       $(NULL)
+libtestsuite_la_CXXFLAGS = \
+        -I$(top_srcdir)/libbase \
+        -I$(top_srcdir)/server  \
+        -I$(top_srcdir)/server/parser  \
+       $(NULL)

Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1139
retrieving revision 1.1140
diff -u -b -r1.1139 -r1.1140
--- ChangeLog   11 Oct 2006 13:50:23 -0000      1.1139
+++ ChangeLog   11 Oct 2006 13:56:08 -0000      1.1140
@@ -1,5 +1,11 @@
 2006-10-11 Sandro Santilli <address@hidden>
 
+       * testsuite/Makefile.am, testsuite/MovieTester.cpp,
+         testsuite/MovieTester.h: initial implementation of
+         a movie tester class.
+
+2006-10-11 Sandro Santilli <address@hidden>
+
        * server/sprite_instance.h: added getDisplayList() method usefull
          for testing.
        * server/edit_text_character.{cpp,h}: implemented get_width() and

Index: testsuite/MovieTester.cpp
===================================================================
RCS file: testsuite/MovieTester.cpp
diff -N testsuite/MovieTester.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/MovieTester.cpp   11 Oct 2006 13:56:08 -0000      1.1
@@ -0,0 +1,97 @@
+/* 
+ *   Copyright (C) 2005, 2006 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
+ *
+ * Linking Gnash statically or dynamically with other modules is making a
+ * combined work based on Gnash. Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of Gnash give you
+ * permission to combine Gnash with free software programs or libraries
+ * that are released under the GNU LGPL and with code included in any
+ * release of Talkback distributed by the Mozilla Foundation. You may
+ * copy and distribute such a system following the terms of the GNU GPL
+ * for all but the LGPL-covered parts and Talkback, and following the
+ * LGPL for the LGPL-covered parts.
+ *
+ * Note that people who make modified versions of Gnash are not obligated
+ * to grant this special exception for their modified versions; it is their
+ * choice whether to do so. The GNU General Public License gives permission
+ * to release a modified version without this exception; this exception
+ * also makes it possible to release a modified version which carries
+ * forward this exception.
+ *
+ */ 
+
+#include "MovieTester.h"
+#include "GnashException.h"
+#include "URL.h"
+#include "noseek_fd_adapter.h"
+#include "movie_definition.h"
+#include "movie_instance.h"
+#include "movie_interface.h"
+#include "sprite_instance.h"
+#include "as_environment.h"
+#include "gnash.h" // for create_movie and create_library_movie
+
+#include <cstdio>
+#include <string>
+#include <memory> // for auto_ptr
+
+namespace gnash {
+
+MovieTester::MovieTester(const std::string& url)
+{
+       if ( url == "-" )
+       {
+               tu_file* in = noseek_fd_adapter::make_stream(fileno(stdin));
+               _movie_def = gnash::create_movie(in, url);
+       }
+       else
+       {
+               // _url should be always set at this point...
+               _movie_def = gnash::create_library_movie(URL(url));
+       }
+
+       if ( ! _movie_def )
+       {
+               throw GnashException("Could not load movie from "+url);
+       }
+
+       // Make sure to load the whole movie
+       _movie_def->ensure_frame_loaded(_movie_def->get_frame_count());
+
+       movie_interface* root = _movie_def->create_instance();
+       assert(root);
+       _movie = root->get_root_movie();
+       assert(_movie);
+}
+
+void
+MovieTester::advance() 
+{
+       _movie->advance(1.0);
+}
+
+const character*
+MovieTester::findDisplayItemByName(const sprite_instance& mc,
+               const std::string& name_str) 
+{
+       const DisplayList& dlist = mc.getDisplayList();
+       const tu_string name = name_str.c_str();
+       return dlist.get_character_by_name(name);
+}
+
+} // namespace gnash

Index: testsuite/MovieTester.h
===================================================================
RCS file: testsuite/MovieTester.h
diff -N testsuite/MovieTester.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/MovieTester.h     11 Oct 2006 13:56:08 -0000      1.1
@@ -0,0 +1,94 @@
+/* 
+ *   Copyright (C) 2005, 2006 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
+ *
+ * Linking Gnash statically or dynamically with other modules is making a
+ * combined work based on Gnash. Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of Gnash give you
+ * permission to combine Gnash with free software programs or libraries
+ * that are released under the GNU LGPL and with code included in any
+ * release of Talkback distributed by the Mozilla Foundation. You may
+ * copy and distribute such a system following the terms of the GNU GPL
+ * for all but the LGPL-covered parts and Talkback, and following the
+ * LGPL for the LGPL-covered parts.
+ *
+ * Note that people who make modified versions of Gnash are not obligated
+ * to grant this special exception for their modified versions; it is their
+ * choice whether to do so. The GNU General Public License gives permission
+ * to release a modified version without this exception; this exception
+ * also makes it possible to release a modified version which carries
+ * forward this exception.
+ *
+ */ 
+
+#ifndef _GNASH_MOVIETESTER_H
+#define _GNASH_MOVIETESTER_H
+
+#include <memory> // for auto_ptr
+#include <string> // for auto_ptr
+
+// Forward declarations
+namespace gnash {
+       class movie_definition;
+       class sprite_instance;
+       class character;
+}
+
+namespace gnash {
+
+/// An utility class for testing movie playback
+//
+/// This is a just born implementation and doesn't
+/// have much more then simply loading a movie and
+/// providing a function to find DisplayItems by name
+///
+/// More functions will be added when needed.
+///
+class MovieTester
+{
+public:
+       /// Fully load the movie at the specified location
+       /// and create an instance of it.
+       MovieTester(const std::string& filespec);
+
+       /// Advance the movie by one frame
+       void advance();
+
+       /// Find a character in the display list of a sprite by name.
+       //
+       /// Return NULL if there's no character with that name in
+       /// the sprite's display list.
+       ///
+       const character* findDisplayItemByName(const sprite_instance& mc,
+                       const std::string& name);
+
+       /// Get the topmost sprite instance of this movie
+       gnash::sprite_instance* getRootMovie() {
+               return _movie;
+       }
+
+private:
+
+       gnash::movie_definition* _movie_def;
+
+       gnash::sprite_instance* _movie;
+
+};
+
+} // namespace gnash
+
+#endif // _GNASH_MOVIETESTER_H




reply via email to

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