-
-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added method to remove the settings to IKmeansSettingsExtensions.
- Loading branch information
Showing
4 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...T.Tests/Shared/Extensions/IKmeansSettingsExtensionsTests/TheRemoveImageArtifactsMethod.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2013-2020 Dirk Lemstra <https://github.com/dlemstra/Magick.NET/> | ||
// | ||
// Licensed under the ImageMagick License (the "License"); you may not use this file except in | ||
// compliance with the License. You may obtain a copy of the License at | ||
// | ||
// https://www.imagemagick.org/script/license.php | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed under the | ||
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
// either express or implied. See the License for the specific language governing permissions | ||
// and limitations under the License. | ||
|
||
using ImageMagick; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Magick.NET.Tests | ||
{ | ||
public partial class IKmeansSettingsExtensionsTests | ||
{ | ||
[TestClass] | ||
public class TheRemoveImageArtifactsMethod | ||
{ | ||
[TestMethod] | ||
public void ShouldRemoveSeedColors() | ||
{ | ||
using (var image = new MagickImage()) | ||
{ | ||
var settings = new KmeansSettings() | ||
{ | ||
SeedColors = "red;blue", | ||
}; | ||
|
||
settings.SetImageArtifacts(image); | ||
settings.RemoveImageArtifacts(image); | ||
|
||
Assert.IsNull(image.GetArtifact("kmeans:seed-colors")); | ||
} | ||
} | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
....NET.Tests/Shared/Extensions/IKmeansSettingsExtensionsTests/TheSetImageArtifactsMethod.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2013-2020 Dirk Lemstra <https://github.com/dlemstra/Magick.NET/> | ||
// | ||
// Licensed under the ImageMagick License (the "License"); you may not use this file except in | ||
// compliance with the License. You may obtain a copy of the License at | ||
// | ||
// https://www.imagemagick.org/script/license.php | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed under the | ||
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
// either express or implied. See the License for the specific language governing permissions | ||
// and limitations under the License. | ||
|
||
using ImageMagick; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Magick.NET.Tests | ||
{ | ||
public partial class IKmeansSettingsExtensionsTests | ||
{ | ||
[TestClass] | ||
public class TheSetImageArtifactsMethod | ||
{ | ||
[TestMethod] | ||
public void ShouldNotSetTheAttributesWhenTheyAreNotSpecified() | ||
{ | ||
using (var image = new MagickImage()) | ||
{ | ||
var settings = new KmeansSettings(); | ||
|
||
settings.SetImageArtifacts(image); | ||
|
||
Assert.IsNull(image.GetArtifact("kmeans:seed-colors")); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void ShouldSetSeedColors() | ||
{ | ||
using (var image = new MagickImage()) | ||
{ | ||
var settings = new KmeansSettings() | ||
{ | ||
SeedColors = "red;blue", | ||
}; | ||
|
||
settings.SetImageArtifacts(image); | ||
|
||
Assert.AreEqual("red;blue", image.GetArtifact("kmeans:seed-colors")); | ||
} | ||
} | ||
} | ||
} | ||
} |