[Laszlo-checkins] r13142 - in openlaszlo/trunk: WEB-INF/lps/lfc/kernel/dhtml WEB-INF/lps/lfc/kernel/swf WEB-INF/lps/lfc/kernel/swf9 WEB-INF/lps/lfc/views test/lztest

ptw@openlaszlo.org ptw at openlaszlo.org
Tue Mar 3 12:23:01 PST 2009


Author: ptw
Date: 2009-03-03 12:22:54 -0800 (Tue, 03 Mar 2009)
New Revision: 13142

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as
   openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs
   openlaszlo/trunk/test/lztest/lztest-textheight.lzx
Log:
Change 20090227-ptw-e by ptw at dueling-banjos.home on 2009-02-27 14:50:27 EST
    in /Users/ptw/OpenLaszlo/trunk-3
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Correct implementation of LzText/getTextSize

Bugs Fixed: LPP-7569  Text in scrolledittext flips after 13 characters.

Technical Reviewer: a.bargull at intensis.de, max (Message-ID: <49A935D0.40208 at udo.edu>, Message-ID: <49A8ACA3.4000300 at openlaszlo.org>)
QA Reviewer: aalappat at laszlosystems.com (pending)

Details:
    *: Note LPP-7832

    LzInputTextSprite.as: Remove incorrect override of
    getTextfieldHeight

    LzText: call correct kernel API

    lztest-textheight: Update test to match expected values per API
    documentation.  There is still one regression:

    ERROR @lztest/lztestmanager.lzx#194: In suite Text Size Test Suite, test 1, failed assertion: multiline6 text height within 43?\194?\1770 got 56

    which is due to LPP-7841.

Tests:
    Test case from bug report, smokecheck, sample apps



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js	2009-03-03 14:39:29 UTC (rev 13141)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js	2009-03-03 20:22:54 UTC (rev 13142)
@@ -117,6 +117,7 @@
     this.scrolldiv.owner = this;
 }
 
+// TODO [2009-02-27 ptw] (LPP-7832) Rename to get LineHeight
 LzInputTextSprite.prototype.getTextHeight = function() {
     var h = LzTextSprite.prototype.getTextHeight.call(this);
     var b = h;

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js	2009-03-03 14:39:29 UTC (rev 13141)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js	2009-03-03 20:22:54 UTC (rev 13142)
@@ -250,6 +250,7 @@
   return this.getTextSize(this.text, this.resize).width;
 }
 
