I am trying to test with Robolectric or AndroidJUnit4 some pdf generation in my android application (using android.graphics.pdf.PdfDocument
).
@Test
fun testPdfDocument() {
val doc = PdfDocument()
val builder = PdfDocument.PageInfo.Builder(20, 10, 1)
val pdf = builder.create()
assertEquals(0, doc.pages.size)
val page = doc.startPage(pdf) // java.lang.IllegalStateException: document is closed!
doc.finishPage(page)
assertEquals(1, doc.pages.size)
}
The code above crashes, with java.lang.IllegalStateException: document is closed!
. Any idea why?
Aucun commentaire:
Enregistrer un commentaire