You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by ni...@apache.org on 2006/04/21 16:06:12 UTC
svn commit: r395889 -
/jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java
Author: nick
Date: Fri Apr 21 07:06:10 2006
New Revision: 395889
URL: http://svn.apache.org/viewcvs?rev=395889&view=rev
Log:
Tests to go with fix for bug 39374
Modified:
jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java
Modified: jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java
URL: http://svn.apache.org/viewcvs/jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java?rev=395889&r1=395888&r2=395889&view=diff
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java (original)
+++ jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java Fri Apr 21 07:06:10 2006
@@ -122,7 +122,7 @@
* Verify that we can add TextBox shapes to a slide
* and set some of the style attributes
*/
- public void testTextBoxWrite() throws Exception {
+ public void testTextBoxWriteBytes() throws Exception {
ppt = new SlideShow();
Slide sl = ppt.createSlide();
RichTextRun rt;
@@ -161,6 +161,51 @@
assertEquals(42, rt.getFontSize());
assertTrue(rt.isBold());
assertTrue(rt.isItalic());
+ assertFalse(rt.isUnderlined());
+ }
+
+ /**
+ * Verify that we can add TextBox shapes to a slide
+ * and set some of the style attributes, with a unicode string
+ */
+ public void testTextBoxWriteChars() throws Exception {
+ ppt = new SlideShow();
+ Slide sl = ppt.createSlide();
+ RichTextRun rt;
+
+ String val = "Hello, World! (With some \u1234 and \uffee unicode in it)";
+
+ // Create a new textbox, and give it lots of properties
+ TextBox txtbox = new TextBox();
+ txtbox.setText(val);
+ txtbox.setFontSize(42);
+ txtbox.setBold(true);
+ txtbox.setUnderline(false);
+ sl.addShape(txtbox);
+
+ // Check it before save
+ rt = txtbox.getRichTextRuns()[0];
+ assertEquals(val, rt.getText());
+ assertEquals(42, rt.getFontSize());
+ assertTrue(rt.isBold());
+ assertFalse(rt.isItalic());
+ assertFalse(rt.isUnderlined());
+
+ // Serialize and read again
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ppt.write(out);
+ out.close();
+
+ ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));
+
+ txtbox = (TextBox)sl.getShapes()[0];
+ rt = txtbox.getRichTextRuns()[0];
+
+ // Check after save
+ assertEquals(val, rt.getText());
+ assertEquals(42, rt.getFontSize());
+ assertTrue(rt.isBold());
+ assertFalse(rt.isItalic());
assertFalse(rt.isUnderlined());
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/