Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Apr 7, 2022
2 parents 453edb1 + 50b9f70 commit bfb3efe
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
6 changes: 6 additions & 0 deletions changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
<body>

<release version="1.14.2" date="2022-04-07">
<action type="fix" dev="cnagel" issue="WHAN-51">
Autocropped DAM renditions should not have fallback flag.
</action>
</release>

<release version="1.14.0" date="2022-03-14">
<action type="add" dev="sseifert">
Enable media handler pre- and post-processor by setting media as invalid via a MediaInvalidReason.CUSTOM accompanied with a custom message.
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
<parent>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.parent_toplevel</artifactId>
<version>2.0.0</version>
<version>2.0.2</version>
<relativePath/>
</parent>

<groupId>io.wcm</groupId>
<artifactId>io.wcm.handler.media</artifactId>
<version>1.14.0</version>
<version>1.14.2</version>
<packaging>jar</packaging>

<name>Media Handler</name>
Expand All @@ -49,7 +49,7 @@
<site.url.module.prefix>handler/media</site.url.module.prefix>

<!-- Enable reproducible builds -->
<project.build.outputTimestamp>2022-03-14T16:54:52Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2022-04-07T12:41:33Z</project.build.outputTimestamp>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ class DamRendition extends SlingAdaptable implements Rendition {
renditionHandler = new DefaultRenditionHandler(damContext);
resolvedRendition = renditionHandler.getRendition(mediaArgs);
}
fallback = true;
if (resolvedRendition != null) {
fallback = true;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.apache.sling.api.resource.ModifiableValueMap;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
Expand Down Expand Up @@ -689,18 +690,22 @@ void testMultipleMandatoryMediaFormatsWithCropping_AlsoMatchOriginal_AutoCrop()
assertEquals("/content/dam/test/sixteen-ten.jpg/_jcr_content/renditions/original.image_file.84.40.0,0,840,400.file/sixteen-ten.jpg",
renditions.get(0).getUrl(), "rendition.mediaUrl.1");
assertEquals(SHOWROOM_CONTROLS, renditions.get(0).getMediaFormat());

assertEquals("/content/dam/test/sixteen-ten.jpg/_jcr_content/renditions/original./sixteen-ten.jpg",
renditions.get(1).getUrl(), "rendition.mediaUrl.2");
assertEquals(RATIO, renditions.get(1).getMediaFormat());
assertFalse(renditions.get(0).isFallback());

assertEquals("/content/dam/test/sixteen-ten.jpg/_jcr_content/renditions/original.image_file.1333.1000.134,0,1467,1000.file/sixteen-ten.jpg",
renditions.get(2).getUrl(), "rendition.mediaUrl.1");
assertEquals(RATIO2, renditions.get(2).getMediaFormat());
renditions.get(1).getUrl(), "rendition.mediaUrl.1");
assertEquals(RATIO2, renditions.get(1).getMediaFormat());
assertFalse(renditions.get(1).isFallback());

assertEquals("/content/dam/test/sixteen-ten.jpg/_jcr_content/renditions/original.image_file.960.150.0,375,1600,625.file/sixteen-ten.jpg",
renditions.get(3).getUrl(), "rendition.mediaUrl.1");
assertEquals(EDITORIAL_STAGE_SMALL, renditions.get(3).getMediaFormat());
renditions.get(2).getUrl(), "rendition.mediaUrl.1");
assertEquals(EDITORIAL_STAGE_SMALL, renditions.get(2).getMediaFormat());
assertFalse(renditions.get(2).isFallback());

assertEquals("/content/dam/test/sixteen-ten.jpg/_jcr_content/renditions/original./sixteen-ten.jpg",
renditions.get(3).getUrl(), "rendition.mediaUrl.2");
assertEquals(RATIO, renditions.get(3).getMediaFormat());
assertTrue(renditions.get(3).isFallback());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ void testInvalidManualCroppingParametersFallbackToAutoCropping() {
Rendition rendition = media.getRendition();
assertEquals(320, rendition.getWidth());
assertEquals(200, rendition.getHeight());
assertFalse(rendition.isFallback());
assertEquals("/content/dam/test.jpg/_jcr_content/renditions/original.image_file.320.200.40,0,360,200.file/test.jpg", media.getUrl());
}

Expand Down

0 comments on commit bfb3efe

Please sign in to comment.