XSLFSlideLayout layout = slide.getSlideLayout();
XSLFShape[] shapes = slide.getShapes();
assertEquals("Two Content",layout.getName());
XSLFTextShape shape1 = (XSLFTextShape)shapes[0];
CTPlaceholder ph1 = shape1.getCTPlaceholder();
assertEquals(STPlaceholderType.TITLE, ph1.getType());
// anchor is not defined in the shape
assertNull(shape1.getSpPr().getXfrm());
XSLFTextShape masterShape1 = (XSLFTextShape)layout.getPlaceholder(ph1);
// layout does not have anchor info either, it is in the slide master
assertNull(masterShape1.getSpPr().getXfrm());
masterShape1 = (XSLFTextShape)layout.getSlideMaster().getPlaceholder(ph1);
assertNotNull(masterShape1.getSpPr().getXfrm());
assertEquals(masterShape1.getAnchor(), shape1.getAnchor());
CTTextBodyProperties bodyPr1 = shape1.getTextBodyPr();
// none of the following properties are set in the shapes and fetched from the master shape
assertTrue(
!bodyPr1.isSetLIns() && !bodyPr1.isSetRIns() &&
!bodyPr1.isSetBIns() && !bodyPr1.isSetTIns() &&
!bodyPr1.isSetAnchor()
);
assertEquals(7.2, shape1.getLeftInset()); // 0.1"
assertEquals(7.2, shape1.getRightInset()); // 0.1"
assertEquals(3.6, shape1.getTopInset()); // 0.05"
assertEquals(3.6, shape1.getBottomInset()); // 0.05"
assertEquals(VerticalAlignment.MIDDLE, shape1.getVerticalAlignment());
// now check text properties
assertEquals("Title", shape1.getText());
XSLFTextRun r1 = shape1.getTextParagraphs().get(0).getTextRuns().get(0);
assertEquals(TextAlign.CENTER, r1.getParentParagraph().getTextAlign());
assertEquals("Calibri", r1.getFontFamily());
assertEquals(44.0, r1.getFontSize());
assertEquals(Color.black, r1.getFontColor());
XSLFTextShape shape2 = (XSLFTextShape)shapes[1];
CTPlaceholder ph2 = shape2.getCTPlaceholder();
assertFalse(ph2.isSetType());
assertTrue(ph2.isSetIdx());
assertEquals(1, ph2.getIdx()); //<p:ph sz="half" idx="1"/>
// anchor is not defined in the shape
assertNull(shape2.getSpPr().getXfrm());
XSLFTextShape masterShape2 = (XSLFTextShape)layout.getPlaceholder(ph2);
assertNotNull(masterShape2.getSpPr().getXfrm());