use of org.haiku.haikudepotserver.graphics.ImageHelper in project haikudepotserver by haiku.
the class PkgScreenshotControllerIT method testGet_scaling.
@Test
public void testGet_scaling() throws Exception {
IntegrationTestSupportService.StandardTestData data = integrationTestSupportService.createStandardTestData();
MockHttpServletResponse response = new MockHttpServletResponse();
// ------------------------------------
pkgScreenshotController.handleGet(response, 160, 120, "png", data.pkg1.getPkgSupplement().getSortedPkgScreenshots().get(0).getCode());
// -----------------------------------
Assertions.assertThat(response.getContentType()).isEqualTo(MediaType.PNG.toString());
ImageHelper imageHelper = new ImageHelper();
ImageHelper.Size size = imageHelper.derivePngSize(response.getContentAsByteArray());
Assertions.assertThat(size.width).isEqualTo(160);
Assertions.assertThat(size.height).isEqualTo(120);
}
Aggregations