diff --git a/DeathSocket/GridPainter.fs b/DeathSocket/GridPainter.fs index 44c576e..517eb39 100644 --- a/DeathSocket/GridPainter.fs +++ b/DeathSocket/GridPainter.fs @@ -41,7 +41,6 @@ namespace DeathSocket printfn "File could not be found at %s" ex.Message } - // Not tested. let applyRGBAGridAsync (spec: RGBASpec) = async { try @@ -53,15 +52,14 @@ namespace DeathSocket printfn "File could not be found at %s" ex.Message } - // let applyCMYKGridAsync -- to be added at a later date. - let makeSolidBrushFromRGBA r g b a = makeBrushFromRGBA r g b a let makeSolidBrushFromRGBASpec spec = makeBrushFromRGBASpec spec + // let applyCMYKGridAsync -- to be added at a later date. + // not tested or completed. - let makeSolidBrushFromCMYK c m y k = - "" + //let makeSolidBrushFromCMYK c m y k = "" /// /// Determines the (Pen) points needed to draw the appropriate number of horizontal lines (I.E. rows). diff --git a/DeathSocket/ImageServices.fs b/DeathSocket/ImageServices.fs index 398321a..1c249fd 100644 --- a/DeathSocket/ImageServices.fs +++ b/DeathSocket/ImageServices.fs @@ -51,7 +51,6 @@ for line in verticalLines do graphics.DrawLines (pen, line) clone.Save (spec.savePath) - // Not tested let drawRGBAGrid (spec: RGBASpec) = // The temp. file is used as a way to convert images with indexed pixels. use original = Bitmap.FromFile spec.originalPath diff --git a/TestCentre/LibraryTests.fs b/TestCentre/LibraryTests.fs index bb0e367..52c0b9b 100644 --- a/TestCentre/LibraryTests.fs +++ b/TestCentre/LibraryTests.fs @@ -46,6 +46,8 @@ Intended for horizontal and vertical line tests. *) let newNum () = rand.Next(1, 1000) + let newPenWidth () = rand.Next (1, 10) + let newRGBANum () = rand.Next (255) let imagesInLoadingTestArea = @@ -92,7 +94,7 @@ open System [] - let ``Can apply grid to image and save it`` () = + let ``Can apply grid to image and save it using BrushSpec`` () = (* You should end up with one image left over in SavingTestArea. Comment out the "reset" function to see all the images produced, by this test. This will mean you will need to manually delete the @@ -104,13 +106,36 @@ { originalPath = oPath savePath = sPath colour = randomBrush () :?> Brush - penWidth = float32 1 + penWidth = float32 (newPenWidth()) rows = 10 columns = 10 } applyBrushSpecGridAsync spec |> Async.RunSynchronously (File.Exists sPath) = true + [] + let ``Can apply grid to image and save it using RGBASpec`` () = + (* You should end up with one image left over in SavingTestArea. + Comment out the "reset" function to see all the images produced, + by this test. This will mean you will need to manually delete the + images yourself if you do. *) + resetSavingTestArea () + let oPath = generateLoadPath () + let sPath = generateSavePath oPath + let (spec: RGBASpec) = + { originalPath = oPath + savePath = sPath + alpha = float (newRGBANum ()) + red = float (newRGBANum ()) + green = float (newRGBANum ()) + blue = float (newRGBANum ()) + penWidth = float32 (newPenWidth()) + rows = 10 + columns = 10 } + applyRGBAGridAsync spec + |> Async.RunSynchronously + (File.Exists sPath) = true + [] let ``SolidBrush colour matches the individual RGBA values`` () = let a = newRGBANum ()