use of org.haiku.haikudepotserver.api1.model.pkg.GetPkgScreenshotsRequest in project haikudepotserver by haiku.
the class PkgApiIT method testGetPkgScreenshots.
/**
* <p>This test depends on the sample package pkg1 having some screenshots associated with it.</p>
*/
@Test
public void testGetPkgScreenshots() {
IntegrationTestSupportService.StandardTestData data = integrationTestSupportService.createStandardTestData();
// ------------------------------------
GetPkgScreenshotsResult result = pkgApi.getPkgScreenshots(new GetPkgScreenshotsRequest(data.pkg1.getName()));
// ------------------------------------
PkgSupplement pkgSupplement = data.pkg1.getPkgSupplement();
Assertions.assertThat(result.items.size()).isEqualTo(pkgSupplement.getPkgScreenshots().size());
List<org.haiku.haikudepotserver.dataobjects.PkgScreenshot> sortedScreenshots = pkgSupplement.getSortedPkgScreenshots();
Assertions.assertThat(sortedScreenshots).hasSize(3);
int[] widths = { 320, 240, 320 };
int[] heights = { 240, 320, 240 };
int[] lengths = { 41296, 28303, 33201 };
for (int i = 0; i < sortedScreenshots.size(); i++) {
org.haiku.haikudepotserver.dataobjects.PkgScreenshot pkgScreenshot = sortedScreenshots.get(i);
PkgScreenshot apiPkgScreenshot = result.items.get(i);
Assertions.assertThat(pkgScreenshot.getCode()).isEqualTo(apiPkgScreenshot.code);
Assertions.assertThat(pkgScreenshot.getWidth()).isEqualTo(apiPkgScreenshot.width);
Assertions.assertThat(pkgScreenshot.getHeight()).isEqualTo(apiPkgScreenshot.height);
Assertions.assertThat(pkgScreenshot.getLength()).isEqualTo(apiPkgScreenshot.length);
Assertions.assertThat(apiPkgScreenshot.width).isEqualTo(widths[i]);
Assertions.assertThat(apiPkgScreenshot.height).isEqualTo(heights[i]);
Assertions.assertThat(apiPkgScreenshot.length).isEqualTo(lengths[i]);
}
}
Aggregations