Browse Source

Update tests project

Former-commit-id: c0a495576e61aa994a704a25e001b591f744af86
Former-commit-id: 37f290345ab4537ee835cb17123e03ea5466748f
Former-commit-id: 7a8f501a0f1a1b0611bb4b46d610a1f9743746b6
pull/1/head
James Jackson-South 10 years ago
parent
commit
7d5c59a957
  1. 5
      tests/ImageProcessorCore.Tests/Formats/BitmapTests.cs
  2. 8
      tests/ImageProcessorCore.Tests/Formats/EncoderDecoderTests.cs
  3. 9
      tests/ImageProcessorCore.Tests/Processors/Filters/FilterTests.cs
  4. 56
      tests/ImageProcessorCore.Tests/Processors/Samplers/SamplerTests.cs
  5. 7
      tests/ImageProcessorCore.Tests/project.json

5
tests/ImageProcessorCore.Tests/Formats/BitmapTests.cs

@ -26,8 +26,6 @@ namespace ImageProcessorCore.Tests
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
Image image = new Image(stream); Image image = new Image(stream);
string encodeFilename = "TestOutput/Encode/Bitmap/" + "24-" + Path.GetFileNameWithoutExtension(file) + ".bmp"; string encodeFilename = "TestOutput/Encode/Bitmap/" + "24-" + Path.GetFileNameWithoutExtension(file) + ".bmp";
@ -42,9 +40,6 @@ namespace ImageProcessorCore.Tests
{ {
image.Save(output, new BmpEncoder { BitsPerPixel = BmpBitsPerPixel.Pixel32 }); image.Save(output, new BmpEncoder { BitsPerPixel = BmpBitsPerPixel.Pixel32 });
} }
Trace.WriteLine($"{file} : {watch.ElapsedMilliseconds}ms");
} }
} }
} }

8
tests/ImageProcessorCore.Tests/Formats/EncoderDecoderTests.cs

@ -29,13 +29,9 @@ namespace ImageProcessorCore.Tests
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
Image image = new Image(stream); Image image = new Image(stream);
string filename = "TestOutput/ToString/" + Path.GetFileNameWithoutExtension(file) + ".txt"; string filename = "TestOutput/ToString/" + Path.GetFileNameWithoutExtension(file) + ".txt";
File.WriteAllText(filename, image.ToString()); File.WriteAllText(filename, image.ToString());
Trace.WriteLine($"{watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -52,8 +48,6 @@ namespace ImageProcessorCore.Tests
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
Image image = new Image(stream); Image image = new Image(stream);
string encodeFilename = "TestOutput/Encode/" + Path.GetFileName(file); string encodeFilename = "TestOutput/Encode/" + Path.GetFileName(file);
@ -61,8 +55,6 @@ namespace ImageProcessorCore.Tests
{ {
image.Save(output); image.Save(output);
} }
Trace.WriteLine($"{file} : {watch.ElapsedMilliseconds}ms");
} }
} }
} }

9
tests/ImageProcessorCore.Tests/Processors/Filters/FilterTests.cs

@ -1,4 +1,8 @@
 // <copyright file="FilterTests.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageProcessorCore.Tests namespace ImageProcessorCore.Tests
{ {
using System.Diagnostics; using System.Diagnostics;
@ -7,7 +11,6 @@ namespace ImageProcessorCore.Tests
using Processors; using Processors;
using Xunit; using Xunit;
public class FilterTests : FileTestBase public class FilterTests : FileTestBase
{ {
public static readonly TheoryData<string, IImageProcessor> Filters = new TheoryData<string, IImageProcessor> public static readonly TheoryData<string, IImageProcessor> Filters = new TheoryData<string, IImageProcessor>
@ -79,8 +82,6 @@ namespace ImageProcessorCore.Tests
image.Process(processor).Save(output); image.Process(processor).Save(output);
processor.OnProgress -= this.ProgressUpdate; processor.OnProgress -= this.ProgressUpdate;
} }
Trace.WriteLine($"{ name }: { watch.ElapsedMilliseconds}ms");
} }
} }
} }

56
tests/ImageProcessorCore.Tests/Processors/Samplers/SamplerTests.cs

