gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11527: Correct string conversions.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11527: Correct string conversions.
Date: Tue, 29 Sep 2009 16:37:11 +0200
User-agent: Bazaar (1.16.1)

------------------------------------------------------------
revno: 11527 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2009-09-29 16:37:11 +0200
message:
  Correct string conversions.
modified:
  libcore/asobj/String_as.cpp
  libcore/vm/ASHandlers.cpp
  testsuite/misc-haxe.all/classes.all/media/Sound_as.hx
  testsuite/swfdec/PASSING
=== modified file 'libcore/asobj/String_as.cpp'
--- a/libcore/asobj/String_as.cpp       2009-08-27 06:30:46 +0000
+++ b/libcore/asobj/String_as.cpp       2009-09-29 14:00:27 +0000
@@ -73,6 +73,10 @@
 
     inline bool checkArgs(const fn_call& fn, size_t min, size_t max,
             const std::string& function);
+
+    inline int getStringVersioned(const fn_call& fn, const as_value& arg,
+            std::string& str);
+
 }
 
 String_as::String_as(const std::string& s)
@@ -86,21 +90,21 @@
 {
     VM& vm = getVM(global);
     vm.registerNative(string_ctor, 251, 0);
-       vm.registerNative(string_valueOf, 251, 1);
-       vm.registerNative(string_toString, 251, 2);
-       vm.registerNative(string_oldToUpper, 102, 0);
-       vm.registerNative(string_toUpperCase, 251, 3);
-       vm.registerNative(string_oldToLower, 102, 1);
-       vm.registerNative(string_toLowerCase, 251, 4);
-       vm.registerNative(string_charAt, 251, 5);
-       vm.registerNative(string_charCodeAt, 251, 6);
-       vm.registerNative(string_concat, 251, 7);
-       vm.registerNative(string_indexOf, 251, 8);
-       vm.registerNative(string_lastIndexOf, 251, 9);
-       vm.registerNative(string_slice, 251, 10);
-       vm.registerNative(string_substring, 251, 11);
-       vm.registerNative(string_split, 251, 12);
-       vm.registerNative(string_substr, 251, 13);
+    vm.registerNative(string_valueOf, 251, 1);
+    vm.registerNative(string_toString, 251, 2);
+    vm.registerNative(string_oldToUpper, 102, 0);
+    vm.registerNative(string_toUpperCase, 251, 3);
+    vm.registerNative(string_oldToLower, 102, 1);
+    vm.registerNative(string_toLowerCase, 251, 4);
+    vm.registerNative(string_charAt, 251, 5);
+    vm.registerNative(string_charCodeAt, 251, 6);
+    vm.registerNative(string_concat, 251, 7);
+    vm.registerNative(string_indexOf, 251, 8);
+    vm.registerNative(string_lastIndexOf, 251, 9);
+    vm.registerNative(string_slice, 251, 10);
+    vm.registerNative(string_substring, 251, 11);
+    vm.registerNative(string_split, 251, 12);
+    vm.registerNative(string_substr, 251, 13);
     vm.registerNative(string_fromCharCode, 251, 14);
 }
 
@@ -133,21 +137,21 @@
 void
 attachStringInterface(as_object& o)
 {
-       VM& vm = getVM(o);
+    VM& vm = getVM(o);
 
-       o.init_member("valueOf", vm.getNative(251, 1));
-       o.init_member("toString", vm.getNative(251, 2));
-       o.init_member("toUpperCase", vm.getNative(251, 3));
-       o.init_member("toLowerCase", vm.getNative(251, 4));
-       o.init_member("charAt", vm.getNative(251, 5));
-       o.init_member("charCodeAt", vm.getNative(251, 6));
-       o.init_member("concat", vm.getNative(251, 7));
-       o.init_member("indexOf", vm.getNative(251, 8));
-       o.init_member("lastIndexOf", vm.getNative(251, 9));
-       o.init_member("slice", vm.getNative(251, 10));
-       o.init_member("substring", vm.getNative(251, 11));
-       o.init_member("split", vm.getNative(251, 12));
-       o.init_member("substr", vm.getNative(251, 13));
+    o.init_member("valueOf", vm.getNative(251, 1));
+    o.init_member("toString", vm.getNative(251, 2));
+    o.init_member("toUpperCase", vm.getNative(251, 3));
+    o.init_member("toLowerCase", vm.getNative(251, 4));
+    o.init_member("charAt", vm.getNative(251, 5));
+    o.init_member("charCodeAt", vm.getNative(251, 6));
+    o.init_member("concat", vm.getNative(251, 7));
+    o.init_member("indexOf", vm.getNative(251, 8));
+    o.init_member("lastIndexOf", vm.getNative(251, 9));
+    o.init_member("slice", vm.getNative(251, 10));
+    o.init_member("substring", vm.getNative(251, 11));
+    o.init_member("split", vm.getNative(251, 12));
+    o.init_member("substr", vm.getNative(251, 13));
 }
 
 // all the arguments will be converted to string and concatenated.
