diff --git a/DeathSocket/ColourServices.fs b/DeathSocket/ColourServices.fs index 3e29ee6..fb7d29b 100644 --- a/DeathSocket/ColourServices.fs +++ b/DeathSocket/ColourServices.fs @@ -3,7 +3,6 @@ open System.Drawing open DeathSocket.Domain - // not tested let makeBrushFromRGBASpec (spec: RGBASpec) = let a = int spec.alpha let r = int spec.red @@ -12,7 +11,6 @@ let colour = Color.FromArgb (a, r, g, b) new SolidBrush (colour) - // not tested let makeBrushFromRGBA r g b a = let colour = Color.FromArgb (a, r, g, b) new SolidBrush (colour) diff --git a/DeathSocket/GridPainter.fs b/DeathSocket/GridPainter.fs index d5e097e..44c576e 100644 --- a/DeathSocket/GridPainter.fs +++ b/DeathSocket/GridPainter.fs @@ -55,9 +55,10 @@ namespace DeathSocket // let applyCMYKGridAsync -- to be added at a later date. - // not tested. let makeSolidBrushFromRGBA r g b a = makeBrushFromRGBA r g b a + let makeSolidBrushFromRGBASpec spec = makeBrushFromRGBASpec spec + // not tested or completed. let makeSolidBrushFromCMYK c m y k = "" diff --git a/TestCentre/LibraryTests.fs b/TestCentre/LibraryTests.fs index b9dfcc3..bb0e367 100644 --- a/TestCentre/LibraryTests.fs +++ b/TestCentre/LibraryTests.fs @@ -20,6 +20,7 @@ open System.Drawing open System.Reflection open System.IO + open DeathSocket.Domain let rand = Random () @@ -68,6 +69,18 @@ files |> Array.iter (fun f -> File.Delete(f)) + let makeTestRGBASpec r g b a = + { originalPath = "test path" + savePath = "test path" + alpha = float a + red = float r + green = float g + blue = float b + penWidth = float32 10 + rows = newNum () + columns = newNum () } + + module PropertyTests = open FsCheck.Xunit @@ -108,6 +121,17 @@ let brush = makeSolidBrushFromRGBA r g b a brush.Color = referenceColour + [] + let ``SolidBrush colour matches the RGBASpec`` () = + let a = newRGBANum () + let r = newRGBANum () + let g = newRGBANum () + let b = newRGBANum () + let referenceColour = Color.FromArgb (a, r, g, b) + let referenceSpec = makeTestRGBASpec r g b a + let brush = makeSolidBrushFromRGBASpec referenceSpec + brush.Color = referenceColour + [] let ``Can return a collection of points which represent a grids horizontal lines`` () =