gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/as_object.h testsuite/mi...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/as_object.h testsuite/mi...
Date: Fri, 21 Dec 2007 17:18:46 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/12/21 17:18:46

Modified files:
        .              : ChangeLog 
        server         : as_object.h 
        testsuite/misc-ming.all: DragDropTest.as Makefile.am 
Added files:
        testsuite/misc-ming.all: DragDropTestRunner.cpp 

Log message:
        Provide const versions of as_object::to_movie() and 
as_object::to_character().
        Implement and activate automated runner for the new DragDropTest.swf 
movie.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5240&r2=1.5241
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.88&r2=1.89
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DragDropTest.as?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.174&r2=1.175
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DragDropTestRunner.cpp?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5240
retrieving revision 1.5241
diff -u -b -r1.5240 -r1.5241
--- ChangeLog   21 Dec 2007 15:39:48 -0000      1.5240
+++ ChangeLog   21 Dec 2007 17:18:45 -0000      1.5241
@@ -1,5 +1,14 @@
 2007-12-21 Sandro Santilli <address@hidden>
 
+       * server/as_object.h: provide const versions of to_movie()
+         and to_character().
+       * testsuite/misc-ming.all/DragDropTest.as: fix expected
+         results.
+       * testsuite/misc-ming.all/: Makefile.am, DragDropTestRunner.cpp:
+         Implemented test runner for DragDropTest.swf and enabled it.
+
+2007-12-21 Sandro Santilli <address@hidden>
+
        * testsuite/misc-ming.all/: Makefile.am, DragDropTest.as:
          Self-explaining testcase for _droptarget. Requires user
          interaction so will need a MovieTester based runner to

Index: server/as_object.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.h,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -b -r1.88 -r1.89
--- server/as_object.h  19 Dec 2007 00:10:05 -0000      1.88
+++ server/as_object.h  21 Dec 2007 17:18:45 -0000      1.89
@@ -621,12 +621,16 @@
        /// Cast to a sprite, or return NULL
        virtual sprite_instance* to_movie() { return NULL; }
 
+       const sprite_instance* to_movie() const { return 
const_cast<as_object*>(this)->to_movie(); }
+
        /// Cast to a as_function, or return NULL
        virtual as_function* to_function() { return NULL; }
 
        /// Cast to a character, or return NULL
        virtual character* to_character() { return NULL; }
 
+       const character* to_character() const { return 
const_cast<as_object*>(this)->to_character(); }
+
        /// Return true if this is a Date object.
        //
        /// This is needed for special handling of Date objects

Index: testsuite/misc-ming.all/DragDropTest.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/DragDropTest.as,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/misc-ming.all/DragDropTest.as     21 Dec 2007 15:39:49 -0000      
1.1
+++ testsuite/misc-ming.all/DragDropTest.as     21 Dec 2007 17:18:45 -0000      
1.2
@@ -8,14 +8,14 @@
 //
 //
 
-rcsid="$Id: DragDropTest.as,v 1.1 2007/12/21 15:39:49 strk Exp $";
+rcsid="$Id: DragDropTest.as,v 1.2 2007/12/21 17:18:45 strk Exp $";
 
 #define info _root.note
 #define note _root.note
 #define fail_check _root.fail
 #define pass_check  _root.pass
 #define xfail_check _root.xfail
-#define xpass_check = _root.xpass
+#define xpass_check _root.xpass
 
 #ifdef LOADED_VERSION
 #define SUPPRESS_RCSID_DUMP
@@ -208,7 +208,7 @@
        note("2. Click on the FIRST RED circle.");
        _root.onMouseDown = function()
        {
-               check_equals(_root.draggable50._droptarget, "/target10");
+               xcheck_equals(_root.draggable50._droptarget, "/target10");
                test3();
        };
 };
@@ -218,7 +218,7 @@
        note("3. Click on the FIRST GREEN circle.");
        _root.onMouseDown = function()
        {
-               check_equals(_root.draggable50._droptarget, "/target20");
+               xcheck_equals(_root.draggable50._droptarget, "/target20");
                test4();
        };
 };
@@ -228,7 +228,7 @@
        note("4. Click on the FIRST BLUE circle.");
        _root.onMouseDown = function()
        {
-               check_equals(_root.draggable50._droptarget, "/target100");
+               xcheck_equals(_root.draggable50._droptarget, "/target100");
                test5();
        };
 };
@@ -238,7 +238,7 @@
        note("5. Click on the SECOND RED circle.");
        _root.onMouseDown = function()
        {
-               check_equals(_root.draggable50._droptarget, 
"_level50/target10");
+               xcheck_equals(_root.draggable50._droptarget, 
"_level50/target10");
                test6();
        };
 };
