Skip to content

Commit 5e5f90c

Browse files
committed
Fix watermark tests
1 parent 777f93d commit 5e5f90c

File tree

2 files changed

+4
-31
lines changed

2 files changed

+4
-31
lines changed

plugins/ImageResizer.Plugins.Imageflow/Watermarks/WatermarkSettingsExtractor.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,16 @@ internal class WatermarkSettingsExtractor
3535
if (preprocessing["scale"] == "both")
3636
{
3737
options.FitMode = WatermarkConstraintMode.Fit;
38-
preprocessing.Remove("scale");
3938
}
39+
preprocessing.Remove("scale");
4040

4141
// Extract all FastScaling parameters that can be mapped to ResampleHints
42-
var hasResampleParams = HasResampleParameters(preprocessing);
43-
if (hasResampleParams)
44-
{
45-
options.Hints = ExtractResampleHints(preprocessing);
46-
}
42+
options.Hints = ExtractResampleHints(preprocessing);
4743

4844
// Ignore format parameter
4945
preprocessing.Remove("format");
46+
preprocessing.Remove("quality");
47+
5048

5149

5250
return (options, preprocessing);

tests/Core.Tests/WatermarkAdapterTests.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -125,31 +125,6 @@ public void ParseWatermarkGroup()
125125
Assert.Equal("~/logo2.png", options[1].path);
126126
}
127127

128-
[Fact]
129-
public void ParseOtherImagesConfiguration()
130-
{
131-
var xml = @"
132-
<watermarks>
133-
<otherimages path=""~/watermarks""
134-
right=""20px""
135-
bottom=""20px""
136-
width=""50px""
137-
height=""50px"" />
138-
</watermarks>";
139-
140-
var config = CreateConfigWithXml(xml);
141-
var adapter = new WatermarkAdapter(config);
142-
143-
// Test legacy file-based watermark
144-
var options = adapter.GetWatermarkOptions(new[] { "legacy.png" });
145-
146-
Assert.Single(options);
147-
var (watermarkOptions, path, _, cacheKey) = options[0];
148-
149-
Assert.Equal("~/watermarks/legacy.png", path);
150-
Assert.IsType<WatermarkMargins>(watermarkOptions.FitBox);
151-
}
152-
153128
[Fact]
154129
public void TextLayerGeneratesError()
155130
{

0 commit comments

Comments
 (0)