mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
extend test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1925505 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ebd9a8bc9a
commit
dce1a83169
@ -390,7 +390,7 @@ public class XSSFRichTextString implements RichTextString {
|
|||||||
* Return a copy of the font in use at a particular index.
|
* Return a copy of the font in use at a particular index.
|
||||||
*
|
*
|
||||||
* @param index The index.
|
* @param index The index.
|
||||||
* @return A copy of the font that's currently being applied at that
|
* @return A copy of the font that's currently being applied at that
|
||||||
* index or null if no font is being applied or the
|
* index or null if no font is being applied or the
|
||||||
* index is out of range.
|
* index is out of range.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -90,7 +90,7 @@ class TestXSSFTextParagraph {
|
|||||||
text.setBulletFontColor(color);
|
text.setBulletFontColor(color);
|
||||||
assertEquals(color, text.getBulletFontColor());
|
assertEquals(color, text.getBulletFontColor());
|
||||||
|
|
||||||
final byte[] colorBytes = new byte[] { (byte) 255, 127, 0 };
|
final byte[] colorBytes = new byte[]{(byte) 255, 127, 0};
|
||||||
text.setBulletFontColor(colorBytes);
|
text.setBulletFontColor(colorBytes);
|
||||||
assertArrayEquals(colorBytes, text.getBulletFontColorAsBytes());
|
assertArrayEquals(colorBytes, text.getBulletFontColorAsBytes());
|
||||||
|
|
||||||
@ -196,4 +196,32 @@ class TestXSSFTextParagraph {
|
|||||||
new XSSFTextParagraph(text.getXmlObject(), shape.getCTShape());
|
new XSSFTextParagraph(text.getXmlObject(), shape.getCTShape());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testXSSFTextParagraph2() throws IOException {
|
||||||
|
try (XSSFWorkbook wb = new XSSFWorkbook()) {
|
||||||
|
XSSFSheet sheet = wb.createSheet();
|
||||||
|
XSSFDrawing drawing = sheet.createDrawingPatriarch();
|
||||||
|
|
||||||
|
XSSFTextBox shape = drawing.createTextbox(new XSSFClientAnchor(0, 0, 0, 0, 2, 2, 3, 4));
|
||||||
|
XSSFTextRun run = shape.getTextParagraphs().get(0).getTextRuns().get(0);
|
||||||
|
final byte[] colorBytes = new byte[]{0, (byte) 255, (byte) 255};
|
||||||
|
run.setFont("Arial");
|
||||||
|
run.setFontColor(colorBytes);
|
||||||
|
run.setText("Test String");
|
||||||
|
|
||||||
|
List<XSSFTextParagraph> paras = shape.getTextParagraphs();
|
||||||
|
assertEquals(1, paras.size());
|
||||||
|
|
||||||
|
XSSFTextParagraph text = paras.get(0);
|
||||||
|
assertEquals("Test String", text.getText());
|
||||||
|
|
||||||
|
List<XSSFTextRun> runs = text.getTextRuns();
|
||||||
|
assertEquals(1, runs.size());
|
||||||
|
XSSFTextRun run2 = runs.get(0);
|
||||||
|
assertEquals(run.getText(), run2.getText());
|
||||||
|
assertEquals(run.getFontFamily(), run2.getFontFamily());
|
||||||
|
assertArrayEquals(run.getFontColorAsBytes(), run2.getFontColorAsBytes());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user