* Verify that we can add TextBox shapes to a slide\r
* and set some of the style attributes\r
*/\r
- public void testTextBoxWrite() throws Exception {\r
+ public void testTextBoxWriteBytes() throws Exception {\r
ppt = new SlideShow();\r
Slide sl = ppt.createSlide();\r
RichTextRun rt;\r
assertTrue(rt.isItalic());\r
assertFalse(rt.isUnderlined());\r
}\r
+\r
+ /**\r
+ * Verify that we can add TextBox shapes to a slide\r
+ * and set some of the style attributes, with a unicode string\r
+ */\r
+ public void testTextBoxWriteChars() throws Exception {\r
+ ppt = new SlideShow();\r
+ Slide sl = ppt.createSlide();\r
+ RichTextRun rt;\r
+\r
+ String val = "Hello, World! (With some \u1234 and \uffee unicode in it)";\r
+\r
+ // Create a new textbox, and give it lots of properties\r
+ TextBox txtbox = new TextBox();\r
+ txtbox.setText(val);\r
+ txtbox.setFontSize(42);\r
+ txtbox.setBold(true);\r
+ txtbox.setUnderline(false);\r
+ sl.addShape(txtbox);\r
+\r
+ // Check it before save\r
+ rt = txtbox.getRichTextRuns()[0];\r
+ assertEquals(val, rt.getText());\r
+ assertEquals(42, rt.getFontSize());\r
+ assertTrue(rt.isBold());\r
+ assertFalse(rt.isItalic());\r
+ assertFalse(rt.isUnderlined());\r
+\r
+ // Serialize and read again\r
+ ByteArrayOutputStream out = new ByteArrayOutputStream();\r
+ ppt.write(out);\r
+ out.close();\r
+\r
+ ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));\r
+\r
+ txtbox = (TextBox)sl.getShapes()[0];\r
+ rt = txtbox.getRichTextRuns()[0];\r
+\r
+ // Check after save\r
+ assertEquals(val, rt.getText());\r
+ assertEquals(42, rt.getFontSize());\r
+ assertTrue(rt.isBold());\r
+ assertFalse(rt.isItalic());\r
+ assertFalse(rt.isUnderlined());\r
+ }\r
}\r