use of com.adobe.cq.wcm.core.components.models.Image in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ImageImplTest method testSVGImage.
@Test
protected void testSVGImage() {
Image image = getImageUnderTest(IMAGE22_PATH);
assertEquals(0, image.getWidths().length);
}
use of com.adobe.cq.wcm.core.components.models.Image in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ImageImplTest method testDMAnimatedGif.
@Test
void testDMAnimatedGif() {
context.contentPolicyMapping(ImageImpl.RESOURCE_TYPE, Image.PN_DESIGN_DYNAMIC_MEDIA_ENABLED, true);
Image image = getImageUnderTest(IMAGE40_PATH);
assertTrue(image.isDmImage());
Utils.testJSONExport(image, Utils.getTestExporterJSONPath(TEST_BASE, IMAGE40_PATH));
}
use of com.adobe.cq.wcm.core.components.models.Image in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ImageImplTest method testDMImageWithSmartCropRendition.
protected void testDMImageWithSmartCropRendition(String resourceType) {
context.contentPolicyMapping(resourceType, Image.PN_DESIGN_DYNAMIC_MEDIA_ENABLED, true);
Image image = getImageUnderTest(IMAGE36_PATH);
assertTrue(image.isDmImage());
Utils.testJSONExport(image, Utils.getTestExporterJSONPath(testBase, IMAGE36_PATH));
}
use of com.adobe.cq.wcm.core.components.models.Image in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ImageImplTest method testDMImageWithAutoSmartCropTwoSmartSizes.
protected void testDMImageWithAutoSmartCropTwoSmartSizes(String resourceType) {
context.contentPolicyMapping(resourceType, new HashMap<String, Object>() {
{
put(Image.PN_DESIGN_DYNAMIC_MEDIA_ENABLED, true);
put(Image.PN_DESIGN_ALLOWED_RENDITION_WIDTHS, new int[] { 600, 800 });
}
});
Image image = getImageUnderTest(IMAGE38_PATH);
assertTrue(image.isDmImage());
Utils.testJSONExport(image, Utils.getTestExporterJSONPath(testBase, IMAGE38_PATH + "-two-smart-sizes"));
}
use of com.adobe.cq.wcm.core.components.models.Image in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ImageImplTest method testImageFromTemplateStructureNoDate.
@Test
@SuppressWarnings("deprecation")
@Override
protected void testImageFromTemplateStructureNoDate() {
context.contentPolicyMapping(resourceType, "allowedRenditionWidths", new int[] { 600, 700, 800, 2000, 2500 });
com.adobe.cq.wcm.core.components.models.Image image = getImageUnderTest(TEMPLATE_IMAGE_NO_DATE_PATH);
assertEquals(CONTEXT_PATH + "/conf/coretest/settings/wcm/templates/testtemplate/structure." + selector + ".png/structure/jcr%3acontent/root/image_template_no_date.png", image.getSrc());
assertEquals("Adobe Systems Logo and Wordmark in PNG format", image.getAlt());
assertEquals("Adobe Systems Logo and Wordmark", image.getTitle());
assertEquals(IMAGE_FILE_REFERENCE_NO_DATE, image.getFileReference());
String expectedJson = "{" + "\"smartImages\":[" + "\"/core/conf/coretest/settings/wcm/templates/testtemplate/structure." + selector + "." + JPEG_QUALITY + ".600.png/structure/jcr%3acontent/root/image_template_no_date.png\",\"/core/conf/coretest/settings/wcm/templates/testtemplate/structure." + selector + "." + JPEG_QUALITY + ".700.png/structure/jcr%3acontent/root/image_template_no_date.png\", \"/core/conf/coretest/settings/wcm/templates/testtemplate/structure." + selector + "." + JPEG_QUALITY + ".800.png/structure/jcr%3acontent/root/image_template_no_date.png\"," + "\"/core/conf/coretest/settings/wcm/templates/testtemplate/structure." + selector + "." + JPEG_QUALITY + "." + "2000.png/structure/jcr%3acontent/root/image_template_no_date.png\"," + "\"/core/conf/coretest/settings/wcm/templates/testtemplate/structure." + selector + "." + JPEG_QUALITY + ".2500.png/structure/jcr%3acontent/root/image_template_no_date.png\"" + "]," + "\"smartSizes\":[600,700,800,2000,2500]," + "\"lazyEnabled\":false" + "}";
compareJSON(expectedJson, image.getJson());
assertTrue(image.displayPopupTitle());
assertEquals(CONTEXT_PATH + "/content/test-image.html", image.getLink());
Utils.testJSONExport(image, Utils.getTestExporterJSONPath(testBase, TEMPLATE_IMAGE_NO_DATE_PATH));
}
Aggregations