Search in sources :

Example 51 with Image

use of com.adobe.cq.wcm.core.components.models.Image in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ImageImplTest method testInheritedPageImage_pageImageAltValueFromDAM.

@Test
protected void testInheritedPageImage_pageImageAltValueFromDAM() {
    Image image = getImageUnderTest(PAGE1_IMAGE0_PATH);
    assertEquals("/core/content/test_page1/_jcr_content/root/page1_image0.coreimg.png/1490005239000/adobe-systems-logo-and-wordmark.png", image.getSrc(), "getSrc()");
    assertEquals("Adobe Systems Logo and Wordmark in PNG format", 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()");
    assertEquals("image-6401b77a35", image.getId(), "getId()");
    Utils.testJSONExport(image, Utils.getTestExporterJSONPath(testBase, PAGE1_IMAGE0_PATH));
}
Also used : Image(com.adobe.cq.wcm.core.components.models.Image) AbstractImageTest(com.adobe.cq.wcm.core.components.internal.models.v1.AbstractImageTest) Test(org.junit.jupiter.api.Test)

Example 52 with Image

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.

@Override
@Test
protected void testImageWithNoSmartSize() {
    context.contentPolicyMapping(resourceType, "uuidDisabled", true);
    Image image = getImageUnderTest(AbstractImageTest.IMAGE4_PATH);
    assertArrayEquals(new int[] {}, image.getWidths());
    assertTrue(image.isLazyEnabled());
    Utils.testJSONExport(image, Utils.getTestExporterJSONPath(testBase, AbstractImageTest.IMAGE4_PATH));
}
Also used : Image(com.adobe.cq.wcm.core.components.models.Image) AbstractImageTest(com.adobe.cq.wcm.core.components.internal.models.v1.AbstractImageTest) Test(org.junit.jupiter.api.Test)

Example 53 with Image

use of com.adobe.cq.wcm.core.components.models.Image in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ImageImplTest method testGetSrcUriTemplate.

@Test
protected void testGetSrcUriTemplate() {
    Image image = getImageUnderTest(AbstractImageTest.IMAGE3_PATH);
    assertEquals("/core/content/test/_jcr_content/root/image3.coreimg{.width}.png", image.getSrcUriTemplate());
}
Also used : Image(com.adobe.cq.wcm.core.components.models.Image) AbstractImageTest(com.adobe.cq.wcm.core.components.internal.models.v1.AbstractImageTest) Test(org.junit.jupiter.api.Test)

Example 54 with Image

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.

@Test
protected void testInheritedFeaturedImage_altValueFromImage() {
    Image image = getImageUnderTest(IMAGE52_PATH);
    assertEquals("image52 alt", 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, IMAGE52_PATH));
}
Also used : Image(com.adobe.cq.wcm.core.components.models.Image) AbstractImageTest(com.adobe.cq.wcm.core.components.internal.models.v1.AbstractImageTest) Test(org.junit.jupiter.api.Test)

Example 55 with Image

use of com.adobe.cq.wcm.core.components.models.Image in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ImageImplTest method testInheritedPageImage_pageImageAltValueFromResource.

@Test
protected void testInheritedPageImage_pageImageAltValueFromResource() {
    Image image = getImageUnderTest(PAGE2_IMAGE0_PATH);
    assertEquals("/core/content/test_page2/_jcr_content/root/page2_image0.coreimg.png/1490005239000/adobe-systems-logo-and-wordmark.png", image.getSrc(), "getSrc()");
    assertEquals("featured image alt", 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()");
    assertEquals("image-310f56f715", image.getId(), "getId()");
    Utils.testJSONExport(image, Utils.getTestExporterJSONPath(testBase, PAGE2_IMAGE0_PATH));
}
Also used : Image(com.adobe.cq.wcm.core.components.models.Image) AbstractImageTest(com.adobe.cq.wcm.core.components.internal.models.v1.AbstractImageTest) Test(org.junit.jupiter.api.Test)

Aggregations

Image (com.adobe.cq.wcm.core.components.models.Image)84 Test (org.junit.jupiter.api.Test)57 AbstractImageTest (com.adobe.cq.wcm.core.components.internal.models.v1.AbstractImageTest)46 Test (org.junit.Test)5 Matchers.anyString (org.mockito.Matchers.anyString)5 Page (com.day.cq.wcm.api.Page)3 PageManager (com.day.cq.wcm.api.PageManager)3 Resource (org.apache.sling.api.resource.Resource)3 Link (com.adobe.cq.wcm.core.components.commons.link.Link)2 LinkHandler (com.adobe.cq.wcm.core.components.internal.link.LinkHandler)2 CoreResourceWrapper (com.adobe.cq.wcm.core.components.internal.resource.CoreResourceWrapper)2 ImageArea (com.adobe.cq.wcm.core.components.models.ImageArea)2 Teaser (com.adobe.cq.wcm.core.components.models.Teaser)2 DownloadResource (com.day.cq.commons.DownloadResource)2 ImageResource (com.day.cq.commons.ImageResource)2 Template (com.day.cq.wcm.api.Template)2 Style (com.day.cq.wcm.api.designer.Style)2 StringReader (java.io.StringReader)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2