Browse Source

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.
unstable
Craig Oates 4 years ago
parent
commit
896130a11b
  1. 12
      DeathSocket/ScratchPad.fsx
  2. 15
      TestCentre/LibraryTests.fs

12
DeathSocket/ScratchPad.fsx

@ -51,6 +51,10 @@ let dimensions =
// Change the line thickness (the last parameter) to whatever you want. // Change the line thickness (the last parameter) to whatever you want.
let scaledPen = GridPainter.scaleLineThickness (100, 100) dimensions 8.0 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 Specification (uses System.Drawing)
Brush ({ originalPath = desktop + "/test.jpg" Brush ({ originalPath = desktop + "/test.jpg"
savePath = desktop + "/grid.png" savePath = desktop + "/grid.png"
@ -58,7 +62,7 @@ Brush ({ originalPath = desktop + "/test.jpg"
penWidth = (float32 1) penWidth = (float32 1)
rows = 10 rows = 10
columns = 10 }) columns = 10 })
|> GridPainter.applyGridToImageAsync |> GridPainter.applyGridToImageAsync false
|> Async.Start |> Async.Start
// RGBA Specification (uses System.Drawing) // RGBA Specification (uses System.Drawing)
@ -71,7 +75,7 @@ RGBA ({ originalPath = desktop + "/test.jpg"
penWidth = (float32 1) penWidth = (float32 1)
rows = 10 rows = 10
columns = 10 }) columns = 10 })
|> GridPainter.applyGridToImageAsync |> GridPainter.applyGridToImageAsync false
|> Async.Start |> Async.Start
// Skia Specification (uses SkiaSharp -- use with Xamarin) // Skia Specification (uses SkiaSharp -- use with Xamarin)
@ -81,7 +85,7 @@ Skia ({ originalPath = desktop + "/test.jpg"
penWidth = (float32 1) penWidth = (float32 1)
rows = 10 rows = 10
columns = 10}) columns = 10})
|> GridPainter.applyGridToImageAsync |> GridPainter.applyGridToImageAsync false
|> Async.Start |> Async.Start
// SkiaRGB Specification (uses SkiaSharp -- use with Xamarin) // SkiaRGB Specification (uses SkiaSharp -- use with Xamarin)
@ -93,5 +97,5 @@ SkiaRGB ({ originalPath = desktop + "/test.jpg"
penWidth = (float32 1) penWidth = (float32 1)
rows = 10 rows = 10
columns = 10}) columns = 10})
|> GridPainter.applyGridToImageAsync |> GridPainter.applyGridToImageAsync false
|> Async.Start |> Async.Start

15
TestCentre/LibraryTests.fs

@ -73,6 +73,13 @@
Intended for horizontal and vertical line tests. *) Intended for horizontal and vertical line tests. *)
let newNum () = rand.Next(1, 1000) 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 newPenWidth () = rand.Next (1, 10)
let newRGBANum () = rand.Next (255) let newRGBANum () = rand.Next (255)
@ -134,7 +141,7 @@
penWidth = float32 (newPenWidth()) penWidth = float32 (newPenWidth())
rows = 10 rows = 10
columns = 10 }) columns = 10 })
|> applyGridToImageAsync true // true is temp. |> applyGridToImageAsync (newBool())
|> Async.RunSynchronously |> Async.RunSynchronously
(File.Exists sPath) = true (File.Exists sPath) = true
@ -152,7 +159,7 @@
penWidth = float32 (newPenWidth()) penWidth = float32 (newPenWidth())
rows = 10 rows = 10
columns = 10 }) columns = 10 })
|> applyGridToImageAsync true // true is temp. |> applyGridToImageAsync (newBool())
|> Async.RunSynchronously |> Async.RunSynchronously
(File.Exists sPath) = true (File.Exists sPath) = true
@ -199,7 +206,7 @@
penWidth = float32 (newPenWidth()) penWidth = float32 (newPenWidth())
rows = newNum () rows = newNum ()
columns = newNum () }) columns = newNum () })
|> applyGridToImageAsync true // true is temp. |> applyGridToImageAsync (newBool())
|> Async.RunSynchronously |> Async.RunSynchronously
(File.Exists sPath) = true (File.Exists sPath) = true
@ -217,7 +224,7 @@
penWidth = float32 (newPenWidth()) penWidth = float32 (newPenWidth())
rows = newNum () rows = newNum ()
columns = newNum () }) columns = newNum () })
|> applyGridToImageAsync true // true is temp. |> applyGridToImageAsync (newBool())
|> Async.RunSynchronously |> Async.RunSynchronously
(File.Exists sPath) = true (File.Exists sPath) = true

Loading…
Cancel
Save