You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2012/03/01 10:51:29 UTC

svn commit: r1295488 - in /poi/trunk/src: documentation/content/xdocs/status.xml scratchpad/src/org/apache/poi/hslf/model/TextRun.java scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java

Author: yegor
Date: Thu Mar  1 09:51:28 2012
New Revision: 1295488

URL: http://svn.apache.org/viewvc?rev=1295488&view=rev
Log:
bugzilla 52682 - allow setting text with trailing carriage return in HSLF

Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=1295488&r1=1295487&r2=1295488&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Thu Mar  1 09:51:28 2012
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.8-beta6" date="2012-??-??">
+           <action dev="poi-developers" type="fix">52682 - allow setting text with trailing carriage return in HSLF</action>
            <action dev="poi-developers" type="fix">52244 - use correct text attributes when presentation has multiple TxMasterStyleAtoms of the same type</action>
            <action dev="poi-developers" type="add">support setting background color of sheet tab in XSSF</action>
            <action dev="poi-developers" type="add">51564 - support for enforcing fields update in XWPF</action>

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java?rev=1295488&r1=1295487&r2=1295488&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java Thu Mar  1 09:51:28 2012
@@ -320,12 +320,6 @@ public final class TextRun
 	 *  touch the stylings.
 	 */
 	private void storeText(String s) {
-		// Remove a single trailing \r, as there is an implicit one at the
-		//  end of every record
-		if(s.endsWith("\r")) {
-			s = s.substring(0, s.length()-1);
-		}
-
 		// Store in the appropriate record
 		if(_isUnicode) {
 			// The atom can safely convert to unicode

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java?rev=1295488&r1=1295487&r2=1295488&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTextRun.java Thu Mar  1 09:51:28 2012
@@ -100,9 +100,9 @@ public final class TestTextRun extends T
 		run.setText(changeTo);
 		assertEquals(changeTo, run.getText());
 
-		// Ensure trailing \n's get stripped
+		// Ensure trailing \n's are NOT stripped, it is legal to set a text with a trailing '\r'
 		run.setText(changeTo + "\n");
-		assertEquals(changeTo, run.getText());
+		assertEquals(changeTo + "\n", run.getText());
 	}
 
 	/**



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org