Browse Source

Add argument docs and negative tests

pull/1574/head
James Jackson-South 6 years ago
parent
commit
f223f39ff4
  1. 1
      src/ImageSharp/ImageFrame{TPixel}.cs
  2. 1
      src/ImageSharp/Image{TPixel}.cs
  3. 11
      tests/ImageSharp.Tests/Image/LargeImageIntegrationTests.cs

1
src/ImageSharp/ImageFrame{TPixel}.cs

@ -173,6 +173,7 @@ namespace SixLabors.ImageSharp
/// </summary>
/// <param name="rowIndex">The row.</param>
/// <returns>The <see cref="Span{TPixel}"/></returns>
/// <exception cref="ArgumentOutOfRangeException">Thrown when row index is out of range.</exception>
public Span<TPixel> GetPixelRowSpan(int rowIndex)
{
Guard.MustBeGreaterThanOrEqualTo(rowIndex, 0, nameof(rowIndex));

1
src/ImageSharp/Image{TPixel}.cs

@ -169,6 +169,7 @@ namespace SixLabors.ImageSharp
/// </summary>
/// <param name="rowIndex">The row.</param>
/// <returns>The <see cref="Span{TPixel}"/></returns>
/// <exception cref="ArgumentOutOfRangeException">Thrown when row index is out of range.</exception>
public Span<TPixel> GetPixelRowSpan(int rowIndex)
{
Guard.MustBeGreaterThanOrEqualTo(rowIndex, 0, nameof(rowIndex));

11
tests/ImageSharp.Tests/Image/LargeImageIntegrationTests.cs

@ -1,6 +1,7 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using Xunit;
@ -17,5 +18,15 @@ namespace SixLabors.ImageSharp.Tests
image.Mutate(c => c.Resize(1000, 1000));
image.DebugSave(provider);
}
[Theory]
[WithBasicTestPatternImages(width: 10, height: 10, PixelTypes.Rgba32)]
public void GetSingleSpan(TestImageProvider<Rgba32> provider)
{
provider.LimitAllocatorBufferCapacity().InPixels(10);
using Image<Rgba32> image = provider.GetImage();
Assert.False(image.TryGetSinglePixelSpan(out Span<Rgba32> imageSpan));
Assert.False(image.Frames.RootFrame.TryGetSinglePixelSpan(out Span<Rgba32> imageFrameSpan));
}
}
}

Loading…
Cancel
Save