use of org.docx4j.dml.wordprocessingDrawing.Inline in project Java-Tutorial by gpcodervn.
the class ImageAddTest method testSize20NoUnits.
@Test
public void testSize20NoUnits() throws Exception {
// // values in dots are 20x as expected
Inline inline1 = getInline("<div><img src='" + PNG_IMAGE_DATA + "' width='20' height='20' /></div>");
Assert.assertTrue(inline1.getExtent().getCx() == 338667);
}
use of org.docx4j.dml.wordprocessingDrawing.Inline in project Java-Tutorial by gpcodervn.
the class ImageAddTest method testSizeUnspecified.
@Test
public void testSizeUnspecified() throws Exception {
Inline inline1 = getInline("<div><img src='" + PNG_IMAGE_DATA + "'/></div>");
Assert.assertTrue(inline1.getExtent().getCx() == 25400);
}
use of org.docx4j.dml.wordprocessingDrawing.Inline in project Java-Tutorial by gpcodervn.
the class ImageAddTest method testSize20px.
@Test
public void testSize20px() throws Exception {
Inline inline1 = getInline("<div><img src='" + PNG_IMAGE_DATA + "' width='20px' height='20px' /></div>");
Assert.assertTrue(inline1.getExtent().getCx() == 338667);
}
use of org.docx4j.dml.wordprocessingDrawing.Inline in project Java-Tutorial by gpcodervn.
the class ImageResizeTest method testFixedSizeImage.
@Test
public void testFixedSizeImage() throws Exception {
Inline inline1 = getInline("<div><img src='" + PNG_IMAGE_DATA + "'/></div>");
Inline inline2 = getInline("<div><img src='" + PNG_IMAGE_DATA + "' width='40px' height='20px' /></div>");
Assert.assertTrue(inline2.getExtent().getCx() / inline1.getExtent().getCx() == 26);
Assert.assertTrue(inline2.getExtent().getCy() / inline1.getExtent().getCy() == 13);
}
use of org.docx4j.dml.wordprocessingDrawing.Inline in project Java-Tutorial by gpcodervn.
the class ImageResizeTest method testScaling.
@Test
public void testScaling() throws Exception {
Inline inline = getInline("<div><img src='" + PNG_IMAGE_DATA + "' style='width: 50px'/></div>");
Assert.assertTrue(Math.round(inline.getExtent().getCx() / 10) == // +/- a few EMU
Math.round(inline.getExtent().getCy() / 10));
}
Aggregations