Browse Source

Fix broken tests, update dependencies

Former-commit-id: 7234f3f88396822fe1ee691565d44fec1619070f
Former-commit-id: 4075e16ff21cf16977772d65008a8d2f02e9459f
Former-commit-id: 3e1183fdce171ed2af6eb270e9a05ca2f42c7b7c
af/merge-core
James Jackson-South 11 years ago
parent
commit
a914095dfb
  1. 4
      .gitignore
  2. 7
      global.json
  3. 3
      src/ImageProcessor/Formats/Gif/Quantizer/QuantizedImage.cs
  4. 2
      src/ImageProcessor/project.lock.json.REMOVED.git-id
  5. 18
      tests/ImageProcessor.Tests/Colors/ColorConversionTests.cs
  6. 8
      tests/ImageProcessor.Tests/Processors/Formats/EncoderDecoderTests.cs
  7. 32
      tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs
  8. 12
      tests/ImageProcessor.Tests/Processors/Samplers/SamplerTests.cs
  9. 4
      tests/ImageProcessor.Tests/project.json
  10. 2
      tests/ImageProcessor.Tests/project.lock.json.REMOVED.git-id

4
.gitignore

@ -176,5 +176,5 @@ _site/
**/node_modules
**/node_modules/*
project.lock.json
src/ImageProcessor/project.lock.json
**/TestOutput
project.lock.json

7
global.json

@ -1,3 +1,8 @@
{
"projects": [ "src" ]
"projects": [ "src" ],
"sdk": {
"version": "1.0.0-beta8",
"runtime": "coreclr",
"architecture": "x86"
}
}

3
src/ImageProcessor/Formats/Gif/Quantizer/QuantizedImage.cs

@ -69,12 +69,13 @@ namespace ImageProcessor.Formats
Image image = new Image();
int pixelCount = this.Pixels.Length;
int palletCount = this.Palette.Length - 1;
float[] bgraPixels = new float[pixelCount * 4];
for (int i = 0; i < pixelCount; i++)
{
int offset = i * 4;
Bgra32 color = this.Palette[this.Pixels[i]];
Bgra32 color = this.Palette[Math.Min(palletCount, this.Pixels[i])];
bgraPixels[offset + 0] = color.B;
bgraPixels[offset + 1] = color.G;
bgraPixels[offset + 2] = color.R;

2
src/ImageProcessor/project.lock.json.REMOVED.git-id

@ -1 +1 @@
b4afca3213a5d2714e409729a1ef2622b62a5bca
869b4da8e5d4467a9e8fe7af0413a80080cd8f15

18
tests/ImageProcessor.Tests/Colors/ColorConversionTests.cs

@ -36,23 +36,23 @@ namespace ImageProcessor.Tests
Color color = new Color(1, 1, 1);
YCbCr yCbCr = color;
Assert.Equal(255, yCbCr.Y);
Assert.Equal(128, yCbCr.Cb);
Assert.Equal(128, yCbCr.Cr);
Assert.Equal(255, yCbCr.Y, 0);
Assert.Equal(128, yCbCr.Cb, 0);
Assert.Equal(128, yCbCr.Cr, 0);
// Black
Color color2 = new Color(0, 0, 0);
YCbCr yCbCr2 = color2;
Assert.Equal(0, yCbCr2.Y);
Assert.Equal(128, yCbCr2.Cb);
Assert.Equal(128, yCbCr2.Cr);
Assert.Equal(0, yCbCr2.Y, 0);
Assert.Equal(128, yCbCr2.Cb, 0);
Assert.Equal(128, yCbCr2.Cr, 0);
// Grey
Color color3 = new Color(.5f, .5f, .5f);
YCbCr yCbCr3 = color3;
Assert.Equal(128, yCbCr3.Y);
Assert.Equal(128, yCbCr3.Cb);
Assert.Equal(128, yCbCr3.Cr);
Assert.Equal(128, yCbCr3.Y, 0);
Assert.Equal(128, yCbCr3.Cb, 0);
Assert.Equal(128, yCbCr3.Cr, 0);
}
/// <summary>

8
tests/ImageProcessor.Tests/Processors/Formats/EncoderDecoderTests.cs

