Adds configuration section classes for the image cropping + unit tests.
This commit is contained in:
@@ -11,6 +11,25 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
[Test]
|
||||
public override void ImageCrops()
|
||||
{
|
||||
Assert.IsFalse(SettingsSection.Content.ImageCrops.SaveFiles);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public override void ImageCropItem()
|
||||
{
|
||||
Assert.AreEqual(0, SettingsSection.Content.ImageCrops.Crops.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public override void ImageCropSizes()
|
||||
{
|
||||
Assert.AreEqual(0, SettingsSection.Content.ImageCrops.Crops.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public override void DisableHtmlEmail()
|
||||
{
|
||||
Assert.IsTrue(SettingsSection.Content.DisableHtmlEmail == false);
|
||||
@@ -35,11 +54,13 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
Assert.IsTrue(SettingsSection.Content.ImageAutoFillProperties.ElementAt(0).ExtensionFieldAlias == "umbracoExtension");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public override void TidyCharEncoding()
|
||||
{
|
||||
Assert.IsTrue(SettingsSection.Content.TidyCharEncoding == "UTF8");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public override void XmlContentCheckForDiskChanges()
|
||||
{
|
||||
Assert.IsTrue(SettingsSection.Content.XmlContentCheckForDiskChanges == false);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
@@ -9,6 +11,61 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
[TestFixture]
|
||||
public class ContentElementTests : UmbracoSettingsTests
|
||||
{
|
||||
[Test]
|
||||
public virtual void ImageCrops()
|
||||
{
|
||||
Assert.AreEqual(true, SettingsSection.Content.ImageCrops.SaveFiles);
|
||||
Assert.AreEqual(2, SettingsSection.Content.ImageCrops.Crops.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public virtual void ImageCropItem()
|
||||
{
|
||||
Assert.AreEqual("image", SettingsSection.Content.ImageCrops.Crops.First().MediaTypeAlias);
|
||||
Assert.AreEqual("umbracoFocalPoint", SettingsSection.Content.ImageCrops.Crops.First().FocalPointProperty);
|
||||
Assert.AreEqual("umbracoFile", SettingsSection.Content.ImageCrops.Crops.First().FileProperty);
|
||||
Assert.AreEqual(3, SettingsSection.Content.ImageCrops.Crops.First().CropSizes.Count());
|
||||
|
||||
Assert.AreEqual("custom", SettingsSection.Content.ImageCrops.Crops.Last().MediaTypeAlias);
|
||||
Assert.AreEqual("customPoint", SettingsSection.Content.ImageCrops.Crops.Last().FocalPointProperty);
|
||||
Assert.AreEqual("customFile", SettingsSection.Content.ImageCrops.Crops.Last().FileProperty);
|
||||
Assert.AreEqual(2, SettingsSection.Content.ImageCrops.Crops.Last().CropSizes.Count());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public virtual void ImageCropSizes()
|
||||
{
|
||||
var toVerify1 = new List<Tuple<string, int, int>>
|
||||
{
|
||||
new Tuple<string, int, int>("thumb", 100, 100),
|
||||
new Tuple<string, int, int>("portrait", 320, 400),
|
||||
new Tuple<string, int, int>("banner", 620, 140),
|
||||
};
|
||||
var toVerify2 = new List<Tuple<string, int, int>>
|
||||
{
|
||||
new Tuple<string, int, int>("thumb", 100, 100),
|
||||
new Tuple<string, int, int>("banner", 600, 100),
|
||||
};
|
||||
|
||||
for (var i = 0; i < SettingsSection.Content.ImageCrops.Crops.First().CropSizes.Count(); i++)
|
||||
{
|
||||
var size = SettingsSection.Content.ImageCrops.Crops.First().CropSizes.ElementAt(i);
|
||||
var verify = toVerify1[i];
|
||||
Assert.AreEqual(verify.Item1, size.Alias);
|
||||
Assert.AreEqual(verify.Item2, size.Width);
|
||||
Assert.AreEqual(verify.Item3, size.Height);
|
||||
}
|
||||
for (var i = 0; i < SettingsSection.Content.ImageCrops.Crops.Last().CropSizes.Count(); i++)
|
||||
{
|
||||
var size = SettingsSection.Content.ImageCrops.Crops.Last().CropSizes.ElementAt(i);
|
||||
var verify = toVerify2[i];
|
||||
Assert.AreEqual(verify.Item1, size.Alias);
|
||||
Assert.AreEqual(verify.Item2, size.Width);
|
||||
Assert.AreEqual(verify.Item3, size.Height);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EmailAddress()
|
||||
{
|
||||
|
||||
@@ -21,6 +21,17 @@
|
||||
<extensionFieldAlias>umbracoExtension2</extensionFieldAlias>
|
||||
</uploadField>
|
||||
</autoFillImageProperties>
|
||||
<crops saveFiles="true">
|
||||
<crop mediaTypeAlias="image" focalPointProperty="umbracoFocalPoint" fileProperty="umbracoFile">
|
||||
<add alias="thumb" width="100" height="100" />
|
||||
<add alias="portrait" width="320" height="400" />
|
||||
<add alias="banner" width="620" height="140" />
|
||||
</crop>
|
||||
<crop mediaTypeAlias="custom" focalPointProperty="customPoint" fileProperty="customFile">
|
||||
<add alias="thumb" width="100" height="100" />
|
||||
<add alias="banner" width="600" height="100" />
|
||||
</crop>
|
||||
</crops>
|
||||
</imaging>
|
||||
<scripteditor>
|
||||
<!-- Path to script folder - no ending "/" -->
|
||||
|
||||
Reference in New Issue
Block a user