|
|
|
@ -2,7 +2,6 @@
|
|
|
|
|
|
|
|
|
|
module PropertyTests = |
|
|
|
|
|
|
|
|
|
open Xunit |
|
|
|
|
open FsCheck.Xunit |
|
|
|
|
open System |
|
|
|
|
open System.Drawing |
|
|
|
@ -10,6 +9,7 @@
|
|
|
|
|
open System.Reflection |
|
|
|
|
open SmoulderingBeachBall.Services |
|
|
|
|
open System.IO |
|
|
|
|
open System.Threading |
|
|
|
|
|
|
|
|
|
(* '3000' is an arbitary value. It is used to keep the testing times sane. |
|
|
|
|
This function is used to randomly generate image sizes but you do not need to use it. |
|
|
|
@ -51,8 +51,18 @@
|
|
|
|
|
files |
|
|
|
|
|> Array.iter (fun f -> File.Delete(f)) |
|
|
|
|
|
|
|
|
|
let buildBorderOverlay () = |
|
|
|
|
Thread.Sleep 100 // Helps generate better colour variation. |
|
|
|
|
{ colour = randomColour () :?> Brush |
|
|
|
|
overlayType = Border } |
|
|
|
|
|
|
|
|
|
let buildFullOverlay () = |
|
|
|
|
Thread.Sleep 100 // Helps generate better colour variation. |
|
|
|
|
{ colour = randomColour () :?> Brush |
|
|
|
|
overlayType = Full } |
|
|
|
|
|
|
|
|
|
[<Property>] |
|
|
|
|
let ``can create an image with no overlay`` () = |
|
|
|
|
let ``Can create an image with no overlay`` () = |
|
|
|
|
resetSavingTestArea () |
|
|
|
|
let spec = |
|
|
|
|
{ // See note accompanying 'randomInt' function for constraints information. |
|
|
|
@ -63,3 +73,16 @@
|
|
|
|
|
overlay = None } |
|
|
|
|
makeImage spec |> Async.RunSynchronously |
|
|
|
|
fileSaved (spec.width.ToString()) (spec.height.ToString()) = true |
|
|
|
|
|
|
|
|
|
[<Property>] |
|
|
|
|
let ``Can create image with border`` () = |
|
|
|
|
resetSavingTestArea () |
|
|
|
|
let spec = |
|
|
|
|
{ // See note accompanying 'randomInt' function for constraints information. |
|
|
|
|
width = randomInt () |
|
|
|
|
height = randomInt () |
|
|
|
|
colour = randomColour () :?> Brush |
|
|
|
|
filePath = saveLocation |
|
|
|
|
overlay = Some (buildBorderOverlay ()) } |
|
|
|
|
makeImage spec |> Async.RunSynchronously |
|
|
|
|
fileSaved (spec.width.ToString()) (spec.height.ToString()) = true |
|
|
|
|