@@ -248,7 +248,7 @@
        note("6. Click on the SECOND GREEN circle.");
        _root.onMouseDown = function()
        {
-               check_equals(_root.draggable50._droptarget, 
"_level50/target20");
+               xcheck_equals(_root.draggable50._droptarget, 
"_level50/target20");
                test7();
        };
 };
@@ -258,7 +258,7 @@
        note("7. Click on the SECOND BLUE circle.");
        _root.onMouseDown = function()
        {
-               check_equals(_root.draggable50._droptarget, 
"_level50/target100");
+               xcheck_equals(_root.draggable50._droptarget, 
"_level50/target100");
                test8();
        };
 };
@@ -268,7 +268,7 @@
        note("8. Click on the THIRD RED circle.");
        _root.onMouseDown = function()
        {
-               check_equals(_root.draggable50._droptarget, 
"/loadedTarget/target10");
+               xcheck_equals(_root.draggable50._droptarget, 
"/loadedTarget/target10");
                test9();
        };
 };
@@ -278,7 +278,7 @@
        note("9. Click on the THIRD GREEN circle.");
        _root.onMouseDown = function()
        {
-               check_equals(_root.draggable50._droptarget, 
"/loadedTarget/target20");
+               xcheck_equals(_root.draggable50._droptarget, 
"/loadedTarget/target20");
                test10();
        };
 };
@@ -288,7 +288,7 @@
        note("10. Click on the THIRD BLUE circle.");
        _root.onMouseDown = function()
        {
-               check_equals(_root.draggable50._droptarget, 
"/loadedTarget/target100");
+               xcheck_equals(_root.draggable50._droptarget, 
"/loadedTarget/target100");
                test11();
        };
 };
