From fc0d8babf2a0da1d0522b7b9362efbc9c3577346 Mon Sep 17 00:00:00 2001 From: "OPTIMUS-PRIME\\craig" Date: Fri, 7 Sep 2018 23:49:07 +0100 Subject: [PATCH] add a sleep period when creating an overlay in library tests. --- TestCentre/LibraryTests.fs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/TestCentre/LibraryTests.fs b/TestCentre/LibraryTests.fs index 6c8feca..0ade21a 100644 --- a/TestCentre/LibraryTests.fs +++ b/TestCentre/LibraryTests.fs @@ -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 } + [] - 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 + + [] + 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