-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More spec for alternative RGB color spaces
- Loading branch information
Showing
6 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
Color/tests/Graphics/Color/Space/RGB/Alternative/CMYKSpec.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{-# LANGUAGE FlexibleInstances #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
module Graphics.Color.Space.RGB.Alternative.CMYKSpec (spec) where | ||
|
||
import Graphics.Color.Space.Common | ||
import Graphics.Color.Space.RGB.SRGB | ||
import qualified Graphics.Color.Space.RGB.Derived.SRGB as Derived | ||
import Graphics.Color.Space.RGB.Alternative.CMYK | ||
import Graphics.Color.Space.RGB.Derived.SRGBSpec () | ||
|
||
|
||
instance (Elevator e, Random e) => Arbitrary (Color (CMYK cs) e) where | ||
arbitrary = | ||
ColorCMYK <$> arbitraryElevator <*> arbitraryElevator <*> arbitraryElevator <*> | ||
arbitraryElevator | ||
|
||
spec :: Spec | ||
spec = | ||
describe "CMYK" $ do | ||
colorModelSpec @(CMYK (Derived.SRGB D65)) @Word "CMYK" | ||
colorSpaceCommonSpec @(CMYK (Derived.SRGB D65)) @_ @Double $ pure () | ||
-- Arbitrary inverse CMYKtoSRGB is not true. | ||
prop "sRGBtoCMYK" $ \ (srgb :: Color (Derived.SRGB D65) Double) -> | ||
toBaseSpace (fromBaseSpace srgb :: Color (CMYK (Derived.SRGB D65)) Double) | ||
`epsilonEqColor` srgb |
21 changes: 21 additions & 0 deletions
21
Color/tests/Graphics/Color/Space/RGB/Alternative/HSISpec.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{-# LANGUAGE FlexibleInstances #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
module Graphics.Color.Space.RGB.Alternative.HSISpec (spec) where | ||
|
||
import Graphics.Color.Space.Common | ||
import Graphics.Color.Space.RGB.SRGB | ||
import qualified Graphics.Color.Space.RGB.Derived.SRGB as Derived | ||
import Graphics.Color.Space.RGB.Alternative.HSI | ||
import Graphics.Color.Space.RGB.SRGBSpec () | ||
import Graphics.Color.Space.RGB.Derived.SRGBSpec () | ||
|
||
|
||
instance (Elevator e, Random e) => Arbitrary (Color (HSI cs) e) where | ||
arbitrary = ColorHSI <$> arbitraryElevator <*> arbitraryElevator <*> arbitraryElevator | ||
|
||
spec :: Spec | ||
spec = | ||
describe "HSI" $ do | ||
describe "Derived-sRGB" $ do | ||
colorModelSpec @(HSI (Derived.SRGB D65)) @Word "HSI" | ||
colorSpaceSpec @(HSI (Derived.SRGB D65)) @_ @Double |
21 changes: 21 additions & 0 deletions
21
Color/tests/Graphics/Color/Space/RGB/Alternative/HSLSpec.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{-# LANGUAGE FlexibleInstances #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
module Graphics.Color.Space.RGB.Alternative.HSLSpec (spec) where | ||
|
||
import Graphics.Color.Space.Common | ||
import Graphics.Color.Space.RGB.SRGB | ||
import qualified Graphics.Color.Space.RGB.Derived.SRGB as Derived | ||
import Graphics.Color.Space.RGB.Alternative.HSL | ||
import Graphics.Color.Space.RGB.SRGBSpec () | ||
import Graphics.Color.Space.RGB.Derived.SRGBSpec () | ||
|
||
|
||
instance (Elevator e, Random e) => Arbitrary (Color (HSL cs) e) where | ||
arbitrary = ColorHSL <$> arbitraryElevator <*> arbitraryElevator <*> arbitraryElevator | ||
|
||
spec :: Spec | ||
spec = | ||
describe "HSL" $ do | ||
describe "Derived-sRGB" $ do | ||
colorModelSpec @(HSL (Derived.SRGB D65)) @Word "HSL" | ||
colorSpaceSpec @(HSL (Derived.SRGB D65)) @_ @Double |
21 changes: 21 additions & 0 deletions
21
Color/tests/Graphics/Color/Space/RGB/Alternative/HSVSpec.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{-# LANGUAGE FlexibleInstances #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
module Graphics.Color.Space.RGB.Alternative.HSVSpec (spec) where | ||
|
||
import Graphics.Color.Space.Common | ||
import Graphics.Color.Space.RGB.SRGB | ||
import qualified Graphics.Color.Space.RGB.Derived.SRGB as Derived | ||
import Graphics.Color.Space.RGB.Alternative.HSV | ||
import Graphics.Color.Space.RGB.SRGBSpec () | ||
import Graphics.Color.Space.RGB.Derived.SRGBSpec () | ||
|
||
|
||
instance (Elevator e, Random e) => Arbitrary (Color (HSV cs) e) where | ||
arbitrary = ColorHSV <$> arbitraryElevator <*> arbitraryElevator <*> arbitraryElevator | ||
|
||
spec :: Spec | ||
spec = | ||
describe "HSV" $ do | ||
describe "Derived-sRGB" $ do | ||
colorModelSpec @(HSV (Derived.SRGB D65)) @Word "HSV" | ||
colorSpaceSpec @(HSV (Derived.SRGB D65)) @_ @Double |