use of com.adobe.cq.wcm.core.components.models.Image in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ImageImplTest method testImageWithOneSmartSize.
@Test
public void testImageWithOneSmartSize() throws Exception {
String escapedResourcePath = Text.escapePath(IMAGE3_PATH);
Image image = getImageUnderTest(IMAGE3_PATH);
assertEquals(IMAGE_TITLE_ALT, image.getAlt());
assertEquals(IMAGE_TITLE_ALT, image.getTitle());
assertNull("Did not expect a file reference.", image.getFileReference());
assertFalse("Image should not display a caption popup.", image.displayPopupTitle());
assertEquals(IMAGE_LINK, image.getLink());
assertEquals(CONTEXT_PATH + escapedResourcePath + ".img.600.png", image.getSrc());
String expectedJson = "{\"smartImages\":[\"/core/content/test/jcr%3acontent/root/image3.img.600.png\"],\"smartSizes\":[600]," + "\"lazyEnabled\":false}";
compareJSON(expectedJson, 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 testImageCacheKiller.
@Test
public void testImageCacheKiller() throws Exception {
String escapedResourcePath = Text.escapePath(IMAGE4_PATH);
Image image = getImageUnderTest(IMAGE4_PATH, WCMMode.EDIT);
assertEquals(CONTEXT_PATH + escapedResourcePath + ".img.png/1494867377756.png", image.getSrc());
escapedResourcePath = Text.escapePath(IMAGE15_PATH);
image = getImageUnderTest(IMAGE15_PATH, WCMMode.EDIT);
assertEquals(CONTEXT_PATH + escapedResourcePath + ".img.png/1494867377756.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 testSimpleDecorativeImage.
@Test
@SuppressWarnings("deprecation")
@Override
protected void testSimpleDecorativeImage() {
context.contentPolicyMapping(resourceType, "uuidDisabled", true);
String escapedResourcePath = AbstractImageTest.IMAGE4_PATH.replace("jcr:content", "_jcr_content");
com.adobe.cq.wcm.core.components.models.Image image = getImageUnderTest(AbstractImageTest.IMAGE4_PATH);
assertEquals(null, image.getAlt(), "Did not expect a value for the alt attribute, since the image is marked as decorative.");
assertEquals("Adobe Systems Logo and Wordmark", image.getTitle());
assertTrue(image.displayPopupTitle());
assertEquals(null, image.getLink(), "Did not expect a link for this image, since it's marked as decorative.");
assertNull(image.getImageLink(), "Expected null link");
assertEquals(CONTEXT_PATH + escapedResourcePath + "." + selector + ".png/1494867377756/" + ASSET_NAME + ".png", image.getSrc());
assertNull(image.getSrcset());
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 testInheritedFeaturedImage_altValueFromImage_decorative.
@Test
protected void testInheritedFeaturedImage_altValueFromImage_decorative() {
Image image = getImageUnderTest(IMAGE54_PATH);
assertNull(image.getAlt(), "getAlt()");
assertEquals("/content/dam/core/images/Adobe_Systems_logo_and_wordmark.png", image.getFileReference(), "getFileReference()");
assertEquals("60a1a56e-f3f4-4021-a7bf-ac7a51f0ffe5", image.getUuid(), "getUuid()");
Utils.testJSONExport(image, Utils.getTestExporterJSONPath(testBase, IMAGE54_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 testInheritedFeaturedImage_altValueFromPageImage_decorative.
@Test
protected void testInheritedFeaturedImage_altValueFromPageImage_decorative() {
Image image = getImageUnderTest(IMAGE53_PATH);
assertNull(image.getAlt(), "getAlt()");
assertEquals("/content/dam/core/images/Adobe_Systems_logo_and_wordmark.png", image.getFileReference(), "getFileReference()");
assertEquals("60a1a56e-f3f4-4021-a7bf-ac7a51f0ffe5", image.getUuid(), "getUuid()");
Utils.testJSONExport(image, Utils.getTestExporterJSONPath(testBase, IMAGE53_PATH));
}
Aggregations