From 896130a11b7de484a376eb573ccc1f30f4a674be Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Tue, 21 Jul 2020 22:14:31 +0100 Subject: [PATCH] update tests and Scratch Pad script. The changes in these two locations reflect the added grey scale conversion functionality. The tests pass with the new features and the scripts work to without problem. --- DeathSocket/ScratchPad.fsx | 12 ++++++++---- TestCentre/LibraryTests.fs | 15 +++++++++++---- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/DeathSocket/ScratchPad.fsx b/DeathSocket/ScratchPad.fsx index 399af83..dea21b3 100644 --- a/DeathSocket/ScratchPad.fsx +++ b/DeathSocket/ScratchPad.fsx @@ -51,6 +51,10 @@ let dimensions = // Change the line thickness (the last parameter) to whatever you want. let scaledPen = GridPainter.scaleLineThickness (100, 100) dimensions 8.0 +(* THE CODE BELOW DOES NOT INCLUDE THE GREY SCALE FUNCTIONALITY. +I HAVE JUST PLACE 'FALSE' IN PLACE. THE GREY SCALE OPTIONS WILL NEED ADDING +AT SOME POINT. WHEN THAT IS DONE, DELETE THIS COMMENT.*) + // Brush Specification (uses System.Drawing) Brush ({ originalPath = desktop + "/test.jpg" savePath = desktop + "/grid.png" @@ -58,7 +62,7 @@ Brush ({ originalPath = desktop + "/test.jpg" penWidth = (float32 1) rows = 10 columns = 10 }) -|> GridPainter.applyGridToImageAsync +|> GridPainter.applyGridToImageAsync false |> Async.Start // RGBA Specification (uses System.Drawing) @@ -71,7 +75,7 @@ RGBA ({ originalPath = desktop + "/test.jpg" penWidth = (float32 1) rows = 10 columns = 10 }) -|> GridPainter.applyGridToImageAsync +|> GridPainter.applyGridToImageAsync false |> Async.Start // Skia Specification (uses SkiaSharp -- use with Xamarin) @@ -81,7 +85,7 @@ Skia ({ originalPath = desktop + "/test.jpg" penWidth = (float32 1) rows = 10 columns = 10}) -|> GridPainter.applyGridToImageAsync +|> GridPainter.applyGridToImageAsync false |> Async.Start // SkiaRGB Specification (uses SkiaSharp -- use with Xamarin) @@ -93,5 +97,5 @@ SkiaRGB ({ originalPath = desktop + "/test.jpg" penWidth = (float32 1) rows = 10 columns = 10}) -|> GridPainter.applyGridToImageAsync +|> GridPainter.applyGridToImageAsync false |> Async.Start \ No newline at end of file diff --git a/TestCentre/LibraryTests.fs b/TestCentre/LibraryTests.fs index 019743b..ebbc2ab 100644 --- a/TestCentre/LibraryTests.fs +++ b/TestCentre/LibraryTests.fs @@ -73,6 +73,13 @@ Intended for horizontal and vertical line tests. *) let newNum () = rand.Next(1, 1000) + // Used mostly for making the image grey scale when add a grid to it. + let newBool() = + let num = rand.NextDouble() + match num with + | x when num < 0.5 -> true + | _ -> false + let newPenWidth () = rand.Next (1, 10) let newRGBANum () = rand.Next (255) @@ -134,7 +141,7 @@ penWidth = float32 (newPenWidth()) rows = 10 columns = 10 }) - |> applyGridToImageAsync true // true is temp. + |> applyGridToImageAsync (newBool()) |> Async.RunSynchronously (File.Exists sPath) = true @@ -152,7 +159,7 @@ penWidth = float32 (newPenWidth()) rows = 10 columns = 10 }) - |> applyGridToImageAsync true // true is temp. + |> applyGridToImageAsync (newBool()) |> Async.RunSynchronously (File.Exists sPath) = true @@ -199,7 +206,7 @@ penWidth = float32 (newPenWidth()) rows = newNum () columns = newNum () }) - |> applyGridToImageAsync true // true is temp. + |> applyGridToImageAsync (newBool()) |> Async.RunSynchronously (File.Exists sPath) = true @@ -217,7 +224,7 @@ penWidth = float32 (newPenWidth()) rows = newNum () columns = newNum () }) - |> applyGridToImageAsync true // true is temp. + |> applyGridToImageAsync (newBool()) |> Async.RunSynchronously (File.Exists sPath) = true