@ -12,12 +12,12 @@
[Fact]
public void DecodeThenEncodeImageFromStreamShouldSucceed()
{
if (!Directory.Exists("Encoded"))
if (!Directory.Exists("TestOutput/Encoded"))
{
Directory.CreateDirectory("Encoded");
Directory.CreateDirectory("TestOutput/Encoded");
}
foreach (FileInfo file in new DirectoryInfo("Encoded").GetFiles())
foreach (FileInfo file in new DirectoryInfo("TestOutput/Encoded").GetFiles())
{
file.Delete();
}
@ -29,7 +29,7 @@
Stopwatch watch = Stopwatch.StartNew();
Image image = new Image(stream);
string encodedFilename = "Encoded/" + Path.GetFileName(file);
string encodedFilename = "TestOutput/Encoded/" + Path.GetFileName(file);
using (FileStream output = File.OpenWrite(encodedFilename))
{

32
tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs

@ -19,25 +19,25 @@ namespace ImageProcessor.Tests
/// </summary>
public static readonly List<string> Files = new List<string>
{
//"../../TestImages/Formats/Jpg/Backdrop.jpg",
//"../../TestImages/Formats/Jpg/Calliphora.jpg",
//"TestImages/Formats/Jpg/Backdrop.jpg",
//"TestImages/Formats/Jpg/Calliphora.jpg",
"TestImages/Formats/Jpg/china.jpg",
//"../../TestImages/Formats/Jpg/ant.jpg",
//"../../TestImages/Formats/Jpg/parachute.jpg",
//"../../TestImages/Formats/Jpg/lomo.jpg",
//"../../TestImages/Formats/Jpg/shaftesbury.jpg",
//"../../TestImages/Formats/Jpg/gamma_dalai_lama_gray.jpg",
//"../../TestImages/Formats/Jpg/greyscale.jpg",
//"../../TestImages/Formats/Bmp/Car.bmp",
//"TestImages/Formats/Jpg/ant.jpg",
//"TestImages/Formats/Jpg/parachute.jpg",
//"TestImages/Formats/Jpg/lomo.jpg",
//"TestImages/Formats/Jpg/shaftesbury.jpg",
//"TestImages/Formats/Jpg/gamma_dalai_lama_gray.jpg",
//"TestImages/Formats/Jpg/greyscale.jpg",
//"TestImages/Formats/Bmp/Car.bmp",
"TestImages/Formats/Png/cballs.png",
//"../../TestImages/Formats/Png/cmyk.png",
//"../../TestImages/Formats/Png/gamma-1.0-or-2.2.png",
//"TestImages/Formats/Png/cmyk.png",
//"TestImages/Formats/Png/gamma-1.0-or-2.2.png",
"TestImages/Formats/Png/splash.png",
//"../../TestImages/Formats/Gif/leaf.gif",
//"../../TestImages/Formats/Gif/ben2.gif",
//"../../TestImages/Formats/Gif/rings.gif",
//"../../TestImages/Formats/Gif/ani2.gif",
//"../../TestImages/Formats/Gif/giphy.gif"
"TestImages/Formats/Gif/leaf.gif",
//"TestImages/Formats/Gif/ben2.gif",
//"TestImages/Formats/Gif/rings.gif",
//"TestImages/Formats/Gif/ani2.gif",
//"TestImages/Formats/Gif/giphy.gif"
};
}
}

12
tests/ImageProcessor.Tests/Processors/Samplers/SamplerTests.cs

@ -32,9 +32,9 @@ namespace ImageProcessor.Tests
[MemberData("Samplers")]
public void ImageShouldResize(string name, IResampler sampler)
{
if (!Directory.Exists("Resized"))
if (!Directory.Exists("TestOutput/Resized"))
{
Directory.CreateDirectory("Resized");
Directory.CreateDirectory("TestOutput/Resized");
}
foreach (string file in Files)
@ -44,7 +44,7 @@ namespace ImageProcessor.Tests
Stopwatch watch = Stopwatch.StartNew();
Image image = new Image(stream);
string filename = Path.GetFileNameWithoutExtension(file) + "-" + name + Path.GetExtension(file);
using (FileStream output = File.OpenWrite($"Resized/{filename}"))
using (FileStream output = File.OpenWrite($"TestOutput/Resized/{filename}"))
{
image.Resize(image.Width / 2, image.Height / 2, sampler).Save(output);
}
@ -57,9 +57,9 @@ namespace ImageProcessor.Tests
[Fact]
public void ImageShouldCrop()
{
if (!Directory.Exists("Cropped"))
if (!Directory.Exists("TestOutput/Cropped"))
{
Directory.CreateDirectory("Cropped");
Directory.CreateDirectory("TestOutput/Cropped");
}
foreach (string file in Files)
@ -68,7 +68,7 @@ namespace ImageProcessor.Tests
{
Image image = new Image(stream);
string filename = Path.GetFileNameWithoutExtension(file) + "-Cropped" + Path.GetExtension(file);
using (FileStream output = File.OpenWrite($"Cropped/{filename}"))
using (FileStream output = File.OpenWrite($"TestOutput/Cropped/{filename}"))
{
image.Crop(image.Width / 2, image.Height / 2).Save(output);
}

4
tests/ImageProcessor.Tests/project.json

@ -20,8 +20,8 @@
"ImageProcessor": "3.0.0-*",
"Microsoft.NETCore": "5.0.1-beta-23409",
"Microsoft.NETCore.Platforms": "1.0.1-beta-23409",
"xunit": "2.1.0",
"xunit.runner.dnx": "2.1.0-beta6-build191"
"xunit": "2.1.0-*",
"xunit.runner.dnx": "2.1.0-*"
},
"commands": {
"test": "xunit.runner.dnx"

2
tests/ImageProcessor.Tests/project.lock.json.REMOVED.git-id

@ -1 +1 @@
986564cced9c1356c73f345d4f605395896bf156
e6a19da5fae2d14f8371b848e58732e830f6e7d7
Loading…
Cancel
Save