gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11348: Modified tabStops property a


From: Sharad Desai
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11348: Modified tabStops property and should now return proper return type
Date: Thu, 30 Jul 2009 15:37:46 -0600
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11348
committer: Sharad Desai <address@hidden>
branch nick: trunk
timestamp: Thu 2009-07-30 15:37:46 -0600
message:
  Modified tabStops property and should now return proper return type
modified:
  .bzrignore
  libcore/TextField.cpp
  libcore/TextField.h
  libcore/asobj/TextFormat_as.cpp
  testsuite/actionscript.all/TextFormat.as
  testsuite/libmedia.all/test_videoinput.cpp
    ------------------------------------------------------------
    revno: 11342.2.1
    committer: Sharad Desai <address@hidden>
    branch nick: desai_Jul29
    timestamp: Thu 2009-07-30 15:34:40 -0600
    message:
      Modified tabStops property and should now return proper return type
    modified:
      .bzrignore
      libcore/TextField.cpp
      libcore/TextField.h
      libcore/asobj/TextFormat_as.cpp
      testsuite/actionscript.all/TextFormat.as
      testsuite/libmedia.all/test_videoinput.cpp
=== modified file '.bzrignore'
--- a/.bzrignore        2009-05-19 10:04:09 +0000
+++ b/.bzrignore        2009-07-30 21:34:40 +0000
@@ -336,3 +336,5 @@
 testsuite/libnet.all/generate_amfbins
 gui/gtk_widget/gnash.c
 py-compile
+testsuite/libmedia.all/test_videoinput.cpp
+testsuite/libmedia.all/test_videoinput.cpp

=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp     2009-07-30 21:19:45 +0000
+++ b/libcore/TextField.cpp     2009-07-30 21:37:46 +0000
@@ -1147,7 +1147,7 @@
     }
     else
     {
-        std::vector<int> tabStops;
+               std::vector<int> tabStops;
         tabStops = _tabStops;
         
         std::sort(_tabStops.begin(), _tabStops.end()); 
@@ -1172,14 +1172,14 @@
                        // This is necessary in case the number of tabs in the 
text
                        // are more than the actual number of tabStops inside 
the 
                        // vector
-                       if ( !(tab == _tabStops.back()+1) ) {
+                       if ( !(tab == _tabStops.back()+1) ) 
+                       {
                                SWF::TextRecord::GlyphEntry ge;
                                ge.index = rec.getFont()->get_glyph_index(32, 
_embedFonts);
                                ge.advance = tab;
                                rec.addGlyph(ge);
                                x+=ge.advance;
                        }
-
         }
         else
         {
@@ -1422,10 +1422,8 @@
 void
 TextField::newLine(std::wstring::const_iterator& it, boost::int32_t& x,
         boost::int32_t& y, SWF::TextRecord& rec, int& last_space_glyph,
-        LineStarts::value_type& last_line_start_record, float div,
-               bool bullet)
+        LineStarts::value_type& last_line_start_record, float div)
 {
-       _bullet = bullet;
     // newline.
     LineStarts::iterator linestartit = _line_starts.begin();
     LineStarts::const_iterator linestartend = _line_starts.end();
@@ -1565,8 +1563,7 @@
             case 13:
             case 10:
             {
-                newLine(it,x,y,rec,last_space_glyph,last_line_start_record,1.0,
-                                               false);
+                
newLine(it,x,y,rec,last_space_glyph,last_line_start_record,1.0);
                 break;
             }
             case '<':
@@ -1697,6 +1694,8 @@
                         } else if (s == "LI") {
                             //list item (bullet)
                             log_unimpl("<li> html tag in TextField");
+                                                       handleChar(it, e, x, y, 
newrec, last_code,
+                                    last_space_glyph, last_line_start_record);
                         } else if (s == "SPAN") {
                             //span
                             log_unimpl("<span> html tag in TextField");
@@ -1784,12 +1783,12 @@
                             if (_display == BLOCK)
                             {
                                 newLine(it, x, y, rec, last_space_glyph,
-                                        last_line_start_record, 1.5,false);
+                                        last_line_start_record, 1.5);
                                 handleChar(it, e, x, y, newrec, last_code,
                                         last_space_glyph,
                                         last_line_start_record);
                                 newLine(it, x, y, rec, last_space_glyph,
-                                        last_line_start_record, 1.0,false);
+                                        last_line_start_record, 1.0);
                             }
                             else
                             {
@@ -1800,7 +1799,7 @@
                         } else if (s == "BR") {
                             //line break
                                                        newLine(it, x, y, rec, 
last_space_glyph,
-                                                                               
last_line_start_record, 1.0,false);
+                                                                               
last_line_start_record, 1.0);
                         } else {
                             log_debug("<%s> tag is unsupported", s);
                             if (!selfclosing) { //then recurse, look for 
closing tag
@@ -2541,6 +2540,7 @@
     }
 }
 