+// TODO [2009-02-27 ptw] (LPP-7832) Rename to get LineHeight
 LzTextSprite.prototype.getTextHeight = function () {
   var h = this.getTextSize(null).height;
   if (h > 0 && this.quirks.emulate_flash_font_metrics) {

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as	2009-03-03 14:39:29 UTC (rev 13141)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as	2009-03-03 20:22:54 UTC (rev 13142)
@@ -1,7 +1,7 @@
 /**
   * LzInputTextSprite.as
   *
-  * @copyright Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.
+  * @copyright Copyright 2001-2009 Laszlo Systems, Inc.  All Rights Reserved.
   *            Use is subject to license terms.
   *
   * @topic Kernel
@@ -276,10 +276,6 @@
     this.__LZtextclip.html = htmlp;
 }
 
-LzInputTextSprite.prototype.getTextfieldHeight = function ( ){
-    return this.__LZtextclip._height
-}
-
 // This is the text without any formatting
 LzInputTextSprite.prototype.getText = function ( ){
   // We normalize swf's \r to \n

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as	2009-03-03 14:39:29 UTC (rev 13141)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as	2009-03-03 20:22:54 UTC (rev 13142)
@@ -332,6 +332,8 @@
  * a.bargull at intensis.de for finding this illustration, which shows
  * the relationship of textHeight and textfieldHeight:
  * http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/images/text-metrics.jpg
+ *
+ * TODO [2009-02-27 ptw] (LPP-7832) Rename to get LineHeight
  */
 LzTextSprite.prototype.getTextHeight = function ( ){
     if (! this.multiline) {

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as	2009-03-03 14:39:29 UTC (rev 13141)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as	2009-03-03 20:22:54 UTC (rev 13142)
@@ -165,10 +165,6 @@
         }
     }
 
-    override public function getTextfieldHeight () {
-        return this.textfield.height;
-    }
-
     /**
      * If a mouse event occurs in an input text field, find the focused view
      */

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as	2009-03-03 14:39:29 UTC (rev 13141)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as	2009-03-03 20:22:54 UTC (rev 13142)
@@ -473,6 +473,7 @@
             return twidth;
         }
 
+        // TODO [2009-02-27 ptw] (LPP-7832) Rename to get LineHeight
         public function getTextHeight ( ):Number {
             return this.textfield.textHeight;
         }

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs	2009-03-03 14:39:29 UTC (rev 13141)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LzText.lzs	2009-03-03 20:22:54 UTC (rev 13142)
@@ -1063,8 +1063,7 @@
    * Calculates the current height of the text held by the text field.
    */
   function getTextHeight ( ){
-    return this.tsprite.getTextHeight();
-    //return this.__LZtextclip.textHeight;
+    return this.tsprite.getTextfieldHeight();
   }
   /** @access private */
   function $lzc$getTextHeight_dependencies ( who , self){

Modified: openlaszlo/trunk/test/lztest/lztest-textheight.lzx
===================================================================
--- openlaszlo/trunk/test/lztest/lztest-textheight.lzx	2009-03-03 14:39:29 UTC (rev 13141)
+++ openlaszlo/trunk/test/lztest/lztest-textheight.lzx	2009-03-03 20:22:54 UTC (rev 13142)
@@ -122,25 +122,29 @@
     LzTestManager.assertWithin(48, t3.height, fudgefactor, "text3 height");
     LzTestManager.assertWithin(30, t4.height, fudgefactor, "multiline4 text height");
     LzTestManager.assertWithin(17, t5.height, fudgefactor, "text5 height");
-    LzTestManager.assertWithin(43, t6.height, fudgefactor, "multiline6 text height");
+    LzTestManager.assertWithin(43, t6.height, fudgefactor, "(EXPECTED: LPP-7841) multiline6 text height");
     LzTestManager.assertWithin(56, t7.height, fudgefactor, "multiline7 text height");
     LzTestManager.assertWithin(16, t8.height, fudgefactor, "text8 height");
     LzTestManager.assertWithin(16, t9.height, fudgefactor, "text9 height");
     LzTestManager.assertWithin(16, t10.height, fudgefactor, "text10 height");
     LzTestManager.assertWithin(56, t11.height, fudgefactor, "multiline11 text height");
-    LzTestManager.assertWithin(225, t12.height, fudgefactor, "EXPECTED: see LPP-6545. text12 height");
+    LzTestManager.assertWithin(225, t12.height, fudgefactor, "(EXPECTED: LPP-6545) text12 height");
 
-    LzTestManager.assertWithin(40, a.sprite.getTextfieldHeight(), fudgefactor, "EXPECTED: see LPP-6543. text a getTextfieldHeight()");
+    // multiline/fixed: height is the size, the other measures reflect the size of the content (which wraps)
+    LzTestManager.assertWithin(82, a.sprite.getTextfieldHeight(), fudgefactor, "text a sprite.getTextfieldHeight()");
     LzTestManager.assertWithin(40, a.height, fudgefactor, "text a height");
-    LzTestManager.assertWithin(13, a.getTextHeight(), fudgefactor, "text a getTextHeight()");
-    LzTestManager.assertWithin(82, b.sprite.getTextfieldHeight(), fudgefactor, "text b getTextfieldHeight()");
-    LzTestManager.assertWithin(13, b.getTextHeight(), fudgefactor, "text b getTextHeight()");
+    LzTestManager.assertWithin(82, a.getTextHeight(), fudgefactor, "text a getTextHeight()");
+    // multiline/resize: all values should reflect the size of the content (which wraps)
+    LzTestManager.assertWithin(82, b.sprite.getTextfieldHeight(), fudgefactor, "text b sprite.getTextfieldHeight()");
+    LzTestManager.assertWithin(82, b.getTextHeight(), fudgefactor, "text b getTextHeight()");
     LzTestManager.assertWithin(82, b.height, fudgefactor, "text b getTextfieldHeight()");
-    LzTestManager.assertWithin(40, e.sprite.getTextfieldHeight(), fudgefactor, "EXPECTED: see LPP-6543. text e getTextfieldHeight()");
-    LzTestManager.assertWithin(13, e.getTextHeight(), fudgefactor, "text e getTextHeight()");
+    // single line/fixed: content should be 1 line high, because it does not wrap
+    LzTestManager.assertWithin(17, e.sprite.getTextfieldHeight(), fudgefactor, "text e sprite.getTextfieldHeight()");
+    LzTestManager.assertWithin(17, e.getTextHeight(), fudgefactor, "text e getTextHeight()");
     LzTestManager.assertWithin(40, e.height, fudgefactor, "text e getTextfieldHeight()");
+    // single line/resize:  all values should reflect the size of the content (a single line)
     LzTestManager.assertWithin(17, f.sprite.getTextfieldHeight(), fudgefactor, "text f getTextfieldHeight()");
-    LzTestManager.assertWithin(13, f.getTextHeight(), fudgefactor, "text f getTextHeight()");
+    LzTestManager.assertWithin(17, f.getTextHeight(), fudgefactor, "text f getTextHeight()");
     LzTestManager.assertWithin(17, f.height, fudgefactor, "text f getTextfieldHeight()");
 
     LzTestManager.assertWithin(28, t13.height, fudgefactor, "text13 height");
@@ -170,17 +174,21 @@
     
     LzTestManager.assertWithin(17, tempty.height, fudgefactor, "tempty.height");
     LzTestManager.assertWithin(30, thepost.height, fudgefactor, "thepost height");
-    LzTestManager.assertWithin(40, c.sprite.getTextfieldHeight(), fudgefactor, "EXPECTED: see LPP-6543. inputtext c getTextfieldHeight()");
-    LzTestManager.assertWithin(13, c.getTextHeight(), fudgefactor, "inputtext c getTextHeight()");
+    // multiline/fixed: height is the size, the other measures reflect the size of the content (which wraps)
+    LzTestManager.assertWithin(82, c.sprite.getTextfieldHeight(), fudgefactor, "inputtext c sprite.getTextfieldHeight()");
+    LzTestManager.assertWithin(82, c.getTextHeight(), fudgefactor, "inputtext c getTextHeight()");
     LzTestManager.assertWithin(40, c.height, fudgefactor, "inputtext c height");
+    // multiline/resize: all values should reflect the size of the content (which wraps)
     LzTestManager.assertWithin(82, d.sprite.getTextfieldHeight(), fudgefactor, "inputtext d getTextfieldHeight()");
-    LzTestManager.assertWithin(13, d.getTextHeight(), fudgefactor, "inputtext d getTextHeight()");
+    LzTestManager.assertWithin(82, d.getTextHeight(), fudgefactor, "inputtext d getTextHeight()");
     LzTestManager.assertWithin(82, d.height, fudgefactor, "inputtext d height");
-    LzTestManager.assertWithin(40, g.sprite.getTextfieldHeight(), fudgefactor, "EXPECTED: see LPP-6543. inputtext g getTextfieldHeight()");
-    LzTestManager.assertWithin(13, g.getTextHeight(), fudgefactor, "inputtext g getTextHeight()");
+    // single line/fixed: content should be 1 line high, because it does not wrap
+    LzTestManager.assertWithin(17, g.sprite.getTextfieldHeight(), fudgefactor, "inputtext g sprite.getTextfieldHeight()");
+    LzTestManager.assertWithin(17, g.getTextHeight(), fudgefactor, "inputtext g getTextHeight()");
     LzTestManager.assertWithin(40, g.height, fudgefactor, "inputtext g height");
-    LzTestManager.assertWithin(17, h.sprite.getTextfieldHeight(), fudgefactor, "inputtext h getTextfieldHeight()");
-    LzTestManager.assertWithin(13, h.getTextHeight(), fudgefactor, "inputtext h getTextHeight()");
+    // single line/resize:  all values should reflect the size of the content (a single line)
+    LzTestManager.assertWithin(17, h.sprite.getTextfieldHeight(), fudgefactor, "inputtext h sprite.getTextfieldHeight()");
+    LzTestManager.assertWithin(17, h.getTextHeight(), fudgefactor, "inputtext h getTextHeight()");
     LzTestManager.assertWithin(17, h.height, fudgefactor, "inputtext h height");
     LzTestManager.assertWithin(it8.height, it9.height, fudgefactor, "inputtext 8 height");
     LzTestManager.assertWithin(t18.height, it9.height, fudgefactor, "inputtext 9 height != equivalent text height");



More information about the Laszlo-checkins mailing list