Hello community, here is the log from the commit of package ghc-diagrams-lib for openSUSE:Factory checked in at 2017-06-21 13:55:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-diagrams-lib (Old) and /work/SRC/openSUSE:Factory/.ghc-diagrams-lib.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-diagrams-lib" Wed Jun 21 13:55:08 2017 rev:2 rq:504662 version:1.4.1.2 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-diagrams-lib/ghc-diagrams-lib.changes 2017-05-16 14:38:37.866129346 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-diagrams-lib.new/ghc-diagrams-lib.changes 2017-06-21 13:55:10.812393993 +0200 @@ -1,0 +2,10 @@ +Mon Jun 12 09:41:42 UTC 2017 - [email protected] + +- Update to version 1.4.1.2. + +------------------------------------------------------------------- +Wed May 31 14:05:43 UTC 2017 - [email protected] + +- Update to version 1.4.1. + +------------------------------------------------------------------- Old: ---- diagrams-lib-1.4.0.1.tar.gz diagrams-lib.cabal New: ---- diagrams-lib-1.4.1.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-diagrams-lib.spec ++++++ --- /var/tmp/diff_new_pack.wiprzy/_old 2017-06-21 13:55:12.104211770 +0200 +++ /var/tmp/diff_new_pack.wiprzy/_new 2017-06-21 13:55:12.108211206 +0200 @@ -19,19 +19,19 @@ %global pkg_name diagrams-lib %bcond_with tests Name: ghc-%{pkg_name} -Version: 1.4.0.1 +Version: 1.4.1.2 Release: 0 Summary: Embedded domain-specific language for declarative graphics License: BSD-3-Clause Group: Development/Languages/Other Url: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel BuildRequires: ghc-JuicyPixels-devel BuildRequires: ghc-active-devel BuildRequires: ghc-adjunctions-devel BuildRequires: ghc-array-devel +BuildRequires: ghc-bytestring-devel BuildRequires: ghc-cereal-devel BuildRequires: ghc-colour-devel BuildRequires: ghc-containers-devel @@ -90,7 +90,6 @@ %prep %setup -q -n %{pkg_name}-%{version} -cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build ++++++ diagrams-lib-1.4.0.1.tar.gz -> diagrams-lib-1.4.1.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/CHANGELOG.md new/diagrams-lib-1.4.1.2/CHANGELOG.md --- old/diagrams-lib-1.4.0.1/CHANGELOG.md 2016-11-07 13:04:33.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/CHANGELOG.md 2017-06-10 19:13:45.000000000 +0200 @@ -1,3 +1,24 @@ +## [v1.4.1.2](https://github.com/diagrams/diagrams-lib/tree/v1.4.1.2) (2017-06-10) + +- Fix test suite compilation failure [#299](https://github.com/diagrams/diagrams-lib/issues/299). + +## [v1.4.1.1](https://github.com/diagrams/diagrams-lib/tree/v1.4.1.1) (2017-06-06) + +- Fix `Diagrams.Points.centroid` to make it total. +- Fix bug in `Diagrams.Transform.Matrix.fromMatWithInv` (and hence + also related functions which called it, such as `fromMat22` and + `fromMat33`). + +## [v1.4.1](https://github.com/diagrams/diagrams-lib/tree/v1.4.1) (2017-05-28) + +- New functions `embeddedImage` and `loadImageEmbBS` for loading + images. +- Fix [#289](https://github.com/diagrams/diagrams-lib/issues/289) + which could have caused strange behavior in looped compilation mode + on 32-bit platforms. +- Allow `intervals-0.8` and `directory-1.3`. +- Minor fixes to compile with GHC 8.2. + ## [v1.4.0.1](https://github.com/diagrams/diagrams-lib/tree/v1.4.0.1) (2016-11-07) - Fix test suite compilation problem ([#286](https://github.com/diagrams/diagrams-lib/issues/286)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/diagrams-lib.cabal new/diagrams-lib-1.4.1.2/diagrams-lib.cabal --- old/diagrams-lib-1.4.0.1/diagrams-lib.cabal 2016-11-07 13:04:33.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/diagrams-lib.cabal 2017-06-10 19:13:45.000000000 +0200 @@ -1,5 +1,5 @@ Name: diagrams-lib -Version: 1.4.0.1 +Version: 1.4.1.2 Synopsis: Embedded domain-specific language for declarative graphics Description: Diagrams is a flexible, extensible EDSL for creating graphics of many types. Graphics can be created @@ -100,7 +100,7 @@ Diagrams.TwoD.Types, Diagrams.TwoD.Vector, Diagrams.Util - Build-depends: base >= 4.6 && < 4.10, + Build-depends: base >= 4.6 && < 4.11, containers >= 0.3 && < 0.6, array >= 0.3 && < 0.6, semigroups >= 0.3.4 && < 0.19, @@ -112,7 +112,7 @@ colour >= 2.3.2 && < 2.4, data-default-class < 0.2, fingertree >= 0.1 && < 0.2, - intervals >= 0.7 && < 0.8, + intervals >= 0.7 && < 0.9, lens >= 4.6 && < 4.16, tagged >= 0.7, optparse-applicative >= 0.11 && < 0.14, @@ -124,14 +124,15 @@ distributive >=0.2.2 && < 1.0, process >= 1.1 && < 1.5, fsnotify >= 0.2.1 && < 0.3, - directory >= 1.2 && < 1.3, + directory >= 1.2 && < 1.4, unordered-containers >= 0.2 && < 0.3, text >= 0.7.1 && < 1.3, mtl >= 2.0 && < 2.3, transformers >= 0.3.0 && < 0.6.0, profunctors >= 5.0 && < 6.0, exceptions >= 0.6 && < 1.0, - cereal >=0.4.1.1 && <0.6 + cereal >=0.4.1.1 && <0.6, + bytestring >=0.9 && <0.11 if impl(ghc < 7.6) Build-depends: ghc-prim Hs-source-dirs: src @@ -150,18 +151,20 @@ other-modules: Diagrams.Test.Direction , Diagrams.Test.Trail , Diagrams.Test.Transform + , Diagrams.Test.Transform.Matrix , Diagrams.Test.TwoD.Offset , Diagrams.Test.TwoD , Diagrams.Test.Angle , Instances hs-source-dirs: test - build-depends: base >= 4.2 && < 4.10, + build-depends: base, tasty >= 0.10 && < 0.12, tasty-hunit >= 0.9.2 && < 0.10, tasty-quickcheck >= 0.8 && < 0.9, deepseq >= 1.3 && < 1.5, diagrams-lib, lens, + distributive, numeric-extras, diagrams-solve default-language: Haskell2010 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/src/Diagrams/Backend/CmdLine.hs new/diagrams-lib-1.4.1.2/src/Diagrams/Backend/CmdLine.hs --- old/diagrams-lib-1.4.0.1/src/Diagrams/Backend/CmdLine.hs 2016-11-07 13:04:33.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/src/Diagrams/Backend/CmdLine.hs 2017-06-10 19:13:45.000000000 +0200 @@ -609,7 +609,7 @@ putStrLn $ "Program args: " ++ unwords args' forever . threadDelay $ case os of -- https://ghc.haskell.org/trac/ghc/ticket/7325 - "darwin" -> 5000000000000 + "darwin" -> 2000000000 _ -> maxBound recompile :: FilePath -> FilePath -> [String] -> IO ExitCode diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/src/Diagrams/Combinators.hs new/diagrams-lib-1.4.1.2/src/Diagrams/Combinators.hs --- old/diagrams-lib-1.4.0.1/src/Diagrams/Combinators.hs 2016-11-07 13:04:33.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/src/Diagrams/Combinators.hs 2017-06-10 19:13:45.000000000 +0200 @@ -113,7 +113,7 @@ -- to alignment and envelope acts like a 1-dimensional segment -- oriented along the vector @v@, with local origin at its -- center. (Note, however, that it has an empty trace; for 2D struts --- with a nonempty trace see 'strutR2', 'strutX', and 'strutY' from +-- with a nonempty trace see 'strutR2' from -- "Diagrams.TwoD.Combinators".) Useful for manually creating -- separation between two diagrams. -- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/src/Diagrams/Names.hs new/diagrams-lib-1.4.1.2/src/Diagrams/Names.hs --- old/diagrams-lib-1.4.0.1/src/Diagrams/Names.hs 2016-11-07 13:04:33.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/src/Diagrams/Names.hs 2017-06-10 19:13:45.000000000 +0200 @@ -1,4 +1,5 @@ {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE MonoLocalBinds #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.Names diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/src/Diagrams/Parametric.hs new/diagrams-lib-1.4.1.2/src/Diagrams/Parametric.hs --- old/diagrams-lib-1.4.0.1/src/Diagrams/Parametric.hs 2016-11-07 13:04:33.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/src/Diagrams/Parametric.hs 2017-06-10 19:13:45.000000000 +0200 @@ -55,7 +55,7 @@ -- with numeric scalars). domainUpper :: p -> N p - default domainUpper :: Num n => p -> n + default domainUpper :: Num (N p) => p -> N p domainUpper = const 1 -- | Type class for querying the values of a parametric object at the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/src/Diagrams/Points.hs new/diagrams-lib-1.4.1.2/src/Diagrams/Points.hs --- old/diagrams-lib-1.4.0.1/src/Diagrams/Points.hs 2016-11-07 13:04:33.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/src/Diagrams/Points.hs 2017-06-10 19:13:45.000000000 +0200 @@ -29,8 +29,11 @@ import Linear.Vector -- | The centroid of a set of /n/ points is their sum divided by /n/. +-- Returns the origin for an empty list of points. centroid :: (Additive v, Fractional n) => [Point v n] -> Point v n -centroid = meanV +centroid [] = origin +centroid ps = meanV ps +{-# INLINE centroid #-} meanV :: (Foldable f, Additive v, Fractional a) => f (v a) -> v a meanV = uncurry (^/) . F.foldl' (\(s,c) e -> (e ^+^ s,c+1)) (zero,0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/src/Diagrams/Segment.hs new/diagrams-lib-1.4.1.2/src/Diagrams/Segment.hs --- old/diagrams-lib-1.4.0.1/src/Diagrams/Segment.hs 2016-11-07 13:04:33.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/src/Diagrams/Segment.hs 2017-06-10 19:13:45.000000000 +0200 @@ -325,6 +325,11 @@ reverseSegment (Linear (OffsetClosed v)) = straight (negated v) reverseSegment (Cubic c1 c2 (OffsetClosed x2)) = bezier3 (c2 ^-^ x2) (c1 ^-^ x2) (negated x2) +-- Imitates I.elem for intervals<0.8 and I.member for intervals>=0.8 +member :: Ord a => a -> I.Interval a -> Bool +member x (I.I a b) = x >= a && x <= b +{-# INLINE member #-} + instance (Metric v, OrderedField n) => HasArcLength (Segment Closed v n) where @@ -339,9 +344,9 @@ arcLengthToParam m s _ | arcLength m s == 0 = 0.5 arcLengthToParam m s@(Linear {}) len = len / arcLength m s arcLengthToParam m s@(Cubic {}) len - | len `I.elem` I (-m/2) (m/2) = 0 + | len `member` I (-m/2) (m/2) = 0 | len < 0 = - arcLengthToParam m (fst (splitAtParam s (-1))) (-len) - | len `I.elem` slen = 1 + | len `member` slen = 1 | len > I.sup slen = 2 * arcLengthToParam m (fst (splitAtParam s 2)) len | len < I.sup llen = (*0.5) $ arcLengthToParam m l len | otherwise = (+0.5) . (*0.5) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/src/Diagrams/Trace.hs new/diagrams-lib-1.4.1.2/src/Diagrams/Trace.hs --- old/diagrams-lib-1.4.0.1/src/Diagrams/Trace.hs 2016-11-07 13:04:33.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/src/Diagrams/Trace.hs 2017-06-10 19:13:45.000000000 +0200 @@ -1,4 +1,5 @@ {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE MonoLocalBinds #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.Trace diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/src/Diagrams/Transform/Matrix.hs new/diagrams-lib-1.4.1.2/src/Diagrams/Transform/Matrix.hs --- old/diagrams-lib-1.4.0.1/src/Diagrams/Transform/Matrix.hs 2016-11-07 13:04:33.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/src/Diagrams/Transform/Matrix.hs 2017-06-10 19:13:45.000000000 +0200 @@ -1,4 +1,5 @@ -{-# LANGUAGE CPP #-} +{-# LANGUAGE CPP #-} +{-# LANGUAGE MonoLocalBinds #-} ----------------------------------------------------------------------------- -- | @@ -39,13 +40,13 @@ -- translation vector. Does not check if the matrix is not invertible -- (in which case the 'T2' will be invalid). fromMat22 :: Floating n => M22 n -> V2 n -> T2 n -fromMat22 m v = flip (fromMatWithInv m) v $ inv22 m +fromMat22 m v = fromMatWithInv m (inv22 m) v -- | Make a 3D transformation from a 3x3 transform matrix and a -- translation vector. Does not check if the matrix is not invertible -- (in which case the 'T3' will be invalid). fromMat33 :: Floating n => M33 n -> V3 n -> T3 n -fromMat33 m v = flip (fromMatWithInv m) v $ inv33 m +fromMat33 m v = fromMatWithInv m (inv33 m) v -- | Build a transform with a maxtrix along with its inverse. fromMatWithInv :: (Additive v, Distributive v, F.Foldable v, Num n) @@ -54,8 +55,8 @@ -> v n -- ^ translation -> Transformation v n fromMatWithInv m m_ v = - Transformation ((*! m) <-> (*! m_)) - ((*! distribute m) <-> (*! distribute m_)) + Transformation ((m !*) <-> (m_ !*)) + ((distribute m !*) <-> (distribute m_ !*)) v -- | Prism onto a 2D transformation from a 2x2 transform matrix and @@ -64,7 +65,8 @@ mat22 :: Floating n => Iso' (M22 n, V2 n) (T2 n) mat22 = iso (uncurry fromMat22) (mkMat &&& transl) --- | Prism onto a 2D transformation from a 2x2 transform matrix and --- translation vector (in which case the 'T3' will be invalid). +-- | Prism onto a 3D transformation from a 3x3 transform matrix and +-- translation vector. Does not check if the matrix is invertible +-- (in which case the 'T3' will be invalid). mat33 :: Floating n => Iso' (M33 n, V3 n) (T3 n) mat33 = iso (uncurry fromMat33) (mkMat &&& transl) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/src/Diagrams/TwoD/Image.hs new/diagrams-lib-1.4.1.2/src/Diagrams/TwoD/Image.hs --- old/diagrams-lib-1.4.0.1/src/Diagrams/TwoD/Image.hs 2016-11-07 13:04:33.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/src/Diagrams/TwoD/Image.hs 2017-06-10 19:13:45.000000000 +0200 @@ -25,7 +25,9 @@ DImage(..), ImageData(..) , Embedded, External, Native , image + , embeddedImage , loadImageEmb + , loadImageEmbBS , loadImageExt , uncheckedImageRef , raster @@ -48,6 +50,8 @@ import Diagrams.Query import Diagrams.TwoD.Types +import Data.ByteString + import Linear.Affine data Embedded deriving Typeable @@ -103,17 +107,22 @@ rectPath :: RealFloat n => n -> n -> Path V2 n rectPath = rect --- | Use JuicyPixels to read an image in any format and wrap it in a 'DImage'. +-- | Read a JuicyPixels @DynamicImage@ and wrap it in a 'DImage'. +-- The width and height of the image are set to their actual values. +embeddedImage :: Num n => DynamicImage -> DImage n Embedded +embeddedImage img = DImage (ImageRaster img) w h mempty + where + w = dynamicMap imageWidth img + h = dynamicMap imageHeight img + +-- | Use JuicyPixels to read a file in any format and wrap it in a 'DImage'. -- The width and height of the image are set to their actual values. loadImageEmb :: Num n => FilePath -> IO (Either String (DImage n Embedded)) -loadImageEmb path = do - dImg <- readImage path - return $ case dImg of - Left msg -> Left msg - Right img -> Right (DImage (ImageRaster img) w h mempty) - where - w = dynamicMap imageWidth img - h = dynamicMap imageHeight img +loadImageEmb path = fmap embeddedImage `fmap` readImage path + +-- | A pure variant of 'loadImageEmb' +loadImageEmbBS :: Num n => ByteString -> Either String (DImage n Embedded) +loadImageEmbBS bs = embeddedImage `fmap` decodeImage bs -- | Check that a file exists, and use JuicyPixels to figure out -- the right size, but save a reference to the image instead diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/test/Diagrams/Test/Transform/Matrix.hs new/diagrams-lib-1.4.1.2/test/Diagrams/Test/Transform/Matrix.hs --- old/diagrams-lib-1.4.0.1/test/Diagrams/Test/Transform/Matrix.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/test/Diagrams/Test/Transform/Matrix.hs 2017-06-10 19:13:45.000000000 +0200 @@ -0,0 +1,26 @@ +{-# LANGUAGE ScopedTypeVariables #-} + +-- | + +module Diagrams.Test.Transform.Matrix where + + +import Test.Tasty +import Test.Tasty.QuickCheck +import Diagrams.Transform.Matrix +import Diagrams.Prelude +import Data.Distributive (distribute) + +import Instances + +tests :: TestTree +tests = testGroup "Transform.Matrix" + [ + testProperty "mkMat column vectors (2D)" $ + \(Blind (t :: T2 Double)) -> distribute (mkMat t) =~ V2 (transform t unitX) (transform t unitY) + , testProperty "mkMat / fromMat22" $ + \(m :: V2 (V2 Double)) -> mkMat (fromMat22 m zero) =~ m + + , testProperty "mkMat / fromMat33" $ + \(m :: V3 (V3 Double)) -> mkMat (fromMat33 m zero) =~ m + ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/test/Diagrams/Test/Transform.hs new/diagrams-lib-1.4.1.2/test/Diagrams/Test/Transform.hs --- old/diagrams-lib-1.4.0.1/test/Diagrams/Test/Transform.hs 2016-11-07 13:04:33.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/test/Diagrams/Test/Transform.hs 2017-06-10 19:13:45.000000000 +0200 @@ -15,31 +15,31 @@ testProperty "rotating a vector by a number then its additive inverse will yield the original vector" $ \θ a -> rotate ((θ * (-1)) @@ deg) (rotate ((θ :: Double) @@ deg) (a :: V2 Double)) =~ a , testProperty "under rotated allows scaling along an angle" $ - \θ f a -> under (rotated ((θ :: Double) @@ deg)) (scaleX (f :: Double)) (a :: V2 Double) == (rotate (negated (θ @@ deg)) . (scaleX f) . rotate (θ @@ deg)) a + \θ f a -> under (rotated ((θ :: Double) @@ deg)) (scaleX (f :: Double)) (a :: V2 Double) =~ (rotate (negated (θ @@ deg)) . (scaleX f) . rotate (θ @@ deg)) a , testProperty "a rotation of 0 does nothing" $ \a -> rotate (0 @@ deg) (a :: V2 Double) =~ a , testProperty "adding 360 degrees to a turn does nothing" $ \c a -> rotate (((c :: Double) + 360) @@ deg) (a :: V2 Double) =~ rotate (c @@ deg) a , testProperty "over rotated allows scaling along x of a rotated shape" $ - \θ f a -> over (rotated ((θ :: Double) @@ deg)) (scaleX (f :: Double)) (a :: V2 Double) == (rotate (θ @@ deg) . (scaleX f) . rotate (negated (θ @@ deg))) a + \θ f a -> over (rotated ((θ :: Double) @@ deg)) (scaleX (f :: Double)) (a :: V2 Double) =~ (rotate (θ @@ deg) . (scaleX f) . rotate (negated (θ @@ deg))) a , testProperty "scaleX" $ - \f a b -> (scaleX (f :: Double)) (V2 (a :: Double) b) == V2 (a * f) b + \f a b -> (scaleX (f :: Double)) (V2 (a :: Double) b) =~ V2 (a * f) b , testProperty "scaleY" $ - \f a b -> (scaleY (f :: Double)) (V2 (a :: Double) b) == V2 a (f * b) + \f a b -> (scaleY (f :: Double)) (V2 (a :: Double) b) =~ V2 a (f * b) , testProperty "reflectX" $ - \a b -> reflectX (V2 (a :: Double) b) == V2 (a * (-1)) b + \a b -> reflectX (V2 (a :: Double) b) =~ V2 (a * (-1)) b , testProperty "reflectY" $ - \a b -> reflectY (V2 (a :: Double) b) == V2 a ((-1) * b) + \a b -> reflectY (V2 (a :: Double) b) =~ V2 a ((-1) * b) , testProperty "reflectXY" $ - \a b -> reflectXY (V2 (a :: Double) b) == V2 b a + \a b -> reflectXY (V2 (a :: Double) b) =~ V2 b a , testProperty "translate" $ - \a b c d -> translateX (a :: Double) (translateY b (P (V2 c d ))) == P (V2 (a + c) (b + d)) + \a b c d -> translateX (a :: Double) (translateY b (P (V2 c d ))) =~ P (V2 (a + c) (b + d)) , testProperty "shear" $ - \a b c d -> shearX (a :: Double) (shearY b (V2 c d)) == V2 ((c*b + d) * a + c) (c*b + d) + \a b c d -> shearX (a :: Double) (shearY b (V2 c d)) =~ V2 ((c*b + d) * a + c) (c*b + d) , testProperty "(1,0) rotateTo some dir will return normalised dir" $ \(NonZero a) b -> rotateTo (dir (V2 (a :: Double) b)) (V2 1 0) =~ signorm (V2 a b) , testProperty "rotates" $ - \a c -> rotate ((a :: Double)@@ deg) (c :: V2 Double) == rotate'' ((a :: Double)@@ deg) (c :: V2 Double) && rotate ((a :: Double)@@ deg) (c :: V2 Double) == rotate' ((a :: Double)@@ deg) (c :: V2 Double) + \a c -> rotate ((a :: Double)@@ deg) (c :: V2 Double) =~ rotate'' ((a :: Double)@@ deg) (c :: V2 Double) && rotate ((a :: Double)@@ deg) (c :: V2 Double) =~ rotate' ((a :: Double)@@ deg) (c :: V2 Double) , testProperty "reflectAbout works for a vector" $ \a b c d e f -> reflectAbout (P (V2 (a :: Double) b)) (dir (V2 c d)) (V2 e f) =~ over (rotated (atan2A' d c)) reflectY (V2 e f) , testProperty "reflectAbout works for a point" $ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/test/Instances.hs new/diagrams-lib-1.4.1.2/test/Instances.hs --- old/diagrams-lib-1.4.0.1/test/Instances.hs 2016-11-07 13:04:33.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/test/Instances.hs 2017-06-10 19:13:45.000000000 +0200 @@ -13,7 +13,8 @@ import Diagrams.Prelude import Numeric.Extras -import Test.Tasty.QuickCheck +import Test.Tasty.QuickCheck (Arbitrary(..), Gen) +import qualified Test.Tasty.QuickCheck as QC ------------------------------------------------------------ -- Approximate Comparison for Doubles, Points @@ -36,6 +37,9 @@ instance Approx n => Approx (V2 n) where z1 =~ z2 = (z1^._x) =~ (z2^._x) && (z1^._y) =~ (z2^._y) +instance Approx n => Approx (V3 n) where + z1 =~ z2 = (z1^._x) =~ (z2^._x) && (z1^._y) =~ (z2^._y) && (z1^._z) =~ (z2^._z) + instance Approx (v n) => Approx (Point v n) where p =~ q = view _Point p =~ view _Point q @@ -86,10 +90,26 @@ arbitrary = (^&) <$> arbitrary <*> arbitrary shrink (coords -> x :& y) = (^&) <$> shrink x <*> shrink y +instance Arbitrary n => Arbitrary (V3 n) where + arbitrary = V3 <$> arbitrary <*> arbitrary <*> arbitrary + shrink (coords -> x :& y :& z) = V3 <$> shrink x <*> shrink y <*> shrink z + instance Arbitrary (v n) => Arbitrary (Point v n) where arbitrary = P <$> arbitrary shrink (P v) = P <$> shrink v +instance (Arbitrary n, Floating n, Ord n) => Arbitrary (Transformation V2 n) where + arbitrary = QC.sized arbT + where + arbT 0 = return mempty + arbT n = QC.oneof + [ rotation <$> arbitrary + , scaling <$> arbitrary + , translation <$> arbitrary + , reflectionAbout <$> arbitrary <*> arbitrary + , (<>) <$> arbT (n `div` 2) <*> arbT (n `div` 2) + ] + instance Arbitrary n => Arbitrary (Angle n) where arbitrary = review rad <$> arbitrary @@ -114,7 +134,7 @@ -- shrink (OffsetClosed x) = OffsetClosed <$> shrink x instance Arbitrary n => Arbitrary (Segment Closed V2 n) where - arbitrary = oneof [Linear <$> arbitrary, Cubic <$> arbitrary <*> arbitrary <*> arbitrary] + arbitrary = QC.oneof [Linear <$> arbitrary, Cubic <$> arbitrary <*> arbitrary <*> arbitrary] -- shrink (Linear x) = Linear <$> shrink x -- shrink (Cubic x y z) = Linear z -- : [Cubic x' y' z' | (x',y',z') <- shrink (x,y,z)] @@ -128,5 +148,5 @@ -- shrink (cutLoop -> l) = closeLine <$> shrink l instance (Arbitrary n, Floating n, Ord n) => Arbitrary (Trail V2 n) where - arbitrary = oneof [Trail <$> (arbitrary :: Gen (Trail' Loop V2 n)), Trail <$> (arbitrary :: Gen (Trail' Line V2 n))] + arbitrary = QC.oneof [Trail <$> (arbitrary :: Gen (Trail' Loop V2 n)), Trail <$> (arbitrary :: Gen (Trail' Line V2 n))] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diagrams-lib-1.4.0.1/test/Test.hs new/diagrams-lib-1.4.1.2/test/Test.hs --- old/diagrams-lib-1.4.0.1/test/Test.hs 2016-11-07 13:04:33.000000000 +0100 +++ new/diagrams-lib-1.4.1.2/test/Test.hs 2017-06-10 19:13:45.000000000 +0200 @@ -3,6 +3,7 @@ import qualified Diagrams.Test.Angle as Angle import qualified Diagrams.Test.Direction as Direction import qualified Diagrams.Test.Transform as Transform +import qualified Diagrams.Test.Transform.Matrix as TransformMatrix import qualified Diagrams.Test.TwoD as TwoD import qualified Diagrams.Test.TwoD.Offset as TwoD.Offset @@ -15,6 +16,7 @@ , Angle.tests , Direction.tests , Transform.tests + , TransformMatrix.tests , Trail.tests ]
