[Laszlo-dev] [Laszlo-checkins] r5751 - openlaszlo/branches/legals/test/extensions

P T Withington ptw at openlaszlo.org
Mon Jul 23 13:37:04 PDT 2007


So, by offering to help you with this, you have been spurred to fix it?

And all that was missing was a utility method?

On 2007-07-23, at 15:23 EDT, ben at openlaszlo.org wrote:

> Author: ben
> Date: 2007-07-23 12:23:55 -0700 (Mon, 23 Jul 2007)
> New Revision: 5751
>
> Modified:
>    openlaszlo/branches/legals/test/extensions/test-lzunit- 
> richinputtext.lzx
> Log:
> Change 20070723-ben-W by ben at cooper.local on 2007-07-23 12:19:57 PDT
>     in /Users/ben/src/svn/openlaszlo/branches/legals
>     for http://svn.openlaszlo.org/openlaszlo/branches/legals
>
> Summary: Repair richinputtext lzunit test for legals
>
> New Features:
>
> Bugs Fixed: (partial) LPP-3431 Ensure richtext and richtexteditor  
> work in OL4/SWF
>
> Technical Reviewer: none
> QA Reviewer: none
> Doc Reviewer: none
>
> Documentation:
>
> Release Notes:
>
> Details:
> This change makes the richinputtext lzunit test pass in swf7 and  
> swf8 in legals.
> THIS TEST WILL FAIL IN DHTML; that is expected, because  
> richinputtext is not
> supported in DHTML.
>
> Tests:
> http://localhost:8080/legals/test/extensions/test-lzunit- 
> richinputtext.lzx?lzr=swf7
> http://localhost:8080/legals/test/extensions/test-lzunit- 
> richinputtext.lzx?lzr=swf8
>
>
>
> Modified: openlaszlo/branches/legals/test/extensions/test-lzunit- 
> richinputtext.lzx
> ===================================================================
> --- openlaszlo/branches/legals/test/extensions/test-lzunit- 
> richinputtext.lzx	2007-07-23 06:43:29 UTC (rev 5750)
> +++ openlaszlo/branches/legals/test/extensions/test-lzunit- 
> richinputtext.lzx	2007-07-23 19:23:55 UTC (rev 5751)
> @@ -2,8 +2,13 @@
>      <include href="lzunit"/>
>      <include href="/extensions/views/richinputtext.lzx" />
>      <include href="/extensions/views/LzTextFormat.lzx" />
> -    <include href="/utils/textutils.lzx" />
>
> +<script>
> +    // a little replace function, just to help with testing and such
> +    function replace(s, f, r) {
> +        return s.split(f).join(r);
> +    }
> +</script>
>      <class name="RichTextTestBase" extends="TestCase">
>          <!--- Constant for testing. -->
>          <attribute name="PLAIN_A" type="string" value="aaa." />
> @@ -43,7 +48,7 @@
>
>          <method name="testFixCRs">
>              var str = new String(PLAIN_A + "\r" + PLAIN_B);
> -            var foo = textutils.replace(str, "\r", "");
> +            var foo = replace(str, "\r", "");
>              assertSame(PLAIN_A  + PLAIN_B, foo);
>          </method>
>
> @@ -51,27 +56,27 @@
>              var orig = "I am a little teapot.";
>              var findme = "t";
>              var replacewith = "!";
> -            var processed = textutils.replace(orig, findme,  
> replacewith);
> +            var processed = replace(orig, findme, replacewith);
>              assertSame("I am a li!!le !eapo!.", processed)
>
>              // single replacement at beginning of the string
> -            processed = textutils.replace("twelve", findme,  
> replacewith);
> +            processed = replace("twelve", findme, replacewith);
>              assertSame("!welve", processed)
>
>              // single replacement in middle of the string
> -            processed = textutils.replace("lite", findme,  
> replacewith);
> +            processed = replace("lite", findme, replacewith);
>              assertSame("li!e", processed)
>
>              // test single replacement at end of string
> -            processed = textutils.replace("great", findme,  
> replacewith);
> +            processed = replace("great", findme, replacewith);
>              assertSame("grea!", processed)
>
>              // test two replacements in a row
> -            processed = textutils.replace("utter", findme,  
> replacewith);
> +            processed = replace("utter", findme, replacewith);
>              assertSame("u!!er", processed)
>
>              // test complete replacement
> -            processed = textutils.replace("tttttt", findme,  
> replacewith);
> +            processed = replace("tttttt", findme, replacewith);
>              assertSame("!!!!!!", processed)
>
>
> @@ -113,7 +118,8 @@
>          <method name="testAppendHTMLFudge">
>              rich.appendText(RICH_B, true);
>              var after = rich.getText();
> -            var munge = textutils.replace(after, "\r", "");
> +            var munge = replace(after, "\r", "");
> +            munge = replace(munge, "\n", "");
>              assertSame(PLAIN_A + PLAIN_RICH_B, munge);
>          </method>
>
> @@ -165,7 +171,8 @@
>          <method name="testAppendHTML">
>              rich.appendText(RICH_B, true);
>              var after = rich.getText();
> -            var munge = textutils.replace(after, "\r", "");
> +            var munge = replace(after, "\r", "");
> +            munge = replace(munge, "\n", "");
>              assertSame(PLAIN_RICH_A + PLAIN_RICH_B, munge);
>          </method>
>
> @@ -173,7 +180,8 @@
>              rich.appendText(RICH_B, true);
>              rich.appendText(RICH_C, true);
>              var after = rich.getText();
> -            var munge = textutils.replace(after, "\r", "");
> +            var munge = replace(after, "\r", "");
> +            munge = replace(munge, "\n", "");
>              assertSame(PLAIN_RICH_A + PLAIN_RICH_B + PLAIN_RICH_C,  
> munge);
>          </method>
>      </class>
> @@ -360,7 +368,7 @@
>              rich.setHTMLText(newstr);
>              var f = rich.getTextFormat(LONG_A.length,  
> LONG_A.length + 1);
>              assertEquals("Verdana", f.font);
> -            var pt = textutils.replace(rich.getText(), "\r", "");
> +            var pt = replace(rich.getText(), "\r", "");
>              assertEquals(LONG_A + PLAIN_A, pt);
>          </method>
>      </class>
> @@ -424,7 +432,7 @@
>              // Make sure that setting the default actually sets  
> the default,
>              // but doesn't change the format of the existing text
>              rich.setDefaultFormat(myformat);
> -            sameFormat(myFormat, rich.defaultformat);
> +            sameFormat(myformat, rich.defaultformat);
>              var afterChangingDefault = rich.getTextFormat(0,  
> rich.getText().length);
>              sameFormat(initialFormat, afterChangingDefault);
>          </method>
>
>
> _______________________________________________
> Laszlo-checkins mailing list
> Laszlo-checkins at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins



More information about the Laszlo-dev mailing list