Skip to content

Commit

Permalink
Test build for libvips/libvips@b4f4b04
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke committed Oct 3, 2023
1 parent 46208ed commit c533ba2
Show file tree
Hide file tree
Showing 7 changed files with 667 additions and 360 deletions.
5 changes: 0 additions & 5 deletions samples/NetVips.Samples/Samples/GenerateEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ private string Generate()

foreach (var name in allEnums)
{
if (name.StartsWith("Gsf"))
{
continue;
}

var gtype = NetVips.TypeFromName(name);
var csharpName = RemovePrefix(name);

Expand Down
16 changes: 13 additions & 3 deletions samples/NetVips.Samples/Samples/GenerateImageClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,19 @@ string ToCref(string name) =>
? $"nameof({arg.Name})"
: $"\"{arg.Name}\"";

result.AppendLine(arg.Type == FailOnType
? $"{indent} options.AddFailOn({safeIdentifier});"
: $"{indent} options.AddIfPresent({optionsName}, {safeIdentifier});");
if (operationName.StartsWith("dzsave") && arg.Name == "imagename")
{
result.AppendLine(
$"{indent} options.AddIfPresent(NetVips.AtLeastLibvips(8, 15) ? {optionsName} : \"basename\", {safeIdentifier});");
}
else if (arg.Type == FailOnType)
{
result.AppendLine($"{indent} options.AddFailOn({safeIdentifier});");
}
else
{
result.AppendLine($"{indent} options.AddIfPresent({optionsName}, {safeIdentifier});");
}
}

result.AppendLine();
Expand Down
983 changes: 637 additions & 346 deletions src/NetVips/Image.Generated.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/NetVips/MutableImage.Generated.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// libvips version: 8.14.2
// libvips version: 8.15.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
Expand Down
10 changes: 9 additions & 1 deletion tests/NetVips.Tests/ColourTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@ public void TestColourspace()
}

var pixel = im[10, 10];
Assert.Equal(42, pixel[3], 2);
if (col == Enums.Interpretation.Scrgb && NetVips.AtLeastLibvips(8, 15))
{
// libvips 8.15 uses alpha range of 0.0 - 1.0 for scRGB images.
Assert.Equal(42.0 / 255.0, pixel[3], 4);
}
else
{
Assert.Equal(42, pixel[3], 2);
}
}

// alpha won't be equal for RGB16, but it should be preserved if we go
Expand Down
2 changes: 1 addition & 1 deletion tests/NetVips.Tests/CreateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ public void TestText()
Assert.True(im.Height > 10);
Assert.Equal(1, im.Bands);
Assert.Equal(Enums.BandFormat.Uchar, im.Format);
Assert.Equal(255, im.Max());
Assert.True(im.Max() > 240);
Assert.Equal(0, im.Min());

if (NetVips.AtLeastLibvips(8, 9))
Expand Down
9 changes: 6 additions & 3 deletions tests/NetVips.Tests/ForeignTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,8 @@ void ExrValid(Image im)
0.159668,
0.040375,
// OpenEXR alpha is scaled to 0 - 255 in libvips 8.7+
NetVips.AtLeastLibvips(8, 7) ? 255 : 1.0
// but libvips 8.15+ uses alpha range of 0 - 1 for scRGB.
NetVips.AtLeastLibvips(8, 7) && !NetVips.AtLeastLibvips(8, 15) ? 255 : 1.0
}, a, 0.00001);
Assert.Equal(610, im.Width);
Assert.Equal(406, im.Height);
Expand Down Expand Up @@ -1398,8 +1399,10 @@ public void TestDzSave()
_colour.Dzsave(filename);

buf1 = File.ReadAllBytes(filename);
buf2 = _colour.DzsaveBuffer(basename: baseName);
Assert.Equal(buf1.Length, buf2.Length);
buf2 = _colour.DzsaveBuffer(imagename: baseName);

// won't be identical since tiles can be in a different order
Assert.True(Math.Abs(buf1.Length - buf2.Length) < 6000);

// we can't test the bytes are exactly equal -- the timestamp in
// vips-properties.xml will be different
Expand Down

0 comments on commit c533ba2

Please sign in to comment.