PowerPoint testing library
Make sure your code always generates correct and valid PPTX files (from PowerPoint 2007 version and later)!
Just add assertThat from Hamcrest and enjoy ))
import PPTX;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import static PPTX.containsText;
import static org.hamcrest.MatcherAssert.assertThat;
public class ContainsTextTests {
@Test
void canAssertThatPptxContainsText() throws IOException {
PPTX pptx = new PPTX(getClass().getClassLoader().getResource("TestPPTX.pptx"));
assertThat(pptx, containsText("lacinia nisi. Ut ac dolor vitae odio"));
assertThat(pptx, containsText("My pretty chart"));
assertThat(pptx, containsText("37.12%"));
assertThat(pptx, containsText("Beehive State (official), The Mormon State"));
}
}
Just copy jar-file into lib
directory of your project and make import in IntelliJ IDEA (Project structure - Modules - Dependencies).
If you use Gradle, please add the following dependency to build.gradle:
dependencies {
testImplementation files('lib/pptx-test.jar')
}
Many thanks to Andrei Solntsev and his project xls-test for the inspiration.
pptx-test is open-source project and distributed under MIT license