mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-07-31 20:21:51 -07:00
rewrite GridSelect.stringToRatio to use randomR (fixes #572)
Due to differences between random-1.1 and random-1.2, on newer systems stringToRatio returns numbers outside [0, 1] range, which breaks colorRangeFromClassName colorizers. This commit fixes the issue by using randomR to directly generate the random number. Also this fixes the compilation warning (genRange and next are deprecated in random-1.2).
This commit is contained in:
15
tests/GridSelect.hs
Normal file
15
tests/GridSelect.hs
Normal file
@@ -0,0 +1,15 @@
|
||||
module GridSelect where
|
||||
|
||||
import Test.Hspec
|
||||
import Test.Hspec.QuickCheck
|
||||
|
||||
import XMonad.Actions.GridSelect
|
||||
|
||||
spec :: Spec
|
||||
spec = do
|
||||
prop "prop_stringToRatio_valuesInRange" prop_stringToRatio_valuesInRange
|
||||
|
||||
prop_stringToRatio_valuesInRange :: String -> Bool
|
||||
prop_stringToRatio_valuesInRange s =
|
||||
let r = stringToRatio s
|
||||
in r >= 0 && r <= 1
|
Reference in New Issue
Block a user