@@ -306,6 +306,7 @@
 
 endOfTest = function()
 {
+       _root.ENDOFTEST = true;
        note("END OF TEST");
        check_totals(11);
        _root.onMouseDown = undefined;

Index: testsuite/misc-ming.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -b -r1.174 -r1.175
--- testsuite/misc-ming.all/Makefile.am 21 Dec 2007 15:58:44 -0000      1.174
+++ testsuite/misc-ming.all/Makefile.am 21 Dec 2007 17:18:46 -0000      1.175
@@ -140,6 +140,7 @@
        eventSoundTest1 \
        eventSoundTest1-Runner \
        DrawingApiTestRunner \
+       DragDropTestRunner   \
        frame_label_test \
        path_format_test \
        callFunction_test \
@@ -1532,6 +1533,21 @@
 DragDropTestLoaded.swf: $(srcdir)/DragDropTest.as Makefile 
../actionscript.all/check.as ../actionscript.all/utils.as
        $(MAKESWF) -r12 -o $@ -v6 -DUSE_DEJAGNU_MODULE -DOUTPUT_VERSION=6 
-DLOADED_VERSION $(srcdir)/DragDropTest.as
 
+DragDropTestRunner_SOURCES = \
+       DragDropTestRunner.cpp \
+       $(NULL)
+DragDropTestRunner_CXXFLAGS = \
+       -DSRCDIR='"$(srcdir)"' \
+       -DTGTDIR='"$(abs_builddir)"' \
+       $(NULL)
+DragDropTestRunner_LDADD = \
+       $(top_builddir)/testsuite/libtestsuite.la \
+       $(NULL)
+DragDropTestRunner_DEPENDENCIES = \
+       $(top_builddir)/testsuite/libtestsuite.la \
+       DragDropTest.swf        \
+       $(NULL)
+
 
 static_vs_dynamic1_SOURCES = \
        static_vs_dynamic1.c \
@@ -1668,6 +1684,7 @@
        loadMovieTestRunner \
        eventSoundTest1-Runner \
        DrawingApiTestRunner \
+       DragDropTestRunner   \
        action_execution_order_test1runner \
        action_execution_order_test2runner \
        action_execution_order_test3runner \

Index: testsuite/misc-ming.all/DragDropTestRunner.cpp
===================================================================
RCS file: testsuite/misc-ming.all/DragDropTestRunner.cpp
diff -N testsuite/misc-ming.all/DragDropTestRunner.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/DragDropTestRunner.cpp      21 Dec 2007 17:18:46 
-0000      1.1
@@ -0,0 +1,181 @@
+/* 
+ *   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 3 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
+ *
+ *
+ */ 
+
+#define INPUT_FILENAME "DragDropTest.swf"
+
+#include "MovieTester.h"
+#include "sprite_instance.h"
+#include "character.h"
+#include "dlist.h"
+#include "log.h"
+#include "Point2d.h"
+#include "VM.h"
+#include "string_table.h"
+
+#include "check.h"
+#include <string>
+#include <cassert>
+#include <sstream>
+
+using namespace gnash;
+using namespace gnash::geometry;
+using namespace std;
+
+int
+main(int /*argc*/, char** /*argv*/)
+{
+       string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
+       MovieTester tester(filename);
+
+       gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+       dbglogfile.setVerbosity(1);
+
+       sprite_instance* root = tester.getRootMovie();
+       assert(root);
+
+       // for variables lookup (consistency checking)
+       string_table& st = root->getVM().getStringTable();
+
+       typedef geometry::Point2d<int> IntPoint;
+
+       rgba white(255, 255, 255, 255); // background color
+       rgba blue(0, 0, 255, 255);      // blue circles fill color
+       rgba green(0, 255, 0, 255);     // green circles fill color
+       rgba red(255, 0, 0, 255);       // red circles fill color
+
+       int cs = 20;             // circles size
+
+       IntPoint out(350, 100);  // out of any drawing
+
+       IntPoint rc1(50, 50);    // first red circle
+       IntPoint gc1(100, 50);   // first green circle
+       IntPoint bc1(70, 100);   // first blue circle
+
+       IntPoint rc2(150, 50);   // second red circle
+       IntPoint gc2(200, 50);   // second green circle
+       IntPoint bc2(170, 100);  // second blue circle
+
+       IntPoint rc3(250, 50);   // third red circle
+       IntPoint gc3(300, 50);   // third green circle
+       IntPoint bc3(270, 100);  // third blue circle
+
+       check_equals(root->get_frame_count(), 2);
+       check_equals(root->get_current_frame(), 0);
+
+       // first frame is just Dejagnu clip...
+       tester.advance();
+
+       check_equals(root->get_current_frame(), 1);
+
+       // Wait for _level50 and loadedTarget to be loaded...
+       unsigned long sleepTime = 100000; // microseconds
+       unsigned int attempts=10;
+       while (1)
+       {
+               // if _root displaylist contains loadedTarget and loadedTarget
+               // contains target100, we've loaded it
+               const sprite_instance* loadedTarget = 0;
+               //const character* ch = tester.findDisplayItemByName(*root, 
"loadedTarget");
+               const character* ch = tester.findDisplayItemByDepth(*root, 30);
+               if ( ch ) loadedTarget = ch->to_movie();
+               if ( loadedTarget )
+               {
+                       const character* target100 = 
tester.findDisplayItemByName(*loadedTarget, "target100");
+                       if ( target100 ) break;
+                       else cerr << "target100 not yet found in loadedTarget" 
<< endl;
+               }
+               else
+               {
+                       cerr << "loadedTarget not yet not found" << endl;
+               }
+
+               if ( ! attempts-- )
+               {
+                       check(!"loadTarget was never loaded");
+                       cerr << "Root display list is: " << endl;
+                       root->getDisplayList().dump();
+                       exit(EXIT_FAILURE);
+               }
+               usleep(sleepTime);
+       }
+
+
+       // 1. Click OUTSIDE of any drawing.
+       tester.movePointerTo(out.x, out.y);
+       tester.click();
+
+       // 2. Click on the FIRST RED circle.
+       tester.movePointerTo(rc1.x, rc1.y);
+       tester.click(); 
+
+       // 3. Click on the FIRST GREEN circle.
+       tester.movePointerTo(gc1.x, gc1.y);
+       tester.click(); 
+
+       // 4. Click on the FIRST BLUE circle.
+       tester.movePointerTo(bc1.x, bc1.y);
+       tester.click(); 
+
+       // 5. Click on the SECOND RED circle.
+       tester.movePointerTo(rc2.x, rc2.y);
+       tester.click(); 
+
+       // 6. Click on the SECOND GREEN circle.
+       tester.movePointerTo(gc2.x, gc2.y);
+       tester.click(); 
+
+       // 7. Click on the SECOND BLUE circle.
+       tester.movePointerTo(bc2.x, bc2.y);
+       tester.click(); 
+
+       // 8. Click on the THIRD RED circle.
+       tester.movePointerTo(rc3.x, rc3.y);
+       tester.click(); 
+
+       // 9. Click on the THIRD GREEN circle.
+       tester.movePointerTo(gc3.x, gc3.y);
+       tester.click(); 
+
+       // 10. Click on the THIRD BLUE circle.
+       tester.movePointerTo(bc3.x, bc3.y);
+       tester.click(); 
+
+       // 11. Click OUTSIDE of any drawing (this is last thing).
+       tester.movePointerTo(out.x, out.y);
+       tester.click();
+
+       // Consistency check !!
+       as_value eot;
+       // It's an swf6, so lowercase 'ENDOFTEST'
+       bool endOfTestFound = root->get_member(st.find("endoftest"), &eot);
+       check(endOfTestFound);
+       if ( endOfTestFound )
+       {
+               cerr << eot.to_debug_string() << endl;
+               check_equals(eot.to_bool(), true);
+       }
+       else
+       {
+               cerr << "Didn't find ENDOFTEST... dumping all members" << endl;
+               root->dump_members();
+       }
+
+}
+




reply via email to

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