public void ColorCutQuantizerGetQuantizedColors() { tlog.Debug(tag, $"ColorCutQuantizerGetQuantizedColors START"); using (PixelBuffer pixelBuffer = new PixelBuffer(100, 200, PixelFormat.A8)) { using (Rectangle region = new Rectangle()) { var testingTarget = ColorCutQuantizer.FromBitmap(pixelBuffer, region, 255); Assert.IsNotNull(testingTarget, "Should be not null!"); Assert.IsInstanceOf <ColorCutQuantizer>(testingTarget, "Should be an Instance of ColorCutQuantizer!"); try { testingTarget.GetQuantizedColors(); tlog.Debug(tag, "quantizedColors : " + testingTarget.GetQuantizedColors()); } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception: Failed!"); } } } tlog.Debug(tag, $"ColorCutQuantizerGetQuantizedColors END (OK)"); }
public void ColorCutQuantizerFromBitmapWithNullRegion() { tlog.Debug(tag, $"ColorCutQuantizerFromBitmapWithNullRegion START"); using (PixelBuffer pixelBuffer = new PixelBuffer(1, 2, PixelFormat.A8)) { using (Rectangle region = null) { var testingTarget = ColorCutQuantizer.FromBitmap(pixelBuffer, region, 255); Assert.IsNotNull(testingTarget, "Should be not null!"); Assert.IsInstanceOf <ColorCutQuantizer>(testingTarget, "Should be an Instance of ColorCutQuantizer!"); } } tlog.Debug(tag, $"ColorCutQuantizerFromBitmapWithNullRegion END (OK)"); }
public void ColorCutQuantizerFromBitmapWithMaxColorLessThan1() { tlog.Debug(tag, $"ColorCutQuantizerFromBitmapWithMaxColorLessThan1 START"); using (PixelBuffer pixelBuffer = new PixelBuffer(100, 200, PixelFormat.RGBA8888)) { using (Rectangle region = new Rectangle()) { try { ColorCutQuantizer.FromBitmap(pixelBuffer, region, 0); } catch (ArgumentNullException e) { tlog.Debug(tag, e.Message.ToString()); tlog.Debug(tag, $"ColorCutQuantizerFromBitmapWithMaxColorLessThan1 END (OK)"); Assert.Pass("Caught ArgumentNullException : Passed!"); } } } }