@ -1,6 +1,10 @@
namespace ImageProcessorCore.Tests // <copyright file="SamplerTests.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageProcessorCore.Tests
{ {
using System.Diagnostics;
using System.IO; using System.IO;
using Processors; using Processors;
@ -57,7 +61,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
Image image = new Image(stream); Image image = new Image(stream);
string filename = Path.GetFileNameWithoutExtension(file) + "-" + name + Path.GetExtension(file); string filename = Path.GetFileNameWithoutExtension(file) + "-" + name + Path.GetExtension(file);
@ -68,8 +71,6 @@
image.Save(output); image.Save(output);
processor.OnProgress -= this.ProgressUpdate; processor.OnProgress -= this.ProgressUpdate;
} }
Trace.WriteLine($"{ name }: { watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -86,8 +87,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
string filename = Path.GetFileName(file); string filename = Path.GetFileName(file);
Image image = new Image(stream); Image image = new Image(stream);
@ -96,8 +95,6 @@
image.Pad(image.Width + 50, image.Height + 50, this.ProgressUpdate) image.Pad(image.Width + 50, image.Height + 50, this.ProgressUpdate)
.Save(output); .Save(output);
} }
Trace.WriteLine($"{watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -115,7 +112,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
string filename = Path.GetFileNameWithoutExtension(file) + "-" + name + Path.GetExtension(file); string filename = Path.GetFileNameWithoutExtension(file) + "-" + name + Path.GetExtension(file);
Image image = new Image(stream); Image image = new Image(stream);
@ -124,8 +120,6 @@
image.Resize(image.Width / 2, image.Height / 2, sampler, false, this.ProgressUpdate) image.Resize(image.Width / 2, image.Height / 2, sampler, false, this.ProgressUpdate)
.Save(output); .Save(output);
} }
Trace.WriteLine($"{name}: {watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -144,7 +138,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
string filename = Path.GetFileNameWithoutExtension(file) + "-" + name + Path.GetExtension(file); string filename = Path.GetFileNameWithoutExtension(file) + "-" + name + Path.GetExtension(file);
Image image = new Image(stream); Image image = new Image(stream);
@ -153,8 +146,6 @@
image.Resize(image.Width / 3, 0, new TriangleResampler(), false, this.ProgressUpdate) image.Resize(image.Width / 3, 0, new TriangleResampler(), false, this.ProgressUpdate)
.Save(output); .Save(output);
} }
Trace.WriteLine($"{name}: {watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -173,7 +164,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
string filename = Path.GetFileNameWithoutExtension(file) + "-" + name + Path.GetExtension(file); string filename = Path.GetFileNameWithoutExtension(file) + "-" + name + Path.GetExtension(file);
Image image = new Image(stream); Image image = new Image(stream);
@ -182,8 +172,6 @@
image.Resize(0, image.Height / 3, new TriangleResampler(), false, this.ProgressUpdate) image.Resize(0, image.Height / 3, new TriangleResampler(), false, this.ProgressUpdate)
.Save(output); .Save(output);
} }
Trace.WriteLine($"{name}: {watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -200,7 +188,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
string filename = Path.GetFileName(file); string filename = Path.GetFileName(file);
Image image = new Image(stream); Image image = new Image(stream);
@ -214,8 +201,6 @@
image.Resize(options, this.ProgressUpdate) image.Resize(options, this.ProgressUpdate)
.Save(output); .Save(output);
} }
Trace.WriteLine($"{filename}: {watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -232,7 +217,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
string filename = Path.GetFileName(file); string filename = Path.GetFileName(file);
Image image = new Image(stream); Image image = new Image(stream);
@ -247,8 +231,6 @@
image.Resize(options, this.ProgressUpdate) image.Resize(options, this.ProgressUpdate)
.Save(output); .Save(output);
} }
Trace.WriteLine($"{filename}: {watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -265,7 +247,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
string filename = Path.GetFileName(file); string filename = Path.GetFileName(file);
Image image = new Image(stream); Image image = new Image(stream);
@ -280,8 +261,6 @@
image.Resize(options, this.ProgressUpdate) image.Resize(options, this.ProgressUpdate)
.Save(output); .Save(output);
} }
Trace.WriteLine($"{filename}: {watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -298,7 +277,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
string filename = Path.GetFileName(file); string filename = Path.GetFileName(file);
Image image = new Image(stream); Image image = new Image(stream);
@ -314,8 +292,6 @@
image.Resize(options, this.ProgressUpdate) image.Resize(options, this.ProgressUpdate)
.Save(output); .Save(output);
} }
Trace.WriteLine($"{filename}: {watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -332,7 +308,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
string filename = Path.GetFileName(file); string filename = Path.GetFileName(file);
Image image = new Image(stream); Image image = new Image(stream);
@ -347,8 +322,6 @@
image.Resize(options, this.ProgressUpdate) image.Resize(options, this.ProgressUpdate)
.Save(output); .Save(output);
} }
Trace.WriteLine($"{filename}: {watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -365,7 +338,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
string filename = Path.GetFileName(file); string filename = Path.GetFileName(file);
Image image = new Image(stream); Image image = new Image(stream);
@ -380,8 +352,6 @@
image.Resize(options, this.ProgressUpdate) image.Resize(options, this.ProgressUpdate)
.Save(output); .Save(output);
} }
Trace.WriteLine($"{filename}: {watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -398,7 +368,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
string filename = Path.GetFileName(file); string filename = Path.GetFileName(file);
Image image = new Image(stream); Image image = new Image(stream);
@ -414,8 +383,6 @@
image.Resize(options, this.ProgressUpdate) image.Resize(options, this.ProgressUpdate)
.Save(output); .Save(output);
} }
Trace.WriteLine($"{filename}: {watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -433,7 +400,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
string filename = Path.GetFileNameWithoutExtension(file) + "-" + rotateType + flipType + Path.GetExtension(file); string filename = Path.GetFileNameWithoutExtension(file) + "-" + rotateType + flipType + Path.GetExtension(file);
Image image = new Image(stream); Image image = new Image(stream);
@ -442,8 +408,6 @@
image.RotateFlip(rotateType, flipType, this.ProgressUpdate) image.RotateFlip(rotateType, flipType, this.ProgressUpdate)
.Save(output); .Save(output);
} }
Trace.WriteLine($"{rotateType + "-" + flipType}: {watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -460,8 +424,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
string filename = Path.GetFileName(file); string filename = Path.GetFileName(file);
Image image = new Image(stream); Image image = new Image(stream);
@ -470,8 +432,6 @@
image.Rotate(63, this.ProgressUpdate) image.Rotate(63, this.ProgressUpdate)
.Save(output); .Save(output);
} }
Trace.WriteLine($"{watch.ElapsedMilliseconds}ms");
} }
} }
} }
@ -489,8 +449,6 @@
{ {
using (FileStream stream = File.OpenRead(file)) using (FileStream stream = File.OpenRead(file))
{ {
Stopwatch watch = Stopwatch.StartNew();
string filename = Path.GetFileName(file); string filename = Path.GetFileName(file);
Image image = new Image(stream); Image image = new Image(stream);
@ -499,8 +457,6 @@
image.Skew(20, 10, this.ProgressUpdate) image.Skew(20, 10, this.ProgressUpdate)
.Save(output); .Save(output);
} }
Trace.WriteLine($"{watch.ElapsedMilliseconds}ms");
} }
} }
} }

7
tests/ImageProcessorCore.Tests/project.json

@ -14,16 +14,15 @@
}, },
"dependencies": { "dependencies": {
"ImageProcessorCore": "1.0.0-*", "ImageProcessorCore": "1.0.0-*",
"System.Diagnostics.TraceSource": "4.0.0-rc2-24027", "xunit": "2.2.0-*",
"xunit": "2.1.0", "dotnet-test-xunit": "2.2.0-*"
"dotnet-test-xunit": "1.0.0-rc2-build10015"
}, },
"frameworks": { "frameworks": {
"netcoreapp1.1": { "netcoreapp1.1": {
"dependencies": { "dependencies": {
"Microsoft.NETCore.App": { "Microsoft.NETCore.App": {
"type": "platform", "type": "platform",
"version": "1.0.0-rc2-3002702" "version": "1.0.0-*"
} }
}, },
"imports": [ "imports": [

Loading…
Cancel
Save