Search in sources :

Example 26 with ImageTransformationOptions

use of org.alfresco.repo.content.transform.magick.ImageTransformationOptions in project alfresco-repository by Alfresco.

the class TransformationOptionsConverterTest method testImageTransformationOptionsCropOffset.

@Test
public // Checks we do what was in the legacy ImageMagickContentTransformerWorker
void testImageTransformationOptionsCropOffset() {
    ImageTransformationOptions oldOptions = new ImageTransformationOptions();
    oldOptions.setAutoOrient(false);
    CropSourceOptions cropOptions = new CropSourceOptions();
    cropOptions.setXOffset(20);
    cropOptions.setYOffset(59);
    oldOptions.addSourceOptions(cropOptions);
    assertConverterToMapAndBack(oldOptions, MIMETYPE_IMAGE_JPEG, MIMETYPE_IMAGE_PNG, "ImageTransformationOptions [commandOptions=, resizeOptions=null, autoOrient=false], " + "sourceOptions={ CropSourceOptionsCropSourceOptions " + "[height=-1, width=-1, xOffset=20, yOffset=59, isPercentageCrop=false, gravity=null]} ]", "cropXOffset=20 " + "cropYOffset=59 " + "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 27 with ImageTransformationOptions

use of org.alfresco.repo.content.transform.magick.ImageTransformationOptions in project alfresco-repository by Alfresco.

the class TransformationOptionsConverterTest method testResize.

// ImageTransformationOptions [commandOptions=, resizeOptions=ImageResizeOptions [width=20, height=30, maintainAspectRatio=true, percentResize=false,
// resizeToThumbnail=false, allowEnlargement=true], autoOrient=true], sourceOptions={ PagedSourceOptionsPagedSourceOptions {1, 1}} ]
@Test
public void testResize() {
    ImageTransformationOptions oldOptions = new ImageTransformationOptions();
    ImageResizeOptions imageResizeOptions = new ImageResizeOptions();
    imageResizeOptions.setAllowEnlargement(false);
    imageResizeOptions.setWidth(20);
    imageResizeOptions.setHeight(30);
    oldOptions.setResizeOptions(imageResizeOptions);
    PagedSourceOptions pagedSourceOptions = new PagedSourceOptions();
    pagedSourceOptions.setStartPageNumber(1);
    pagedSourceOptions.setEndPageNumber(1);
    oldOptions.addSourceOptions(pagedSourceOptions);
    assertConverterToMapAndBack(oldOptions, MIMETYPE_IMAGE_JPEG, MIMETYPE_IMAGE_PNG, "ImageTransformationOptions [commandOptions=, " + "resizeOptions=ImageResizeOptions [width=20, height=30, maintainAspectRatio=true, " + "percentResize=false, resizeToThumbnail=false, allowEnlargement=false], autoOrient=true], " + "sourceOptions={ PagedSourceOptionsPagedSourceOptions {1, 1}} ]", "allowEnlargement=false " + "autoOrient=true " + "endPage=0 " + "resizeHeight=30 " + "resizeWidth=20 " + "startPage=0 " + "timeout=-1 ", true);
}
Also used : ImageTransformationOptions(org.alfresco.repo.content.transform.magick.ImageTransformationOptions) ImageResizeOptions(org.alfresco.repo.content.transform.magick.ImageResizeOptions) PagedSourceOptions(org.alfresco.service.cmr.repository.PagedSourceOptions) Test(org.junit.Test)

Example 28 with ImageTransformationOptions

use of org.alfresco.repo.content.transform.magick.ImageTransformationOptions 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 29 with ImageTransformationOptions

use of org.alfresco.repo.content.transform.magick.ImageTransformationOptions 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)

Example 30 with ImageTransformationOptions

use of org.alfresco.repo.content.transform.magick.ImageTransformationOptions in project alfresco-repository by Alfresco.

the class TransformationOptionsConverterTest method testImageTransformationOptionsResize.

@Test
public // Checks we do what was in the legacy ImageMagickContentTransformerWorker
void testImageTransformationOptionsResize() {
    ImageTransformationOptions oldOptions = new ImageTransformationOptions();
    oldOptions.setAutoOrient(false);
    ImageResizeOptions imageResizeOptions = new ImageResizeOptions();
    oldOptions.setResizeOptions(imageResizeOptions);
    assertConverterToMapAndBack(oldOptions, MIMETYPE_IMAGE_JPEG, MIMETYPE_IMAGE_PNG, "ImageTransformationOptions [commandOptions=, " + "resizeOptions=ImageResizeOptions [width=-1, height=-1, maintainAspectRatio=true, " + "percentResize=false, resizeToThumbnail=false, allowEnlargement=true], autoOrient=false]]", "timeout=-1 ", true);
}
Also used : ImageTransformationOptions(org.alfresco.repo.content.transform.magick.ImageTransformationOptions) ImageResizeOptions(org.alfresco.repo.content.transform.magick.ImageResizeOptions) Test(org.junit.Test)

Aggregations

ImageTransformationOptions (org.alfresco.repo.content.transform.magick.ImageTransformationOptions)35 Test (org.junit.Test)26 ImageResizeOptions (org.alfresco.repo.content.transform.magick.ImageResizeOptions)22 NodeRef (org.alfresco.service.cmr.repository.NodeRef)8 PagedSourceOptions (org.alfresco.service.cmr.repository.PagedSourceOptions)8 HashMap (java.util.HashMap)7 AbstractContentTransformerTest (org.alfresco.repo.content.transform.AbstractContentTransformerTest)7 CropSourceOptions (org.alfresco.service.cmr.repository.CropSourceOptions)7 BaseAlfrescoSpringTest (org.alfresco.util.BaseAlfrescoSpringTest)7 Serializable (java.io.Serializable)5 SWFTransformationOptions (org.alfresco.repo.content.transform.swf.SWFTransformationOptions)4 TemporalSourceOptions (org.alfresco.service.cmr.repository.TemporalSourceOptions)3 TransformationSourceOptions (org.alfresco.service.cmr.repository.TransformationSourceOptions)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 RuntimeExecutableContentTransformerOptions (org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerOptions)2 ThumbnailParentAssociationDetails (org.alfresco.service.cmr.thumbnail.ThumbnailParentAssociationDetails)2 BufferedImage (java.awt.image.BufferedImage)1 Arrays (java.util.Arrays)1