aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Properties/Floating.hs
blob: a9afad7cbd138bc17dae79ded5fef6b643f72ced (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{-# LANGUAGE ScopedTypeVariables #-}
module Properties.Floating where

import Test.QuickCheck
import Instances

import XMonad.StackSet hiding (filter)

import qualified Data.Map as M

------------------------------------------------------------------------
-- properties for the floating layer:

prop_float_reversible (nex :: NonEmptyWindowsStackSet) = do
  let NonEmptyWindowsStackSet x = nex
  w <- arbitraryWindow nex
  return $ sink w (float w geom x) == x
        where
            geom = RationalRect 100 100 100 100

prop_float_geometry (nex :: NonEmptyWindowsStackSet) = do
    let NonEmptyWindowsStackSet x = nex
    w <- arbitraryWindow nex
    let s = float w geom x
    return $ M.lookup w (floating s) == Just geom
  where
    geom = RationalRect 100 100 100 100

prop_float_delete (nex :: NonEmptyWindowsStackSet) = do
    let NonEmptyWindowsStackSet x = nex
    w <- arbitraryWindow nex
    let s = float w geom x
        t = delete w s
    return $ not (w `member` t)
  where
    geom = RationalRect 100 100 100 100