Browse Source

add SavingTestArea unit test and script to fix it if its fails.

master
Craig Oates 6 years ago
parent
commit
bd89dd7a8a
  1. 1
      DeathSocket/ImageServices.fs
  2. 11
      TestCentre/LibraryTests.fs
  3. 22
      TestCentre/Script.fsx

1
DeathSocket/ImageServices.fs

@ -35,7 +35,6 @@
// for line in verticalLines do graphics.DrawLines (pen, line)
// clone.Save (spec.savePath)
// not tested but same as Draw Grid -- this is its replacement
let drawBrushSpecGrid (spec: BrushSpec) =
// The temp. file is used as a way to convert images with indexed pixels.
use original = Bitmap.FromFile spec.originalPath

11
TestCentre/LibraryTests.fs

@ -113,6 +113,7 @@
open Xunit
open DeathSocket
open System
open System.IO
(* This test is a precaution (a test for the tests if you will...).
It is here to make sure the property test has what it needs to run.
@ -125,6 +126,16 @@
let imagesAreThere = if length < 100 then false else true
Assert.True imagesAreThere
(* This test is a precaution. If the property tests fails, here is a
good place to start. The easiest way to get this test to pass is to
create a folder called "SavingTestArea" in this projects folder
(at the root). You can, also, see script.fs (in Test Centre) for
creating this folder via code. (See "LoadingTestArea contains..." note
for extra context. *)
[<Fact>]
let ``SavingTestArea folder can be found`` () =
Assert.True (Directory.Exists saveLocation)
[<Fact>]
let ``Divide By Zero Exception is thrown when 0 rows is used when determining horizontal lines`` () =
let result () = GridPainter.determineHorizontalLines 100 100 0

22
TestCentre/Script.fsx

@ -14,7 +14,7 @@ let loadLocation = __SOURCE_DIRECTORY__ + "/LoadingTestArea"
let saveLocation = __SOURCE_DIRECTORY__ + "/SavingTestArea"
let random = Random()
(*Resetting the Testing Area Folders Scripts
(* Resetting the Testing Area Folders Scripts
===============================================================================
The following scripts are for when you need to "manually" clear out the
LoadingTestArea and SavingTestArea folders. If you do not want to open up the
@ -93,4 +93,22 @@ let populateLoadingTestArea () =
// You should only need this once.
// Make sure you have passed the above into F# Interactive.
populateLoadingTestArea ()
populateLoadingTestArea ()
(* Creating the Saving Test Area Script
==============================================================================
This bit of code is for creating the SavingTestArea folder which Test Centre
will use when it runs its tests. You will normally only need to run this code
when you have just cloned this repository or you accidently deleted said
fodler. In other words, you should only need to use it once. *)
let createSavingTestArea () =
match Directory.Exists saveLocation with
| false ->
Directory.CreateDirectory saveLocation |> ignore
printfn "SavingTestArea created."
| _ -> printfn "SavingTestArea already exists."
(* Before calling this function, make sure the test checking this folder exists
is failing first. *)
createSavingTestArea ()
Loading…
Cancel
Save