Search in sources :

Example 6 with CropSourceOptions

use of org.alfresco.service.cmr.repository.CropSourceOptions in project alfresco-repository by Alfresco.

the class TransformationOptionsConverterTest method testImageTransformationOptionsCrop.

@Test
public // Checks we do what was in the legacy ImageMagickContentTransformerWorker
void testImageTransformationOptionsCrop() {
    ImageTransformationOptions oldOptions = new ImageTransformationOptions();
    oldOptions.setAutoOrient(false);
    CropSourceOptions cropOptions = new CropSourceOptions();
    oldOptions.addSourceOptions(cropOptions);
    assertConverterToMapAndBack(oldOptions, MIMETYPE_IMAGE_JPEG, MIMETYPE_IMAGE_PNG, "ImageTransformationOptions [commandOptions=, resizeOptions=null, autoOrient=false], " + "sourceOptions={ CropSourceOptionsCropSourceOptions " + "[height=-1, width=-1, xOffset=0, yOffset=0, isPercentageCrop=false, gravity=null]} ]", "cropXOffset=0 " + "cropYOffset=0 " + "timeout=-1 ", true);
}
Also used : ImageTransformationOptions(org.alfresco.repo.content.transform.magick.ImageTransformationOptions) CropSourceOptions(org.alfresco.service.cmr.repository.CropSourceOptions) Test(org.junit.Test)

Example 7 with CropSourceOptions

use of org.alfresco.service.cmr.repository.CropSourceOptions in project alfresco-repository by Alfresco.

the class TransformationOptionsConverterTest method testImageTransformationOptionsCropPercentage.

@Test
public // Checks we do what was in the legacy ImageMagickContentTransformerWorker
void testImageTransformationOptionsCropPercentage() {
    ImageTransformationOptions oldOptions = new ImageTransformationOptions();
    oldOptions.setAutoOrient(false);
    CropSourceOptions cropOptions = new CropSourceOptions();
    cropOptions.setPercentageCrop(true);
    oldOptions.addSourceOptions(cropOptions);
    assertConverterToMapAndBack(oldOptions, MIMETYPE_IMAGE_JPEG, MIMETYPE_IMAGE_PNG, "ImageTransformationOptions [commandOptions=, resizeOptions=null, autoOrient=false], " + "sourceOptions={ CropSourceOptionsCropSourceOptions " + "[height=-1, width=-1, xOffset=0, yOffset=0, isPercentageCrop=true, gravity=null]} ]", "cropPercentage=true " + "cropXOffset=0 " + "cropYOffset=0 " + "timeout=-1 ", true);
}
Also used : ImageTransformationOptions(org.alfresco.repo.content.transform.magick.ImageTransformationOptions) CropSourceOptions(org.alfresco.service.cmr.repository.CropSourceOptions) Test(org.junit.Test)

Aggregations

ImageTransformationOptions (org.alfresco.repo.content.transform.magick.ImageTransformationOptions)7 CropSourceOptions (org.alfresco.service.cmr.repository.CropSourceOptions)7 Test (org.junit.Test)5 HashMap (java.util.HashMap)2 RuntimeExecutableContentTransformerOptions (org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerOptions)2 ImageResizeOptions (org.alfresco.repo.content.transform.magick.ImageResizeOptions)2 SWFTransformationOptions (org.alfresco.repo.content.transform.swf.SWFTransformationOptions)2 PagedSourceOptions (org.alfresco.service.cmr.repository.PagedSourceOptions)2 TemporalSourceOptions (org.alfresco.service.cmr.repository.TemporalSourceOptions)2 TransformationSourceOptions (org.alfresco.service.cmr.repository.TransformationSourceOptions)2 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 StringJoiner (java.util.StringJoiner)1 MimetypeMap (org.alfresco.repo.content.MimetypeMap)1 MIMETYPE_PDF (org.alfresco.repo.content.MimetypeMap.MIMETYPE_PDF)1