< Summary

Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 57
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%66100%
get_Palette()100%11100%
get_Bytes()100%11100%

File(s)

https://raw.githubusercontent.com/JeremyAnsel/JeremyAnsel.ColorQuant/6d79217e72af9e3af1a8a29c606732adac1e8d87/JeremyAnsel.ColorQuant/JeremyAnsel.ColorQuant/ColorQuantizerResult.cs

#LineLine coverage
 1// <copyright file="ColorQuantizerResult.cs" company="Jérémy Ansel">
 2// Copyright (c) 2014-2019 Jérémy Ansel
 3// </copyright>
 4// <license>
 5// Licensed under the MIT license. See LICENSE.txt
 6// </license>
 7
 8namespace JeremyAnsel.ColorQuant
 9{
 10    using System;
 11    using System.Diagnostics.CodeAnalysis;
 12
 13    /// <summary>
 14    /// A result of color quantization.
 15    /// </summary>
 16    public sealed class ColorQuantizerResult
 17    {
 18        /// <summary>
 19        /// The maximum color count.
 20        /// </summary>
 21        public const int MaxColors = 256;
 22
 23        /// <summary>
 24        /// Initializes a new instance of the <see cref="ColorQuantizerResult"/> class.
 25        /// </summary>
 26        /// <param name="size">The size of the result.</param>
 27        /// <param name="colorCount">The color count.</param>
 5428        public ColorQuantizerResult(int size, int colorCount)
 29        {
 5430            if (size < 1)
 31            {
 232                throw new ArgumentOutOfRangeException(nameof(size));
 33            }
 34
 5235            if (colorCount < 1 || colorCount > 256)
 36            {
 437                throw new ArgumentOutOfRangeException(nameof(colorCount));
 38            }
 39
 4840            this.Palette = new byte[colorCount * 4];
 4841            this.Bytes = new byte[size];
 4842        }
 43
 44        /// <summary>
 45        /// Gets the palette (XRGB or ARGB).
 46        /// </summary>
 47        [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Reviewed")]
 120799884648        public byte[] Palette { get; private set; }
 49
 50        /// <summary>
 51        /// Gets the bytes.
 52        /// </summary>
 53        [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Reviewed")]
 60399114854        public byte[] Bytes { get; private set; }
 55    }
 56}
 57