use of com.adobe.cq.wcm.core.components.models.Image in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ImageImplTest method testImageWithNoSmartSize.
@Test
protected void testImageWithNoSmartSize() {
context.contentPolicyMapping(resourceType, "uuidDisabled", true);
Image image = getImageUnderTest(AbstractImageTest.IMAGE4_PATH);
assertArrayEquals(new int[] {}, image.getWidths());
assertFalse(image.isLazyEnabled());
Utils.testJSONExport(image, Utils.getTestExporterJSONPath(testBase, AbstractImageTest.IMAGE4_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 testImageWithTwoOrMoreSmartSizes.
@Test
public void testImageWithTwoOrMoreSmartSizes() throws Exception {
String escapedResourcePath = Text.escapePath(IMAGE0_PATH);
Image image = getImageUnderTest(IMAGE0_PATH);
assertEquals(IMAGE_TITLE_ALT, image.getAlt());
assertEquals(IMAGE_TITLE_ALT, image.getTitle());
assertEquals(IMAGE_FILE_REFERENCE, image.getFileReference());
String expectedJson = "{\"smartImages\":[\"/core/content/test/jcr%3acontent/root/image0.img.600.png\"," + "\"/core/content/test/jcr%3acontent/root/image0.img.700.png\",\"/core/content/test/jcr%3acontent/root/image0" + ".img.800.png\",\"/core/content/test/jcr%3acontent/root/image0.img.2000.png\", " + "\"/core/content/test/jcr%3acontent/root/image0.img.2500.png\"],\"smartSizes\":[600,700,800,2000,2500],\"lazyEnabled\":true}";
compareJSON(expectedJson, image.getJson());
assertFalse(image.displayPopupTitle());
assertEquals("/content/test-image.html", image.getLink());
assertEquals(CONTEXT_PATH + escapedResourcePath + ".img.png", image.getSrc());
}
use of com.adobe.cq.wcm.core.components.models.Image in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ImageImplTest method testTIFFImage.
@Test
public void testTIFFImage() throws Exception {
String escapedResourcePath = Text.escapePath(IMAGE16_PATH);
Image image = getImageUnderTest(IMAGE16_PATH);
assertEquals(CONTEXT_PATH + escapedResourcePath + ".img.jpeg", image.getSrc());
}
use of com.adobe.cq.wcm.core.components.models.Image in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ImageImplTest method testSimpleDecorativeImage.
@Test
public void testSimpleDecorativeImage() throws Exception {
String escapedResourcePath = Text.escapePath(IMAGE4_PATH);
Image image = getImageUnderTest(IMAGE4_PATH);
assertNull("Did not expect a value for the alt attribute, since the image is marked as decorative.", image.getAlt());
assertNull("Did not expect a title for this image.", image.getTitle());
assertFalse("Image should not display a caption popup.", image.displayPopupTitle());
assertNull("Did not expect a link for this image, since it's marked as decorative.", image.getLink());
assertEquals(CONTEXT_PATH + escapedResourcePath + ".img.png", image.getSrc());
compareJSON("{\"" + Image.JSON_SMART_IMAGES + "\":[], \"" + Image.JSON_SMART_SIZES + "\":[], \"" + Image.JSON_LAZY_ENABLED + "\":true}", image.getJson());
}
use of com.adobe.cq.wcm.core.components.models.Image in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ImageImplTest method testNoInheritedFeaturedImage_altValueFromDAM.
@Test
protected void testNoInheritedFeaturedImage_altValueFromDAM() {
Image image = getImageUnderTest(IMAGE55_PATH);
assertEquals("transparent HD PNG", image.getAlt(), "getAlt()");
assertEquals("/content/dam/core/images/transparent_hd.png", image.getFileReference(), "getFileReference()");
assertEquals("f6460529-b7b1-4b3a-8980-b3b3f0ee109c", image.getUuid(), "getUuid()");
Utils.testJSONExport(image, Utils.getTestExporterJSONPath(testBase, IMAGE55_PATH));
}
Aggregations