Skip to content

Fix Arbitrary instances for color spaces / models with unusual coordinate ranges #6

@gilgamec

Description

@gilgamec

I noticed that the test specifications for e.g. LAB use the same Abritrary instance as others:

instance (Elevator e, Random e, Illuminant i) => Arbitrary (Color (LAB (i :: k)) e) where
  arbitrary = ColorLAB <$> arbitraryElevator <*> arbitraryElevator <*> arbitraryElevator

where arbitraryElevator gives either the full range of values (for discrete quanta like Word8) or the range [0,1] for Float and Double. However, LAB at least (and possibly others) uses a different range: L can go from 0 to 100, while a and b vary in a similar range, depending on L, and can also be negative. Thus, right now the spec tests are only checking colors very close to black. I'm not sure how this can be handled within QuickCheck.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions