use of org.apache.poi.hslf.model.AutoShape in project ddf by codice.
the class RrdMetricsRetrieverTest method verifySlide.
private void verifySlide(Slide slide, String metricName, boolean hasTotalCount) {
assertThat(slide, not(nullValue()));
Shape[] shapes = slide.getShapes();
assertThat(shapes, not(nullValue()));
// expected shapes: title text box, metric's graph, metric's total count text box
int numExpectedShapes = 2;
int numExpectedTextBoxes = 1;
if (hasTotalCount) {
numExpectedShapes++;
numExpectedTextBoxes++;
}
assertThat(shapes.length, equalTo(numExpectedShapes));
Picture picture = null;
int numTextBoxes = 0;
for (int i = 0; i < numExpectedShapes; i++) {
if (shapes[i] instanceof Picture) {
picture = (Picture) shapes[i];
// title text box is actually an AutoShape
} else if (shapes[i] instanceof TextBox || shapes[i] instanceof AutoShape) {
numTextBoxes++;
}
}
assertThat(picture, not(nullValue()));
PictureData picData = picture.getPictureData();
assertThat(picData, not(nullValue()));
assertThat(picData.getType(), equalTo(Picture.PNG));
assertThat(numTextBoxes, equalTo(numExpectedTextBoxes));
}
Aggregations