Browse Source

fixed TestImageProvider<T>.FileProvider bug

pull/58/head
Anton Firszov 10 years ago
parent
commit
41658854cc
  1. 1
      ImageSharp.sln.DotSettings
  2. 7
      tests/ImageSharp.Tests/Formats/Jpg/JpegTests.cs
  3. 5
      tests/ImageSharp.Tests/TestUtilities/Factories/GenericFactory.cs
  4. 6
      tests/ImageSharp.Tests/TestUtilities/Factories/ImageFactory.cs
  5. 2
      tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs
  6. 1
      tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs

1
ImageSharp.sln.DotSettings

@ -349,6 +349,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RGB/@EntryIndexedValue">RGB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RLE/@EntryIndexedValue">RLE</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=XY/@EntryIndexedValue">XY</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=XYZ/@EntryIndexedValue">XYZ</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/EventHandlerPatternLong/@EntryValue">$object$_On$event$</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Constants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=EnumMember/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>

7
tests/ImageSharp.Tests/Formats/Jpg/JpegTests.cs

@ -68,11 +68,14 @@ namespace ImageSharp.Tests
TestImages.Jpeg.Cmyk
};
private const PixelTypes BenchmarkPixels = PixelTypes.StandardImageClass;
//PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb;
[Theory(
//Skip = "Benchmark, enable manually!"
)]
[WithFileCollection(nameof(AllBmpFiles), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb, JpegSubsample.Ratio420, 75)]
[WithFileCollection(nameof(AllBmpFiles), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb, JpegSubsample.Ratio444, 75)]
[WithFileCollection(nameof(BenchmarkFiles), BenchmarkPixels, JpegSubsample.Ratio420, 75)]
[WithFileCollection(nameof(BenchmarkFiles), BenchmarkPixels, JpegSubsample.Ratio444, 75)]
public void Benchmark_JpegEncoder<TColor>(TestImageProvider<TColor> provider, JpegSubsample subSample, int quality)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{

5
tests/ImageSharp.Tests/TestUtilities/Factories/GenericFactory.cs

@ -23,5 +23,10 @@ namespace ImageSharp.Tests
{
return new Image<TColor>(bytes);
}
public virtual Image<TColor> CreateImage(Image<TColor> other)
{
return new Image<TColor>(other);
}
}
}

6
tests/ImageSharp.Tests/TestUtilities/Factories/ImageFactory.cs

@ -10,5 +10,11 @@ namespace ImageSharp.Tests
public override Image<Color> CreateImage(byte[] bytes) => new Image(bytes);
public override Image<Color> CreateImage(int width, int height) => new Image(width, height);
public override Image<Color> CreateImage(Image<Color> other)
{
Image img = (Image)other;
return new Image(img);
}
}
}

2
tests/ImageSharp.Tests/TestUtilities/ImageProviders/FileProvider.cs

@ -47,7 +47,7 @@ namespace ImageSharp.Tests
return this.Factory.CreateImage(testFile.Bytes);
});
return new Image<TColor>(cachedImage);
return this.Factory.CreateImage(cachedImage);
}
}
}

1
tests/ImageSharp.Tests/TestUtilities/Tests/TestImageProviderTests.cs

@ -57,6 +57,7 @@ namespace ImageSharp.Tests
[Theory]
[WithBlankImages(1, 1, PixelTypes.StandardImageClass)]
[WithFile(TestImages.Bmp.F, PixelTypes.StandardImageClass)]
public void PixelTypes_ColorWithDefaultImageClass_TriggersCreatingTheNonGenericDerivedImageClass<TColor>(
TestImageProvider<TColor> provider)
where TColor : struct, IPackedPixel, IEquatable<TColor>

Loading…
Cancel
Save