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: Zou Lunkai
Subject: [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/DefineE...
Date: Fri, 24 Aug 2007 07:36:26 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  07/08/24 07:36:26

Modified files:
        .              : ChangeLog 
Added files:
        testsuite/misc-ming.all: DefineEditTextVariableNameTest2.c 

Log message:
        * testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c: add a new 
testcase for EditText variables, not enabled yet, need review.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4090&r2=1.4091
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4090
retrieving revision 1.4091
diff -u -b -r1.4090 -r1.4091
--- ChangeLog   24 Aug 2007 05:55:51 -0000      1.4090
+++ ChangeLog   24 Aug 2007 07:36:25 -0000      1.4091
@@ -1,3 +1,8 @@
+2007-08-24 Zou Lunkai <address@hidden>
+       
+       * testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c: add a new 
+         testcase for EditText variables, not enabled yet, need review.
+         
 2007-08-24 Chad Musick <address@hidden>
 
        * server/swf/PlaceObject2Tag.cpp,h: Add support for the

Index: testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c
===================================================================
RCS file: testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c
diff -N testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c   24 Aug 2007 
07:36:25 -0000      1.1
@@ -0,0 +1,204 @@
+/* 
+ *   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
+ * 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
+ *
+ *
+ */ 
+
+/*
+ * zou lunkai address@hidden
+ *
+ * Test DefineEditText tag with VariableName
+ *
+ * TODO: review this testcase later.
+ *
+ * run as ./DefineEditTextVariableNameTest2
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#include "ming_utils.h"
+
+#define OUTPUT_VERSION 7
+#define OUTPUT_FILENAME "DefineEditTextVariableNameTest2.swf"
+
+SWFDisplayItem add_text_field(SWFMovie mo, SWFBlock font, const char* varname, 
 const char* text);
+
+SWFDisplayItem
+add_text_field(SWFMovie mo, SWFBlock font, const char* varname, const char* 
text)
+{
+  SWFTextField tf;
+  SWFDisplayItem it;
+
+  tf = newSWFTextField();
+
+  SWFTextField_setFlags(tf, SWFTEXTFIELD_DRAWBOX);
+
+  SWFTextField_setFont(tf, font);
+  SWFTextField_addChars(tf, text);
+  SWFTextField_addString(tf, text);
+
+  SWFTextField_setBounds(tf, 150, 30);
+  
+  /* Give the textField a variablename*/
+  SWFTextField_setVariableName(tf, varname);
+
+  return SWFMovie_add(mo, (SWFBlock)tf);
+}
+
+
+int
+main(int argc, char** argv)
+{
+  SWFMovie mo;
+  const char *srcdir=".";
+  char fdbfont[256];
+  SWFMovieClip  dejagnuclip;
+  SWFFont bfont;
+  SWFDisplayItem it1, it2, it3, it4;
+  
+
+  // Frame1: Initialization
+
+  if ( argc>1 ) srcdir=argv[1];
+  else
+  {
+    fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
+    return 1;
+  }
+
+  sprintf(fdbfont, "%s/Bitstream Vera Sans.fdb", srcdir);
+
+  puts("Setting things up");
+
+  Ming_init();
+  Ming_useSWFVersion (OUTPUT_VERSION);
+ 
+  mo = newSWFMovie();
+  SWFMovie_setRate(mo, 1.0);
+  SWFMovie_setDimension(mo, 800, 600);
+  
+  dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 
800, 600);
+  SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+  SWFMovie_nextFrame(mo);  
+
+  // Frame2: add dtext1, associate it with a variable 'edit_text_var'
+  
+  bfont = get_default_font(srcdir);
+       
+  it1 = add_text_field(mo, (SWFBlock)bfont, "edit_text_var",  "Hello");
+  SWFDisplayItem_setName(it1, "dtext1");
+  SWFDisplayItem_moveTo(it1, 0, 100);
+  
+  check_equals(mo, "edit_text_var", "'Hello'");
+  check_equals(mo, "dtext1.text", "'Hello'");
+  SWFMovie_nextFrame(mo); 
+  
+  // Frame3: add dtext2, associate it with a variable 'edit_text_var' again
+  
+  it2 = add_text_field(mo, (SWFBlock)bfont, "edit_text_var",  "World");
+  SWFDisplayItem_setName(it2, "dtext2");
+  SWFDisplayItem_moveTo(it2, 0, 200);
+  
+  check_equals(mo, "edit_text_var", "'Hello'");
+  check_equals(mo, "dtext1.text", "'Hello'");
+  check_equals(mo, "dtext2.text", "'Hello'");
+  SWFMovie_nextFrame(mo); 
+  
+  // Frame4: add dtext3, associate it with a variable 'edit_text_var' again
+  
+  it3 = add_text_field(mo, (SWFBlock)bfont, "edit_text_var",  "Hello World");
+  SWFDisplayItem_setName(it3, "dtext3");
+  SWFDisplayItem_moveTo(it3, 0, 300);
+  
+  check_equals(mo, "edit_text_var", "'Hello'");
+  check_equals(mo, "dtext1.text", "'Hello'");
+  check_equals(mo, "dtext2.text", "'Hello'");
+  check_equals(mo, "dtext3.text", "'Hello'");
+  SWFMovie_nextFrame(mo); 
+  
+  // Frame5: set edit_text_var to 'Hahaha'
+  
+  add_actions(mo, "edit_text_var = 'Hahaha'; ");
+  check_equals(mo, "edit_text_var", "'Hahaha'");
+  check_equals(mo, "dtext1.text", "'Hahaha'");
+  xcheck_equals(mo, "dtext2.text", "'Hahaha'");
+  xcheck_equals(mo, "dtext3.text", "'Hahaha'");
+  SWFMovie_nextFrame(mo); 
+  
+  // Frame6: remove dtext1
+  SWFDisplayItem_remove(it1);
+  check_equals(mo, "typeof(edit_text_var)", "'string'" );
+  check_equals(mo, "edit_text_var", "'Hahaha'");
+  SWFMovie_nextFrame(mo); 
+  
+  // Frame7: remove dtext2
+  SWFDisplayItem_remove(it2);
+  check_equals(mo, "typeof(edit_text_var)", "'string'" );
+  check_equals(mo, "edit_text_var", "'Hahaha'");
+  SWFMovie_nextFrame(mo); 
+
+  // Frame8: remove dtext3
+  SWFDisplayItem_remove(it3);
+  check_equals(mo, "typeof(edit_text_var)", "'string'" );
+  check_equals(mo, "edit_text_var", "'Hahaha'");
+  SWFMovie_nextFrame(mo); 
+  
+  // Frame 9: add dtext4, associate it with a variable 'edit_text_var' again. 
+  it4 = add_text_field(mo, (SWFBlock)bfont, "edit_text_var",  "Hello");
+  SWFDisplayItem_setName(it4, "dtext4");
+  SWFDisplayItem_moveTo(it4, 0, 400);
+  check_equals(mo, "edit_text_var", "'Hahaha'");
+  check_equals(mo, "dtext4.text", "'Hahaha'");
+  SWFMovie_nextFrame(mo); 
+  
+  // Frame10: set edit_text_var to a new Object
+  add_actions(mo, "edit_text_var = new Object();");
+  check_equals(mo, "typeof(edit_text_var)", "'object'");
+  check_equals(mo, "typeof(dtext4.text)", "'string'");
+  // dtext4.text == Object.toString() 
+  xcheck_equals(mo, "dtext4.text", "'[object Object]'");
+  SWFMovie_nextFrame(mo);
+  
+  // Frame 11: provide a user defined toString for edit_text_var
+  //
+  add_actions(mo, "Object.prototype.toString = function() {return 'Hello 
world';}; ");
+  check_equals(mo, "typeof(dtext4.text)", "'string'");
+  // Object.prototype.toString not invoked here!
+  // Strange!!!
+  xcheck_equals(mo, "dtext4.text", "'[object Object]'");
+  check_equals(mo, "typeof(dtext4.text.toString)", "'function'");
+  xcheck_equals(mo, "dtext4.text.toString()", "'[object Object]'");
+  xcheck_equals(mo, "dtext4.text.valueOf()", "'[object Object]'");
+  SWFMovie_nextFrame(mo);
+  
+  // Frame 13: prints 'Hello world', but the text in dtext4 is '[object 
Object]'
+  // Strange!!!
+  add_actions(mo, "_root.note(edit_text_var);");
+  SWFMovie_nextFrame(mo);
+  
+  // Frame 14: end
+  add_actions(mo, "totals(); stop();");
+  SWFMovie_nextFrame(mo); 
+ 
+
+  // Output movie
+  puts("Saving " OUTPUT_FILENAME );
+  SWFMovie_save(mo, OUTPUT_FILENAME);
+
+  return 0;
+}




reply via email to

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