+// ADDED
 void          
 TextField::setBullet(bool b)
 {              
@@ -2549,6 +2549,7 @@
     }
 }
 
+// ADDED
 void 
 TextField::setTabStops(const std::vector<int>& tabStops)
 {
@@ -2558,10 +2559,12 @@
                _tabStops[i] = PIXEL_RATIO * tabStops[i];
        }
        
+    format_text();
     set_invalidated();
 }
 
-void
+// ADDED
+void 
 TextField::setURL(std::string url)
 { 
     if ( _url != url ) {

=== modified file 'libcore/TextField.h'
--- a/libcore/TextField.h       2009-07-30 21:27:22 +0000
+++ b/libcore/TextField.h       2009-07-30 21:37:46 +0000
@@ -24,6 +24,7 @@
 #include "Range2d.h"
 #include "rect.h" // for inlines
 #include "Font.h" // for visibility of font add_ref/drop_ref
+#include "Array_as.h"
 
 #include <vector>
 
@@ -558,7 +559,7 @@
        /// will hopefully make code cleaner
        void newLine(std::wstring::const_iterator& it, boost::int32_t& x,
             boost::int32_t& y, SWF::TextRecord& rec, int& last_space_glyph,
-            LineStarts::value_type& last_line_start_record, float div, bool 
bullet);
+            LineStarts::value_type& last_line_start_record, float div);
                                        
        /// De-reference and do appropriate action for character iterator
        void handleChar(std::wstring::const_iterator& it,

=== modified file 'libcore/asobj/TextFormat_as.cpp'
--- a/libcore/asobj/TextFormat_as.cpp   2009-07-29 20:59:13 +0000
+++ b/libcore/asobj/TextFormat_as.cpp   2009-07-30 21:34:40 +0000
@@ -31,6 +31,7 @@
 #include "GnashNumeric.h"
 #include "Array_as.h"
 
+
 namespace gnash {
 
 // Forward declarations
@@ -288,64 +289,22 @@
 textformat_tabStops(const fn_call& fn)
 {
        boost::intrusive_ptr<TextFormat_as> ptr = 
ensureType<TextFormat_as>(fn.this_ptr);
+       
+       as_value ret;
                
-       as_value ret;
-       
        if (!fn.nargs)
        {
                return ret;
        }
        
-       std::string strVal = fn.arg(0).to_string();
-       std::stringstream ss;
-       int countComma = 0;
-       int countSpace = 0;
-       int countTab = 0;
-       
-       // Next check is to see whether there is a comma and a space in the 
-       // array
-       for (size_t i=0; i<strVal.length(); i++)
-       {
-               if (strVal[i]==(char)44)
-               {
-                       countComma ++;
-               }
-               
-               if (strVal[i]==(char)32)
-               {
-                       countSpace ++;
-               }
-               
-               if (strVal[i]==(char)9)
-               { 
-                       countTab ++;
-               }
-       }
-       
-       for (size_t i=0; i<strVal.length(); i++)
-       {
-               switch(strVal[i])
-               {
-                       case (char)44:
-                               strVal[i] = (char)44;
-                       case (char)9:
-                               strVal[i] = (char)32;
-                       default:
-                               break;
-               }
-       }
-
-       int numInt = countComma + countSpace + countTab + 1;
-       std::vector<int> tabStops(numInt);
-       
-       ss << strVal;
+       boost::intrusive_ptr<Array_as> tStops = 
+            ensureType<Array_as>(fn.arg(0).to_object(*getGlobal(fn)));
                        
-       int val;
-       
-       for (int i = 0; i < numInt; ++i)
+       std::vector<int> tabStops(tStops->size());
+
+       for (size_t i = 0; i !=tStops->size(); ++i)
        {
-               ss >> val;
-               tabStops[i] = val;
+               tabStops[i]=tStops->at(i).to_number();
        }
 
        if ( fn.nargs == 0)     // getter

=== modified file 'testsuite/actionscript.all/TextFormat.as'
--- a/testsuite/actionscript.all/TextFormat.as  2009-07-28 07:25:34 +0000
+++ b/testsuite/actionscript.all/TextFormat.as  2009-07-30 21:34:40 +0000
@@ -102,6 +102,18 @@
 check_equals(tfObj.size, 2);
 check_equals(tfObj.font, 'fname');
 
+tf = new TextFormat();
+
+o = {};
+//o.valueOf = function() { return 6; };
+o.toString = function() { return "string"; };
+
+a = [ o ];
+
+tf.tabStops = a;
+trace(tf.tabStops);
+
+
 
 
 check_totals(63);

=== modified file 'testsuite/libmedia.all/test_videoinput.cpp'
--- a/testsuite/libmedia.all/test_videoinput.cpp        2009-07-29 22:25:15 
+0000
+++ b/testsuite/libmedia.all/test_videoinput.cpp        2009-07-30 21:34:40 
+0000
@@ -391,136 +391,6 @@
     } else {
         runtest.fail("there's no new vidoutput.ogg file!");
     }
-    //delete the old vidoutput.ogg file
-    if (unlink(file.c_str()) == 0) {
-        g_print("        NOTE: deleting output file...\n");
-    }
-    
-    //end unit tests
-    
-    //tests more similar to execution flow
-    gst::VideoInputGst *video = new VideoInputGst;
-    if (video == NULL) {
-        runtest.fail("new VideoInputGst didn't work");
-    } else {
-        runtest.pass("new VideoInputGst returned a value");
-    }
-    
-    //get global webcam reference for use below
-    GnashWebcamPrivate *global;
-    global = video->getGlobalWebcam();
-    if (global == NULL) {
-        runtest.fail("couldn't get a globalwebcam video reference");
-    } else {
-        runtest.pass("got a globalWebcam reference");
-    }
-    
-    if (global->_pipeline == NULL) {
-        runtest.fail("video->_globalWebcam->_pipeline isn't there");
-    } else {
-        runtest.pass("video->_globalWebcam->_pipeline is initialized");
-    }
-    if (global->_webcamSourceBin == NULL) {
-        runtest.fail("webcamSourceBin isn't there");
-    } else {
-        runtest.pass("webcamSourceBin was made by the initializer");
-    }
-    if (global->_webcamMainBin == NULL) {
-        runtest.fail("webcamMainBin isn't there");
-    } else {
-        runtest.pass("webcamMainBin was made by the initializer");
-    }
-    if (global->_videoDisplayBin == NULL) {
-        runtest.fail("videoDisplayBin isn't there");
-    } else {
-        runtest.pass("videoDisplayBin was made by the initializer");
-    }
-    if (global->_videoSaveBin == NULL) {
-        runtest.fail("videoSaveBin isn't there");
-    } else {
-        runtest.pass("videoSaveBin was made by the initializer");
-    }
-    
-    result = video->webcamMakeVideoDisplayLink(global);
-    if (result != true) {
-        runtest.fail("webcamMakeVideoDisplayLink reported errors");
-    } else {
-        runtest.pass("webcamMakeVideoDisplayLink reported no errors");
-    }
-    
-    result = video->webcamPlay(global);
-    if (result != true) {
-        runtest.fail("webcamPlay reported errors");
-    } else {
-        runtest.pass("webcamPlay reported no errors");
-    }
-
-    g_print("        NOTE: sleeping for 5 seconds here....\n");
-    sleep(5);
-    
-    result = video->webcamStop(global);
-    if (result != true) {
-        runtest.fail("webcamStop reported errors");
-    } else {
-        runtest.pass("webcamStop reported no errors");
-    }
-    
-    g_print("        NOTE: changing values (display window should be 
bigger)....\n");
-    global->_fps = 30;
-    global->_xResolution = 800;
-    global->_yResolution = 600;
-    result = video->webcamChangeSourceBin(global);
-    if (result != true) {
-        runtest.fail("webcamChangeSourceBin reported an error");
-    } else {
-        runtest.pass("webcamChangeSourceBin reported no errors");
-    }
-    
-    result = video->webcamPlay(global);
-    if (result != true) {
-        runtest.fail("webcamPlay reported errors");
-    } else {
-        runtest.pass("webcamPlay reported no errors");
-    }
-
-    g_print("        NOTE: sleeping for 5 seconds here....\n");
-    sleep(5);
-    
-    result = video->webcamStop(global);
-    if (result != true) {
-        runtest.fail("webcamStop reported errors");
-    } else {
-        runtest.pass("webcamStop reported no errors");
-    }
-    
-    result = video->webcamMakeVideoSaveLink(global);
-    if (result != true) {
-        runtest.fail("webcamMakeVideoSaveLink reported errors");
-    } else {
-        runtest.pass("webcamMakeVideoSaveLink reported no errors");
-    }
-    
-    result = video->webcamPlay(global);
-    if (result != true) {
-        runtest.fail("webcamPlay reported errors");
-    } else {
-        runtest.pass("webcamPlay reported no errors");
-    }
-
-    g_print("        NOTE: sleeping for 5 seconds here....\n");
-    sleep(5);
-    
-    result = video->webcamStop(global);
-    if (result != true) {
-        runtest.fail("webcamStop reported errors");
-    } else {
-        runtest.pass("webcamStop reported no errors");
-    }
-    if (stat(file.c_str(), &st) == 0) {
-        runtest.pass("the a new vidoput.ogg file was created");
-    } else {
-        runtest.fail("there's no new vidoutput.ogg file!");
-    }
 }
 
 


reply via email to

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