gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/DefineE...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/DefineE...
Date: Mon, 13 Nov 2006 12:59:20 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/11/13 12:59:20

Modified files:
        .              : ChangeLog 
        testsuite/misc-ming.all: DefineEditTextVariableNameTest.c 
                                 Makefile.am 
Removed files:
        testsuite/misc-ming.all: 
                                 DefineEditTextVariableNameTest-Runner.cpp 

Log message:
                * testsuite/misc-ming.all/DefineEditTextVariableNameTest.c:
                  make the DefineEditTextVariableNameTest.swf file a 
self-contained
                  testcase.
                * testsuite/misc-ming.all/: Makefile.am,
                  DefineEditTextVariableNameTest-Runner.cpp:
                  removed unneeded test runner for DefineEditTextVarible
                  (the SWF is now a self-contained test)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1602&r2=1.1603
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DefineEditTextVariableNameTest.c?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp?cvsroot=gnash&r1=1.4&r2=0

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1602
retrieving revision 1.1603
diff -u -b -r1.1602 -r1.1603
--- ChangeLog   13 Nov 2006 12:14:57 -0000      1.1602
+++ ChangeLog   13 Nov 2006 12:59:19 -0000      1.1603
@@ -1,5 +1,12 @@
 2006-11-13 Sandro Santilli <address@hidden>
 
+       * testsuite/misc-ming.all/DefineEditTextVariableNameTest.c:
+         make the DefineEditTextVariableNameTest.swf file a self-contained
+         testcase.
+       * testsuite/misc-ming.all/: Makefile.am,
+         DefineEditTextVariableNameTest-Runner.cpp:
+         removed unneeded test runner for DefineEditTextVarible
+         (the SWF is now a self-contained test)
        * testsuite/simple.exp: fix handling of XPASSED/XFAILED results.
        * testsuite/misc-ming.all/ming_utils.{c,h}:
          added add_dejagnu_functions() method and fixed

Index: testsuite/misc-ming.all/DefineEditTextVariableNameTest.c
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/DefineEditTextVariableNameTest.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- testsuite/misc-ming.all/DefineEditTextVariableNameTest.c    6 Nov 2006 
11:02:56 -0000       1.9
+++ testsuite/misc-ming.all/DefineEditTextVariableNameTest.c    13 Nov 2006 
12:59:20 -0000      1.10
@@ -22,8 +22,8 @@
  *
  * Uses "embedded" font with chars: "Hello world"
  *
- * Then, every second it toggles the text between "Hello"
- * and "World" by setting the VariableName.
+ * Then, every second it toggles the text between "Hello",
+ * "World" and "" (the empty string) by setting the VariableName.
  * 
  * After every variable set it also traces the value of the
  * VariableName, of the textfield and of it's 'text' member.
@@ -50,7 +50,106 @@
 #define OUTPUT_FILENAME "DefineEditTextVariableNameTest.swf"
 
 void add_text_field(SWFMovieClip mo, SWFBlock font, const char* varname, const 
char* text);
+void set_text(SWFMovie mo, const char* txt, const char* mcname, const char* 
varname);
+void shift_horizontally(SWFMovie mo, const char* what, int howmuch);
+void set_x(SWFMovie mo, const char* what, int x);
 
