gnash-commit
[Top][All Lists]
Advanced

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

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


From: Zou Lunkai
Subject: [Gnash-commit] gnash/testsuite/misc-ming.all DefineEditTextVar...
Date: Wed, 02 Apr 2008 08:58:18 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  08/04/02 08:58:18

Modified files:
        testsuite/misc-ming.all: DefineEditTextVariableNameTest.c 

Log message:
        test uninitialized variables for textField instance, already passed.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DefineEditTextVariableNameTest.c?cvsroot=gnash&r1=1.20&r2=1.21

Patches:
Index: DefineEditTextVariableNameTest.c
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/DefineEditTextVariableNameTest.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- DefineEditTextVariableNameTest.c    1 Jul 2007 10:54:46 -0000       1.20
+++ DefineEditTextVariableNameTest.c    2 Apr 2008 08:58:18 -0000       1.21
@@ -1,5 +1,5 @@
 /* 
- *   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+ *   Copyright (C) 2005, 2006, 2007, 2008 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
@@ -132,22 +132,24 @@
        SWFDisplayItem it;
 
        tf = newSWFTextField();
-
        SWFTextField_setFlags(tf, SWFTEXTFIELD_DRAWBOX);
 
-
        SWFTextField_setFont(tf, font);
-       SWFTextField_addChars(tf, text);
-       SWFTextField_addString(tf, text);
 
-       /* Give the textField a variablename*/
+    /* Associate the textField instance with a named variable*/
+    if(varname)
+    {
        SWFTextField_setVariableName(tf, varname);
+    }
+    if(text)  
+    {  
+        SWFTextField_addChars(tf, text);
+        SWFTextField_addString(tf, text);
+    }
 
        it = SWFMovieClip_add(mo, (SWFBlock)tf);
        SWFDisplayItem_setName(it, "textfield");
-
        SWFMovieClip_nextFrame(mo);
-
 }
 
 static void
@@ -208,11 +210,13 @@
 main(int argc, char** argv)
 {
        SWFMovie mo;
-       SWFMovieClip mc1, mc2, mc3;
+    SWFMovieClip mc1, mc2, mc3, mc4;
+    SWFDisplayItem it;
        const char *srcdir=".";
        /* The variable name for textfield */
        char* varName1 = "_root.testName";
        char* varName2 = "_root.mc3.testName";
+    char* varName3 = "uninitalized_text_var";
        SWFFont bfont; 
 
 
@@ -248,7 +252,6 @@
         ***************************************************/
 
        {
-               SWFDisplayItem it;
                mc1 = newSWFMovieClip();
                add_text_field(mc1, (SWFBlock)bfont, varName1, "Hello World");
                it = SWFMovie_add(mo, (SWFBlock)mc1);
@@ -257,7 +260,6 @@
        }
 
        {
-               SWFDisplayItem it;
                mc2 = newSWFMovieClip();
                add_text_field(mc2, (SWFBlock)bfont, varName2, "Hi There");
                it = SWFMovie_add(mo, (SWFBlock)mc2);
@@ -273,7 +275,6 @@
         *********************************************/
 
        {
-               SWFDisplayItem it;
                mc3 = newSWFMovieClip();
                it = SWFMovie_add(mo, (SWFBlock)mc3);
                SWFDisplayItem_setName(it, "mc3");
@@ -315,6 +316,29 @@
                testVariableNameGetSet(mo, varName1bis, varName2bis);
        }
 
+
+    SWFMovie_nextFrame(mo);
+    //
+    //  test that uninitialized textfield instance variables are not
+    //  visible in the time where the textfield instance is placed.
+    //
+    mc4 = newSWFMovieClip();
+    add_text_field(mc4, (SWFBlock)bfont, varName3, NULL);
+    it = SWFMovie_add(mo, (SWFBlock)mc4);
+    SWFDisplayItem_setName(it, "mc4");
+    SWFDisplayItem_moveTo(it, 300, 300);
+    check_equals(mo, "typeof(mc4.textfield)", "'object'");
+    check_equals(mo, "typeof(mc4.uninitalized_text_var)", "'undefined'");
+    SWFMovie_nextFrame(mo); 
+    
+    check_equals(mo, "typeof(mc4.uninitalized_text_var)", "'undefined'");
+    add_actions(mo,
+        "mc4.textfield.text = 100;"
+        "mc4.textfield._width = 30;");
+    check_equals(mo, "typeof(mc4.uninitalized_text_var)", "'string'");
+    check_equals(mo, "mc4.uninitalized_text_var", "100");
+    SWFMovie_nextFrame(mo); 
+    
        /*********************************************
         *
         * Print test results
@@ -322,15 +346,11 @@
         *********************************************/
 
        SWFMovie_nextFrame(mo); /* showFrame */
-
        print_tests_summary(mo);
-
        add_actions(mo, "stop();");
-
        SWFMovie_nextFrame(mo); /* showFrame */
 
 
-
        /*****************************************************
         *
         * Output movie
@@ -338,7 +358,6 @@
         *****************************************************/
 
        puts("Saving " OUTPUT_FILENAME );
-
        SWFMovie_save(mo, OUTPUT_FILENAME);
 
        return 0;




reply via email to

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