Merge pull request #362 from Jeavon/U4-4767
Fixes U4 4767 and adds 2 Tests
This commit is contained in:
@@ -92,5 +92,25 @@ namespace Umbraco.Tests.PropertyEditors
|
||||
var urlString = mediaPath.GetCropUrl(imageCropperValue: cropperJson, width: 300, height: 150, ratioMode: ImageCropRatioMode.Width);
|
||||
Assert.AreEqual(mediaPath + "?center=0.80827067669172936,0.96&mode=crop&height=150&widthratio=2", urlString);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test that if Crop mode is specified as anything other than Crop the image doesn't use the crop
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void GetCropUrl_SpecifiedCropModeTest()
|
||||
{
|
||||
var urlString = mediaPath.GetCropUrl(imageCropperValue: cropperJson, width: 300, height: 150, imageCropMode:ImageCropMode.Max);
|
||||
Assert.AreEqual(mediaPath + "?mode=max&width=300&height=150", urlString);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test for upload property type
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void GetCropUrl_UploadTypeTest()
|
||||
{
|
||||
var urlString = mediaPath.GetCropUrl(width: 100, height: 270, imageCropMode: ImageCropMode.Crop, imageCropAnchor: ImageCropAnchor.Center);
|
||||
Assert.AreEqual(mediaPath + "?mode=crop&anchor=center&width=100&height=270", urlString);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,7 +215,7 @@ namespace Umbraco.Web
|
||||
{
|
||||
var imageResizerUrl = new StringBuilder();
|
||||
|
||||
if (string.IsNullOrEmpty(imageCropperValue) == false && imageCropperValue.DetectIsJson())
|
||||
if (string.IsNullOrEmpty(imageCropperValue) == false && imageCropperValue.DetectIsJson() && (imageCropMode == ImageCropMode.Crop || imageCropMode == null))
|
||||
{
|
||||
var cropDataSet = imageCropperValue.SerializeToCropDataSet();
|
||||
if (cropDataSet != null)
|
||||
|
||||
Reference in New Issue
Block a user