+void
+shift_horizontally(SWFMovie mo, const char* what, int howmuch)
+{ 
+       static const size_t BUFLEN = 256;
+
+       char buf[BUFLEN];
+       SWFAction ac;
+
+       snprintf(buf, BUFLEN, "%s._x += %d;", what, howmuch);
+       buf[BUFLEN-1] = '\0';
+
+       ac = compileSWFActionCode(buf);
+       SWFMovie_add(mo, (SWFBlock)ac);
+}
+
+void
+set_x(SWFMovie mo, const char* what, int x)
+{ 
+       static const size_t BUFLEN = 256;
+
+       char buf[BUFLEN];
+       SWFAction ac;
+
+       snprintf(buf, BUFLEN, "%s._x = %d;", what, x);
+       buf[BUFLEN-1] = '\0';
+
+       ac = compileSWFActionCode(buf);
+       SWFMovie_add(mo, (SWFBlock)ac);
+}
+
+
+/* The following three functions to be exported in ming_utils */
+void check(SWFMovie mo, const char* expr, int expected_failure);
+void check_equals(SWFMovie mo, const char* obtained, const char* expected, int 
expected_failure);
+void add_actions(SWFMovie mo, const char* code);
+
+
+void
+check(SWFMovie mo, const char* expr,
+               int expected_failure)
+{
+       static const size_t BUFLEN = 512;
+
+       char buf[BUFLEN];
+       SWFAction ac;
+       snprintf(buf, BUFLEN, "%scheck(%s);",
+               expected_failure ? "x" : "",
+               expr);
+       buf[BUFLEN-1] = '\0';
+       ac = compileSWFActionCode(buf);
+       SWFMovie_add(mo, (SWFBlock)ac);
+}
+
+void
+check_equals(SWFMovie mo, const char* obtained, const char* expected,
+               int expected_failure)
+{
+       static const size_t BUFLEN = 512;
+
+       char buf[BUFLEN];
+       SWFAction ac;
+       snprintf(buf, BUFLEN, "%scheck_equals(%s, %s);",
+               (expected_failure ? "x" : ""),
+               obtained, expected);
+       buf[BUFLEN-1] = '\0';
+       ac = compileSWFActionCode(buf);
+       fprintf(stderr, "%s\n", buf);
+       SWFMovie_add(mo, (SWFBlock)ac);
+}
+
+void
+set_text(SWFMovie mo, const char* txt, const char* mcname, const char* varname)
+{
+       static const size_t BUFLEN = 512;
+
+       char buf[BUFLEN];
+       SWFAction ac;
+       snprintf(buf, BUFLEN, "%s = \"%s\"; ",
+               varname, txt);
+       buf[BUFLEN-1] = '\0';
+       ac = compileSWFActionCode(buf);
+       SWFMovie_add(mo, (SWFBlock)ac);
+}
+
+void
+add_actions(SWFMovie mo, const char* code)
+{
+       static const size_t BUFLEN = 1024;
+
+       char buf[BUFLEN];
+       SWFAction ac;
+       snprintf(buf, BUFLEN, "%s", code);
+       buf[BUFLEN-1] = '\0';
+       ac = compileSWFActionCode(buf);
+       SWFMovie_add(mo, (SWFBlock)ac);
+}
 
 void
 add_text_field(SWFMovieClip mo, SWFBlock font, const char* varname,
@@ -73,16 +172,25 @@
 
        it = SWFMovieClip_add(mo, (SWFBlock)tf);
        SWFDisplayItem_setName(it, "textfield");
+
+       SWFMovieClip_nextFrame(mo);
+
 }
 
 int
 main(int argc, char** argv)
 {
        SWFMovie mo;
-       SWFMovieClip mc;
-       SWFDisplayItem it;
+       SWFMovieClip mc1, mc2, mc3;
        const char *srcdir=".";
        char fdbfont[256];
+       /* The variable name for textfield */
+       char* varName1 = "_root.testName";
+       char* varName2 = "_root.mc3.testName";
+       FILE *font_file;
+       /*SWFBrowserFont bfont; */
+       SWFFont bfont; 
+
 
        /*********************************************
         *
@@ -109,42 +217,56 @@
        SWFMovie_setRate(mo, 1);
        SWFMovie_setDimension(mo, 12560, 9020);
 
-       /*********************************************
+       font_file = fopen(fdbfont, "r");
+       if ( font_file == NULL )
+       {
+               perror(fdbfont);
+               exit(1);
+       }
+       /*SWFBrowserFont bfont = newSWFBrowserFont("_sans");*/
+       bfont = loadSWFFontFromFile(font_file);
+
+
+       /***************************************************
         *
-        * Add a new MovieClip
+        * Add MovieClips mc1 and mc2 with their textfield
         *
-        *********************************************/
+        ***************************************************/
+
+       {
+               SWFDisplayItem it;
+               mc1 = newSWFMovieClip();
+               add_text_field(mc1, (SWFBlock)bfont, varName1, "Hello World");
+               it = SWFMovie_add(mo, (SWFBlock)mc1);
+               SWFDisplayItem_setName(it, "mc1");
+               set_x(mo, "mc1.textfield", 0);
+       }
 
-       mc = newSWFMovieClip();
+       {
+               SWFDisplayItem it;
+               mc2 = newSWFMovieClip();
+               add_text_field(mc2, (SWFBlock)bfont, varName2, "Hi There");
+               it = SWFMovie_add(mo, (SWFBlock)mc2);
+               SWFDisplayItem_setName(it, "mc2");
+               set_x(mo, "mc2.textfield", 150);
+       }
 
        /*********************************************
         *
-        * Add the textfield
+        * Now add mc3, which is referenced by
+        * mc2.textfield variableName (after it's placement)
         *
         *********************************************/
 
-       /* 
-        * The variable name
-        */
-       char* varName = "_root.testName";
-       char buf[256];
-
-       /* This is with embedded fonts, not working */
-       {
-               FILE *font_file = fopen(fdbfont, "r");
-               if ( font_file == NULL )
                {
-                       perror(fdbfont);
-                       exit(1);
-               }
-               /*SWFBrowserFont bfont = newSWFBrowserFont("_sans");*/
-               SWFFont bfont = loadSWFFontFromFile(font_file);
-               add_text_field(mc, (SWFBlock)bfont, varName, "Hello World");
-               SWFMovieClip_nextFrame(mc);
+               SWFDisplayItem it;
+               mc3 = newSWFMovieClip();
+               it = SWFMovie_add(mo, (SWFBlock)mc3);
+               SWFDisplayItem_setName(it, "mc3");
+               /*SWFMovie_nextFrame(mo);*/
        }
 
-       it = SWFMovie_add(mo, (SWFBlock)mc);
-       SWFDisplayItem_setName(it, "mc1");
+
 
        /*********************************************
         *
@@ -152,77 +274,61 @@
         *
         *********************************************/
 
-       add_xtrace_function(mo, 3000, 0, 50, 400, 800);
+       /*add_xtrace_function(mo, 3000, 0, 50, 400, 800);*/
+       add_dejagnu_functions(mo, 3000, 0, 50, 400, 800);
 
        /*********************************************
         *
-        * Access the value of the variablename
+        * Set and get value of the textfields using
+        * their variableName
         *
         *********************************************/
 
-       {
-               SWFAction ac;
-               sprintf(buf, "%s = \"Hello\"; "
-                       "xtrace(\"%s: \"+%s+\"\n"
-                       "mc1._width: \"+mc1._width+\"\n"
-                       "mc1._height: \"+mc1._height+\"\n"
-                       "_root._width: \"+_root._width+\"\n"
-                       "_root._height: \"+_root._height+\"\n"
-                       "mc1.textfield: \"+mc1.textfield+\"\n"
-                       "mc1.textfield.text: \"+mc1.textfield.text+\"\n"
-                       "mc1.textfield._width: \"+mc1.textfield._width+\"\n"
-                       "mc1.textfield._height: \"+mc1.textfield._height); ",
-                       varName, varName, varName);
-               ac = compileSWFActionCode(buf);
-               SWFMovie_add(mo, (SWFBlock)ac);
-               SWFMovie_nextFrame(mo); 
-       }
+       set_text(mo, "Hello", "mc1", varName1);
+       shift_horizontally(mo, varName1, 10);
+       check_equals(mo, "mc1.textfield.text", "'Hello'", 0);
+       check_equals(mo, varName1, "'Hello'", 0);
+       check_equals(mo, "mc1.textfield._x", "0", 0);
+
+       set_text(mo, "Hi", "mc2", varName2);
+       shift_horizontally(mo, varName2, 10);
+       check_equals(mo, "mc2.textfield.text", "'Hi'", 1);
+       check_equals(mo, varName2, "'Hi'", 0);
+       check_equals(mo, "mc2.textfield._x", "150", 0);
 
-       {
-               SWFAction ac;
-               sprintf(buf, "%s = \"World\"; "
-                       "xtrace(\"%s: \"+%s+\"\n"
-                       "mc1._width: \"+mc1._width+\"\n"
-                       "mc1._height: \"+mc1._height+\"\n"
-                       "_root._width: \"+_root._width+\"\n"
-                       "_root._height: \"+_root._height+\"\n"
-                       "mc1.textfield: \"+mc1.textfield+\"\n"
-                       "mc1.textfield.text: \"+mc1.textfield.text+\"\n"
-                       "mc1.textfield._width: \"+mc1.textfield._width+\"\n"
-                       "mc1.textfield._height: \"+mc1.textfield._height); ",
-                       varName, varName, varName);
-               ac = compileSWFActionCode(buf);
-               SWFMovie_add(mo, (SWFBlock)ac);
                SWFMovie_nextFrame(mo); /* showFrame */
-       }
 
-       { // set text to the empty string
-               SWFAction ac;
-               sprintf(buf, "%s = \"\"; "
-                       "xtrace(\"%s: \"+%s+\"\n"
-                       "mc1._width: \"+mc1._width+\"\n"
-                       "mc1._height: \"+mc1._height+\"\n"
-                       "_root._width: \"+_root._width+\"\n"
-                       "_root._height: \"+_root._height+\"\n"
-                       "mc1.textfield: \"+mc1.textfield+\"\n"
-                       "mc1.textfield.text: \"+mc1.textfield.text+\"\n"
-                       "mc1.textfield._width: \"+mc1.textfield._width+\"\n"
-                       "mc1.textfield._height: \"+mc1.textfield._height); ",
-                       varName, varName, varName);
-               ac = compileSWFActionCode(buf);
-               SWFMovie_add(mo, (SWFBlock)ac);
+       set_text(mo, "World", "mc1", varName1);
+       shift_horizontally(mo, varName1, 10);
+       check_equals(mo, "mc1.textfield.text", "'World'", 0);
+       check_equals(mo, varName1, "'World'", 0);
+       check_equals(mo, "mc1.textfield._x", "0", 0);
+
+       set_text(mo, "There", "mc2", varName2);
+       shift_horizontally(mo, varName2, 10);
+       check_equals(mo, "mc2.textfield.text", "'There'", 1);
+       check_equals(mo, varName2, "'There'", 0);
+       check_equals(mo, "mc2.textfield._x", "150", 0);
+
                SWFMovie_nextFrame(mo); /* showFrame */
-       }
 
-       {
-               // testName (the variable) doesn't access the character,
-               // only its text.
-               SWFAction ac;
-               sprintf(buf, "%s._x += 10;", varName);
-               ac = compileSWFActionCode(buf);
-               SWFMovie_add(mo, (SWFBlock)ac);
+       set_text(mo, "", "mc1", varName1);
+       shift_horizontally(mo, varName1, 10);
+       check_equals(mo, "mc1.textfield.text", "''", 0);
+       check_equals(mo, varName1, "''", 0);
+       check_equals(mo, "mc1.textfield._x", "0", 0);
+
+       set_text(mo, "", "mc2", varName2);
+       shift_horizontally(mo, varName2, 10);
+       check_equals(mo, "mc2.textfield.text", "''", 1);
+       check_equals(mo, varName2, "''", 0);
+       check_equals(mo, "mc2.textfield._x", "150", 0);
+
+       add_actions(mo, "stop();");
+
                SWFMovie_nextFrame(mo); /* showFrame */
-       }
+
+
 
        /*****************************************************
         *

Index: testsuite/misc-ming.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- testsuite/misc-ming.all/Makefile.am 2 Nov 2006 11:54:28 -0000       1.28
+++ testsuite/misc-ming.all/Makefile.am 13 Nov 2006 12:59:20 -0000      1.29
@@ -46,7 +46,6 @@
        definebitsjpeg2 \
        DefineEditTextTest \
        DefineEditTextVariableNameTest \
-       DefineEditTextVariableNameTest-Runner \
        RollOverOutTest-Runner \
        ButtonEventsTest-Runner \
        spritehier \
@@ -75,16 +74,6 @@
        $(NULL)
 DefineEditTextVariableNameTest_LDADD = $(MING_LIBS)
 
-DefineEditTextVariableNameTest_Runner_SOURCES = \
-       DefineEditTextVariableNameTest-Runner.cpp \
-       $(NULL)
-DefineEditTextVariableNameTest_Runner_LDADD = \
-       $(top_builddir)/testsuite/libtestsuite.la \
-       $(NULL)
-DefineEditTextVariableNameTest_Runner_DEPENDENCIES = \
-       DefineEditTextVariableNameTest.swf      \
-       $(NULL)
-
 spritehier_SOURCES =  spritehier.c
 spritehier_LDADD = $(MING_LIBS)
 
@@ -165,7 +154,6 @@
 
 TEST_DRIVERS = ../simple.exp
 TEST_CASES = \
-       DefineEditTextVariableNameTest-Runner \
        RollOverOutTest-Runner \
        ButtonEventsTest-Runner
 

Index: testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp
===================================================================
RCS file: testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp
diff -N testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp
--- testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp   11 Nov 
2006 14:36:33 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,100 +0,0 @@
-/* 
- *   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
- *
- *
- */ 
-
-#define INPUT_FILENAME "DefineEditTextVariableNameTest.swf"
-
-#include "MovieTester.h"
-#include "sprite_instance.h"
-#include "character.h"
-#include "dlist.h"
-#include "container.h"
-#include "log.h"
-
-#include "check.h"
-#include <string>
-#include <cassert>
-
-using namespace gnash;
-using namespace std;
-
-int
-main(int /*argc*/, char** /*argv*/)
-{
-       string filename = INPUT_FILENAME;
-       MovieTester tester(filename);
-
-       gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
-       dbglogfile.setVerbosity(1);
-
-       sprite_instance* root = tester.getRootMovie();
-       assert(root);
-
-       check_equals(root->get_frame_count(), 4);
-       check_equals(root->get_play_state(), movie_interface::PLAY);
-       check_equals(root->get_current_frame(), 0);
-
-       const character* mc1 = tester.findDisplayItemByName(*root, "mc1");
-       check(mc1);
-
-       const sprite_instance* mc1_sp = \
-               dynamic_cast<const sprite_instance*>(mc1);
-       assert(mc1_sp);
-
-       check_equals(mc1->get_height(), 16*20);
-       check_equals(mc1->get_width(), 136*20);
-       check_equals(mc1_sp->get_height(), 16*20);
-       check_equals(mc1_sp->get_width(), 136*20);
-
-       const character* textfield = tester.findDisplayItemByName(*mc1_sp,
-                       "textfield");
-       check(textfield);
-
-       check_equals(string(textfield->get_text_value()), string("Hello 
World"));
-       check_equals(textfield->get_height(), 16*20);
-       check_equals(textfield->get_width(), 136*20);
-
-       tester.advance();
-
-       check_equals(root->get_play_state(), movie_interface::PLAY);
-       check_equals(root->get_current_frame(), 0);
-       check_equals(tester.findDisplayItemByName(*root, "mc1"), mc1_sp);
-       check_equals(tester.findDisplayItemByName(*mc1_sp, "textfield"),
-               textfield);
-       check_equals(string(textfield->get_text_value()), string("Hello"));
-
-       tester.advance();
-
-       check_equals(root->get_play_state(), movie_interface::PLAY);
-       check_equals(root->get_current_frame(), 1);
-       check_equals(tester.findDisplayItemByName(*root, "mc1"), mc1_sp);
-       check_equals(tester.findDisplayItemByName(*mc1_sp, "textfield"),
-               textfield);
-       check_equals(string(textfield->get_text_value()), string("World"));
-
-       tester.advance();
-
-       check_equals(root->get_play_state(), movie_interface::PLAY);
-       check_equals(root->get_current_frame(), 2);
-       check_equals(tester.findDisplayItemByName(*root, "mc1"), mc1_sp);
-       check_equals(tester.findDisplayItemByName(*mc1_sp, "textfield"),
-               textfield);
-       check_equals(string(textfield->get_text_value()), string(""));
-
-}
-




reply via email to

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