@@ -155,15 +159,13 @@
 string_concat(const fn_call& fn)
 {
     boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
-
-    const int swfVersion = fn.env().get_version();
-
     as_value val(fn.this_ptr);
-    
-    std::string str = val.to_string();
-
-    for (unsigned int i = 0; i < fn.nargs; i++) {
-        str += fn.arg(i).to_string_versioned(swfVersion);
+
+    std::string str;
+    const int version = getStringVersioned(fn, val, str);
+
+    for (size_t i = 0; i < fn.nargs; i++) {
+        str += fn.arg(i).to_string_versioned(version);
     }
 
     return as_value(str);
@@ -177,21 +179,8 @@
     boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
     as_value val(fn.this_ptr);
     
-    const std::string& str = val.to_string();
-
-    /// version to use is the one of the SWF containing caller code.
-    /// If callerDef is null, this calls is spontaneous (system-event?)
-    /// in which case we should research on which version should drive
-    /// behaviour.
-    /// NOTE: it is unlikely that a system event triggers string_split so
-    ///       in most cases a null callerDef means the caller forgot to 
-    ///       set the field (ie: a programmatic error)
-    if ( ! fn.callerDef )
-    {
-        log_error("No fn_call::callerDef in string_slice call");
-    }
-    const int version = fn.callerDef ? fn.callerDef->get_version() :
-        getSWFVersion(fn);
+    std::string str;
+    const int version = getStringVersioned(fn, val, str);
 
     std::wstring wstr = utf8::decodeCanonicalString(str, version);
 
@@ -203,7 +192,7 @@
 
     if (fn.nargs >= 2)
     {
-       end = validIndex(wstr, fn.arg(1).to_int());
+        end = validIndex(wstr, fn.arg(1).to_int());
 
     } 
 
@@ -246,21 +235,8 @@
     boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
     as_value val(fn.this_ptr);
     
-    const std::string& str = val.to_string();
-
-    /// version to use is the one of the SWF containing caller code.
-    /// If callerDef is null, this calls is spontaneous (system-event?)
-    /// in which case we should research on which version should drive
-    /// behaviour.
-    /// NOTE: it is unlikely that a system event triggers string_split so
-    ///       in most cases a null callerDef means the caller forgot to 
-    ///       set the field (ie: a programmatic error)
-    if (!fn.callerDef ) {
-        log_error("No fn_call::callerDef in string_split call");
-    }
-
-    const int version = fn.callerDef ? fn.callerDef->get_version() :
-        getSWFVersion(fn);
+    std::string str;
+    const int version = getStringVersioned(fn, val, str);
     
     std::wstring wstr = utf8::decodeCanonicalString(str, version);
 
@@ -305,8 +281,8 @@
         {
             // Condition 3 (plus a shortcut if the string itself
             // is empty).
-               array->push(str);
-               return as_value(array.get());            
+            array->push(str);
+            return as_value(array.get());            
         }
     }
     else
@@ -325,18 +301,19 @@
         // the delimiter is defined.
         if (fn.nargs > 1 && !fn.arg(1).is_undefined())
         {
-               int limit = fn.arg(1).to_int();
-               if (limit < 1) {
-                   // Return empty array if 
-                   return as_value(array.get());
-               }
+            int limit = fn.arg(1).to_int();
+            if (limit < 1) {
+                // Return empty array if 
+                return as_value(array.get());
+            }
             max = clamp<size_t>(limit, 0, max);
         }
 
-        // If the delimiter is empty, put each DisplayObject in an
+        // If the delimiter is empty, put each character in an
         // array element.
-        if ( delim.empty() ) {
-            for (size_t i = 0, e = wstr.size(); i < e; ++i) {
+        if (delim.empty()) {
+            for (size_t i = 0, e = std::min<size_t>(wstr.size(), max);
+                    i < e; ++i) {
                 array->push(utf8::encodeCanonicalString(wstr.substr(i, 1), 
version));
             }
             return as_value(array.get());
@@ -351,8 +328,8 @@
         pos = wstr.find(delim, pos);
 
         array->push(utf8::encodeCanonicalString(
-                               wstr.substr(prevpos, pos - prevpos),
-                               version));
+                       wstr.substr(prevpos, pos - prevpos),
+                       version));
         if (pos == std::wstring::npos) break;
         num++;
         prevpos = pos + delimiterSize;
@@ -372,11 +349,12 @@
     boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
     as_value val(fn.this_ptr);
     
-    const std::string& str = val.to_string();
+    std::string str;
+    const int version = getStringVersioned(fn, val, str);
 
     if (!checkArgs(fn, 1, 2, "String.lastIndexOf()")) return as_value(-1);
 
-    const std::string& toFind = fn.arg(0).to_string();
+    const std::string& toFind = fn.arg(0).to_string_versioned(version);
 
     int start = str.size();
 
@@ -408,9 +386,8 @@
     boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
     as_value val(fn.this_ptr);
     
-    const std::string& str = val.to_string();
-
-    const int version = getSWFVersion(fn);
+    std::string str;
+    const int version = getStringVersioned(fn, val, str);
 
     std::wstring wstr = utf8::decodeCanonicalString(str, version);
 
@@ -423,15 +400,15 @@
     if (fn.nargs >= 2 && !fn.arg(1).is_undefined())
     {
         num = fn.arg(1).to_int();
-           if ( num < 0 )
-           {
-                   if ( -num <= start ) num = 0;
-                   else
-                   {
-                           num = wstr.length() + num;
-                           if ( num < 0 ) return as_value("");
-                   }
-           }
+        if ( num < 0 )
+        {
+            if ( -num <= start ) num = 0;
+            else
+            {
+                num = wstr.length() + num;
+                if ( num < 0 ) return as_value("");
+            }
+        }
     }
 
     return as_value(utf8::encodeCanonicalString(wstr.substr(start, num), 
version));
@@ -448,18 +425,19 @@
     boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
     as_value val(fn.this_ptr);
     
-    const std::string& str = val.to_string();
-
-    const int version = getSWFVersion(fn);
+    std::string str;
+    const int version = getStringVersioned(fn, val, str);
 
     const std::wstring& wstr = utf8::decodeCanonicalString(str, version);
 
     if (!checkArgs(fn, 1, 2, "String.substring()")) return as_value(str);
 
-    int start = fn.arg(0).to_int();
+    const as_value& s = fn.arg(0);
+
+    int start = s.to_int();
     int end = wstr.size();
 
-    if (start < 0) {
+    if (s.is_undefined() || start < 0) {
         start = 0;
     }
 
@@ -467,7 +445,7 @@
         return as_value("");
     }
 
-    if (fn.nargs >= 2) {
+    if (fn.nargs >= 2 && !fn.arg(1).is_undefined()) {
         int num = fn.arg(1).to_int();
 
         if (num < 0) {
@@ -502,16 +480,17 @@
  
     /// Do not return before this, because the toString method should always
     /// be called. (TODO: test).   
-    const std::string& str = val.to_string();
+    std::string str;
+    const int version = getStringVersioned(fn, val, str);
 
     if (!checkArgs(fn, 1, 2, "String.indexOf")) return as_value(-1);
 
-    const int version = getSWFVersion(fn);
-
     const std::wstring& wstr = utf8::decodeCanonicalString(str, version);
 
     const as_value& tfarg = fn.arg(0); // to find arg
-    const std::wstring& toFind = 
utf8::decodeCanonicalString(tfarg.to_string(), version);
+    const std::wstring& toFind =
+        utf8::decodeCanonicalString(tfarg.to_string_versioned(version),
+                version);
 
     size_t start = 0;
 
@@ -520,16 +499,16 @@
         const as_value& saval = fn.arg(1); // start arg val
         int start_arg = saval.to_int();
         if ( start_arg > 0 ) start = (size_t) start_arg;
-       else
-       {
-               IF_VERBOSE_ASCODING_ERRORS(
-               if ( start_arg < 0 )
-               {
-                       log_aserror("String.indexOf(%s, %s): second argument 
casts to invalid offset (%d)",
-                               tfarg, saval, start_arg);
-               }
-               );
-       }
+    else
+    {
+        IF_VERBOSE_ASCODING_ERRORS(
+        if ( start_arg < 0 )
+        {
+            log_aserror("String.indexOf(%s, %s): second argument casts to 
invalid offset (%d)",
+                tfarg, saval, start_arg);
+        }
+        );
+    }
     }
 
     size_t pos = wstr.find(toFind, start);
@@ -591,9 +570,8 @@
     boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
     as_value val(fn.this_ptr);
     
-    const std::string& str = val.to_string();
-
-    const int version = getSWFVersion(fn);
+    std::string str;
+    const int version = getStringVersioned(fn, val, str);
 
     const std::wstring& wstr = utf8::decodeCanonicalString(str, version);
 
@@ -603,7 +581,7 @@
         )
         as_value rv;
         rv.set_nan();
-        return rv;     // Same as for out-of-range arg
+        return rv;    // Same as for out-of-range arg
     }
 
     IF_VERBOSE_ASCODING_ERRORS(
@@ -629,9 +607,8 @@
     boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
     as_value val(fn.this_ptr);
     
-    const std::string& str = val.to_string();
-
-    const int version = getSWFVersion(fn);
+    std::string str;
+    const int version = getStringVersioned(fn, val, str);
 
     if (!checkArgs(fn, 1, 1, "String.charAt()")) return as_value("");
 
@@ -665,9 +642,10 @@
     boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
     as_value val(fn.this_ptr);
 
-    const int version = getSWFVersion(fn);
+    std::string str;
+    const int version = getStringVersioned(fn, val, str);
 
-    std::wstring wstr = utf8::decodeCanonicalString(val.to_string(), version);
+    std::wstring wstr = utf8::decodeCanonicalString(str, version);
 
     // If this is the C locale, the conversion will be wrong.
     // Most other locales are correct. FIXME: get this to
@@ -702,9 +680,10 @@
     boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
     as_value val(fn.this_ptr);
     
-    const int version = getSWFVersion(fn);
+    std::string str;
+    const int version = getStringVersioned(fn, val, str);
 
-    std::wstring wstr = utf8::decodeCanonicalString(val.to_string(), version);
+    std::wstring wstr = utf8::decodeCanonicalString(str, version);
 
     // If this is the C locale, the conversion will be wrong.
     // Most other locales are correct. FIXME: get this to
@@ -763,7 +742,8 @@
 as_value
 string_valueOf(const fn_call& fn)
 {
-    return as_value(fn.this_ptr).to_string();
+    const int version = getSWFVersion(fn);
+    return as_value(fn.this_ptr).to_string_versioned(version);
 }
 
 as_value
@@ -777,24 +757,51 @@
 as_value
 string_ctor(const fn_call& fn)
 {
-       std::string str;
-       
-       if (fn.nargs) {
-               str = fn.arg(0).to_string();
-       }
-
-       if (!fn.isInstantiation())
-       {
-               return as_value(str);
-       }
-       
+    const int version = getSWFVersion(fn);
+
+    std::string str;
+
+    if (fn.nargs) {
+        str = fn.arg(0).to_string_versioned(version);
+    }
+
+    if (!fn.isInstantiation())
+    {
+        return as_value(str);
+    }
+    
     as_object* obj = fn.this_ptr;
 
     obj->setRelay(new String_as(str));
     std::wstring wstr = utf8::decodeCanonicalString(str, getSWFVersion(fn));
     obj->init_member(NSV::PROP_LENGTH, wstr.size(), as_object::DefaultFlags);
 
-       return as_value();
+    return as_value();
+}
+    
+inline int
+getStringVersioned(const fn_call& fn, const as_value& val, std::string& str)
+{
+
+    /// version to use is the one of the SWF containing caller code.
+    /// If callerDef is null, this calls is spontaneous (system-event?)
+    /// in which case we should research on which version should drive
+    /// behaviour.
+    /// NOTE: it is unlikely that a system event triggers string_split so
+    ///       in most cases a null callerDef means the caller forgot to 
+    ///       set the field (ie: a programmatic error)
+    if (!fn.callerDef) {
+        log_error("No fn_call::callerDef in string function call");
+    }
+
+    const int version = fn.callerDef ? fn.callerDef->get_version() :
+        getSWFVersion(fn);
+    
+    str = val.to_string_versioned(version);
+
+    return version;
+
+
 }
 
 /// Check the number of arguments, returning false if there

=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2009-08-27 06:40:53 +0000
+++ b/libcore/vm/ASHandlers.cpp 2009-09-29 13:33:38 +0000
@@ -884,28 +884,16 @@
     
     const as_value& strval = env.top(2);
 
-    // input checks
-    if ( strval.is_undefined() || strval.is_null() )
-    {
-    IF_VERBOSE_ASCODING_ERRORS(
-        log_aserror(_("Undefined or null string passed to ActionSubString, "
-        "returning undefined"));
-        );
-        env.drop(2);
-        env.top(0).set_undefined();
-        return;
-    }
-    
+    // Undefined values should resolve to 0.
     int size = env.top(0).to_int();
     int start = env.top(1).to_int();
 
-    // We don't need to_string_versioned because undefined values have
-    // already been dealt with.
     const int version = env.get_version();
     const std::wstring wstr = utf8::decodeCanonicalString(
-                                strval.to_string(), version);
+                                strval.to_string_versioned(version), version);
+    
 
-    if ( size < 0 )
+    if (size < 0)
     {
         IF_VERBOSE_ASCODING_ERRORS(
             log_aserror(_("Negative size passed to ActionSubString, "
@@ -914,8 +902,7 @@
         size = wstr.length();
     }
 
-    if ( size == 0 || wstr.empty() )
-    {
+    if (size == 0 || wstr.empty()) {
         env.drop(2);
         env.top(0).set_string("");
         return;
@@ -1788,27 +1775,23 @@
     
     as_environment& env = thread.env;
 
-    
+    const as_value& arg0 = env.top(0);
+    const as_value& arg1 = env.top(1);
 
+    // Undefined values should resolve to 0.
     int size = env.top(0).to_int();
     int start = env.top(1).to_int();
+
     as_value& string_val = env.top(2);
 
     IF_VERBOSE_ACTION(
-    log_action(" ActionMbSubString(%s, %d, %d)", string_val, start, size);
+    log_action(" ActionMbSubString(%s, %d, %d)", string_val, arg0, arg1);
     );
 
     env.drop(2);
 
-    if (string_val.is_undefined() || string_val.is_null())
-    {
-        log_error(_("Undefined or null string passed to ActionMBSubString, "
-            "returning undefined"));
-        env.top(0).set_undefined();
-        return;
-    }
-
-    std::string str = string_val.to_string();
+    const int version = env.get_version();
+    std::string str = string_val.to_string_versioned(version);
     int length = 0;
     std::vector<int> offsets;
 

=== modified file 'testsuite/misc-haxe.all/classes.all/media/Sound_as.hx'
--- a/testsuite/misc-haxe.all/classes.all/media/Sound_as.hx     2009-06-15 
15:52:35 +0000
+++ b/testsuite/misc-haxe.all/classes.all/media/Sound_as.hx     2009-09-29 
14:28:11 +0000
@@ -116,16 +116,6 @@
        //check properties
        DejaGnu.note("duration is returning this type: " + 
Type.typeof(x2.duration));
        
-       if (Type.typeof(x2.duration) == ValueType.TInt) {
-           DejaGnu.pass("Sound::duration property exists");
-       } else {
-           DejaGnu.xfail("Sound::duration property doesn't exist");
-       }
-       if (Type.typeof(x2.position) == ValueType.TInt) {
-               DejaGnu.pass("Sound::position property exists");
-       } else {
-               DejaGnu.xfail("Sound::position property exists");
-       }
        //check methods
        if (Type.typeof(x2.attachSound) == ValueType.TFunction) {
            DejaGnu.pass("Sound::attachSound() method exists");
@@ -196,16 +186,6 @@
                DejaGnu.fail("sound() constructor is not returning a object of 
type Sound");
        }
        
-       if (Std.string(s1.getPan()) == "undefined") {
-               DejaGnu.pass("Sound::getPan is properly returning undefined.");
-       } else {
-               DejaGnu.fail("Sound::getPan is not returning undefined as 
expected.");
-       }
-       if (Std.string(s1.getTransform()) == "undefined") {
-               DejaGnu.pass("Sound::getTransform is properly returning 
undefined.");
-       } else {
-               DejaGnu.fail("Sound::getTransform is not returning undefined as 
expected.");
-       }
        if ((s1.getVolume() == 100) && (Type.typeof(s1.getVolume()) == 
ValueType.TInt)) {
                DejaGnu.pass("Sound::getVolume has the correct default level 
(100)");
        } else {
@@ -220,21 +200,6 @@
                DejaGnu.fail("Sound::getVolume doesn't have the correct new 
level (should now be 95)");
        }
        //check more functions return vals here
-       if (Std.string(s1.getBytesLoaded()) == "undefined") {
-               DejaGnu.pass("Sound::getBytesLoaded is properly returning 
undefined.");
-       } else {
-               DejaGnu.fail("Sound::getBytesLoaded is not returning undefined 
as expected.");
-       }
-       if (Std.string(s1.getBytesTotal()) == "undefined") {
-               DejaGnu.pass("Sound::getBytesTotal is properly returning 
undefined.");
-       } else {
-               DejaGnu.fail("Sound::getBytesTotal is not returning undefined 
as expected.");
-       }
-       if (Std.string(s1.getPan()) == "undefined") {
-               DejaGnu.pass("Sound::getPan is properly returning undefined.");
-       } else {
-               DejaGnu.fail("Sound::getPan is not returning undefined as 
expected.");
-       }
        if (Std.is(s1.checkPolicyFile, Bool)) {
                DejaGnu.pass("Sound::checkPolicyFile is properly returning a 
boolean.");
        } else {
@@ -248,36 +213,11 @@
        } else {
                DejaGnu.fail("sound() constructor is not returning a object of 
type Sound when instantiated with movieclip object");
        }
-       if (Std.string(s2.getPan()) == "undefined") {
-               DejaGnu.pass("Sound::getPan is properly returning undefined.");
-       } else {
-               DejaGnu.fail("Sound::getPan is not returning undefined as 
expected.");
-       }
-       if (Std.string(s2.getTransform()) == "undefined") {
-               DejaGnu.pass("Sound::getTransform is properly returning 
undefined.");
-       } else {
-               DejaGnu.fail("Sound::getTransform is not returning undefined as 
expected.");
-       }
        if ((s2.getVolume() == 100) && (Type.typeof(s2.getVolume()) == 
ValueType.TInt)) {
                DejaGnu.pass("Sound::getVolume has the correct default level 
(100)");
        } else {
                DejaGnu.fail("Sound::getVolume doesn't have the correct default 
level (should be 100)");
        }
-       if (Std.string(s2.getBytesLoaded()) == "undefined") {
-               DejaGnu.pass("Sound::getBytesLoaded is properly returning 
undefined.");
-       } else {
-               DejaGnu.fail("Sound::getBytesLoaded is not returning undefined 
as expected.");
-       }
-       if (Std.string(s2.getBytesTotal()) == "undefined") {
-               DejaGnu.pass("Sound::getBytesTotal is properly returning 
undefined.");
-       } else {
-               DejaGnu.fail("Sound::getBytesTotal is not returning undefined 
as expected.");
-       }
-       if (Std.string(s2.getPan()) == "undefined") {
-               DejaGnu.pass("Sound::getPan is properly returning undefined.");
-       } else {
-               DejaGnu.fail("Sound::getPan is not returning undefined as 
expected.");
-       }
        if (Std.is(s2.checkPolicyFile, Bool)) {
                DejaGnu.pass("Sound::checkPolicyFile is properly returning a 
boolean.");
        } else {
@@ -291,11 +231,6 @@
        } else {
                DejaGnu.fail("sound() constructor is not returning a object of 
type Sound when instantiated with bad argument");
        }
-       if (Std.string(s3.getVolume()) == "undefined") {
-               DejaGnu.pass("getVolume is working correctly with bad 
constructor argument");
-       } else {
-               DejaGnu.fail("getVolume is not working as it should with bad 
constructor argument");
-       }
        
        //test association of Sound to characters
        var s1a:Sound = new Sound();
@@ -315,27 +250,7 @@
        //test association of Sound to characters with bad constructor args
        var s1c:Sound = new Sound(54);
        var s1d:Sound = new Sound(54);
-       if (Std.string(s1c.getVolume()) == "undefined") {
-               DejaGnu.pass("getVolume is working correctly with bad 
constructor argument");
-       } else {
-               DejaGnu.fail("getVolume is not working as it should with bad 
constructor argument");
-       }
-       if (Std.string(s1d.getVolume()) == "undefined") {
-               DejaGnu.pass("getVolume is working correctly with bad 
constructor argument");
-       } else {
-               DejaGnu.fail("getVolume is not working as it should with bad 
constructor argument");
-       }
        s1c.setVolume(54);
-       if (Std.string(s1c.getVolume()) == "undefined") {
-               DejaGnu.pass("getVolume is working correctly with bad 
constructor argument");
-       } else {
-               DejaGnu.fail("getVolume is not working as it should with bad 
constructor argument");
-       }
-       if (Std.string(s1d.getVolume()) == "undefined") {
-               DejaGnu.pass("getVolume is working correctly with bad 
constructor argument");
-       } else {
-               DejaGnu.fail("getVolume is not working as it should with bad 
constructor argument");
-       }
        var s1e:Sound = new Sound(null);
        if ((s1e.getVolume() == 76) && (Type.typeof(s1e.getVolume()) == 
ValueType.TInt)) {
                DejaGnu.pass("Sound::getVolume has the correct new level (76)");
@@ -347,27 +262,7 @@
        var o = {property : 0}; //this is a dummy object
        var s1g:Sound = new Sound(o);
        var s1h:Sound = new Sound(o);
-       if (Std.string(s1g.getVolume()) == "undefined") {
-               DejaGnu.pass("getVolume is working correctly with bad 
constructor argument");
-       } else {
-               DejaGnu.fail("getVolume is not working as it should with bad 
constructor argument");
-       }
-       if (Std.string(s1h.getVolume()) == "undefined") {
-               DejaGnu.pass("getVolume is working correctly with bad 
constructor argument");
-       } else {
-               DejaGnu.fail("getVolume is not working as it should with bad 
constructor argument");
-       }
        s1g.setVolume(54);
-       if (Std.string(s1g.getVolume()) == "undefined") {
-               DejaGnu.pass("getVolume is working correctly with bad 
constructor argument");
-       } else {
-               DejaGnu.fail("getVolume is not working as it should with bad 
constructor argument");
-       }
-       if (Std.string(s1h.getVolume()) == "undefined") {
-               DejaGnu.pass("getVolume is working correctly with bad 
constructor argument");
-       } else {
-               DejaGnu.fail("getVolume is not working as it should with bad 
constructor argument");
-       }
        
        var s2:Sound = new Sound(flash.Lib._root);
        var s3:Sound = new Sound(flash.Lib._root);

=== modified file 'testsuite/swfdec/PASSING'
--- a/testsuite/swfdec/PASSING  2009-09-29 10:30:54 +0000
+++ b/testsuite/swfdec/PASSING  2009-09-29 14:12:33 +0000
@@ -1162,6 +1162,9 @@
 string-equals-old-6.swf:844e29987eed887d1544e1fbe6f60fa7
 string-equals-old-7.swf:bdcdb87e9b4458b6935e97f4f2714bf3
 string-equals-old-8.swf:3d1bb9216c301b464060f39b2be1eb41
+string-extract-6.swf:58e6955386f659e8d1d202b6a4a7caf9
+string-extract-7.swf:bb979fa7229873dcad33b4accff0b0a6
+string-extract-8.swf:2feec91356658d931daa4fbef88b93b5
 string-fake-5.swf:bb9f63e0726197e7ed3fc318f30acd1c
 string-fake-6.swf:586770ef07ba221bf025ba2dc182d352
 string-fake-7.swf:905bc581e468d939900f55564f82a8fc
@@ -1199,6 +1202,8 @@
 string-slice-5.swf:a98bdbd8ce5ff3cfd5406d3a9d04de33
 string-slice-6.swf:cfe7fde1085617b6673fda9895162e32
 string-slice-7.swf:eaed0b05db4e5a01579a94f283f8a068
+string-split-6.swf:bd648b69bcbac7c8fb63e1ed082b0f1b
+string-split-7.swf:a2eb96d582621937150b87b18d73bfa7
 String-split-count-values-6.swf:6eccd6c628bf489d48935de4bfa6ef5a
 String-split-count-values-7.swf:1b1b8fe98fa48ed7c15455cd990d1ad7
 String-split-count-values-8.swf:390b83821fbfb9497d0660d1f57da85a


reply via email to

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