Browse Source

add a sleep period when creating an overlay in library tests.

master
Craig Oates 6 years ago
parent
commit
fc0d8babf2
  1. 27
      TestCentre/LibraryTests.fs

27
TestCentre/LibraryTests.fs

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

Loading…
Cancel
Save