Browse Source

add tests and images for GridPainter (dimensions) function

master
Craig Oates 5 years ago
parent
commit
bc6532c613
  1. 4
      DeathSocket/GridPainter.fs
  2. 34
      TestCentre/LibraryTests.fs

4
DeathSocket/GridPainter.fs

@ -91,9 +91,9 @@ namespace DeathSocket
/// information is the thing this function cares about most of all. How
/// it is read and what library it uses it secondary.
///</remarks>
let determineImageDimensions (iType: ImageType) =
let determineImageDimensions (imgType: ImageType) =
try
match iType with
match imgType with
| SkiaSharp s ->
validateFilePath s |> ignore
determineSkiaDimensions s

34
TestCentre/LibraryTests.fs

@ -227,9 +227,41 @@
open System
open System.IO
[<Fact>]
let ``Can determine image width using SkiaSharp`` () =
let dimensions =
SkiaSharp (loadLocation + "/RequiredInfo/Skia-599x336.png")
|> GridPainter.determineImageDimensions
let result () = (fst dimensions) = 599
Assert.True (result ())
[<Fact>]
let ``Can determine image height using SkiaSharp`` () =
let dimensions =
SkiaSharp (loadLocation + "/RequiredInfo/Skia-599x336.png")
|> GridPainter.determineImageDimensions
let result () = (snd dimensions) = 336
Assert.True (result ())
[<Fact>]
let ``Can determine image width using SystemDrawing`` () =
let dimensions =
SystemDrawing (loadLocation + "/RequiredInfo/SystemDrawing-338x307.png")
|> GridPainter.determineImageDimensions
let result () = (fst dimensions) = 338
Assert.True (result ())
[<Fact>]
let ``Can determine image height using SystemDrawing`` () =
let dimensions =
SystemDrawing (loadLocation + "/RequiredInfo/SystemDrawing-338x307.png")
|> GridPainter.determineImageDimensions
let result () = (snd dimensions) = 307
Assert.True (result ())
(* This test is a pre-test test (a test for the tests if you will...).
It is here to make sure the property test has what it needs to run.
If the property test fails, here is a good place to start.
If the property tests fails, here is a good place to start.
See script.fs (in Test Centre) for information on populating the
LoadingTestArea folder. *)
[<Fact>]

Loading…
Cancel
Save