Search in sources :

Example 1 with PictureData

use of org.apache.poi.hslf.usermodel.PictureData 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));
}
Also used : AutoShape(org.apache.poi.hslf.model.AutoShape) Shape(org.apache.poi.hslf.model.Shape) Picture(org.apache.poi.hslf.model.Picture) AutoShape(org.apache.poi.hslf.model.AutoShape) TextBox(org.apache.poi.hslf.model.TextBox) PictureData(org.apache.poi.hslf.usermodel.PictureData)

Aggregations

AutoShape (org.apache.poi.hslf.model.AutoShape)1 Picture (org.apache.poi.hslf.model.Picture)1 Shape (org.apache.poi.hslf.model.Shape)1 TextBox (org.apache.poi.hslf.model.TextBox)1 PictureData (org.apache.poi.hslf.usermodel.PictureData)1