aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Properties/View.hs
diff options
context:
space:
mode:
authorAdam Vogt <vogt.adam@gmail.com>2014-05-02 20:01:46 +0200
committerAdam Vogt <vogt.adam@gmail.com>2014-05-02 20:01:46 +0200
commit9660a7a64c749e181d2114cc4b66a8aa4f88be0f (patch)
tree1664b0ed1ee20f66cf3b7f550c33d49c897bed8c /tests/Properties/View.hs
parentb682eaf8fcbb548dacb35b4103e546cbd9fca3ed (diff)
downloadxmonad-9660a7a64c749e181d2114cc4b66a8aa4f88be0f.tar.gz
xmonad-9660a7a64c749e181d2114cc4b66a8aa4f88be0f.tar.xz
xmonad-9660a7a64c749e181d2114cc4b66a8aa4f88be0f.zip
update testsuite (mostly due Jesper Reenberg)
Ignore-this: a5e926aa4e397e70d56e3c9db7108d5b * use quickcheck2 * run them using cabal's test-suite field * split up Properties into separate files darcs-hash:20140502180146-1499c-dc8c09c3ec76a42a0e146925adce960435dc81db.gz
Diffstat (limited to 'tests/Properties/View.hs')
-rw-r--r--tests/Properties/View.hs47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/Properties/View.hs b/tests/Properties/View.hs
new file mode 100644
index 0000000..ef9b58d
--- /dev/null
+++ b/tests/Properties/View.hs
@@ -0,0 +1,47 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+module Properties.View where
+
+import Test.QuickCheck
+import Instances
+import Utils
+
+import XMonad.StackSet hiding (filter)
+
+import Data.List (sortBy)
+
+-- ---------------------------------------------------------------------
+-- viewing workspaces
+
+-- view sets the current workspace to 'n'
+prop_view_current (x :: T) = do
+ n <- arbitraryTag x
+ return $ (tag . workspace . current . view n) x == n
+
+-- view *only* sets the current workspace, and touches Xinerama.
+-- no workspace contents will be changed.
+prop_view_local (x :: T) = do
+ n <- arbitraryTag x
+ return $ workspaces x == workspaces (view n x)
+ where
+ workspaces a = sortBy (\s t -> tag s `compare` tag t) $
+ workspace (current a)
+ : map workspace (visible a) ++ hidden a
+
+-- TODO: Fix this
+-- view should result in a visible xinerama screen
+-- prop_view_xinerama (x :: T) (n :: NonNegative Int) = i `tagMember` x ==>
+-- M.member i (screens (view i x))
+-- where
+-- i = fromIntegral n
+
+-- view is idempotent
+prop_view_idem (x :: T) = do
+ n <- arbitraryTag x
+ return $ view n (view n x) == (view n x)
+
+-- view is reversible, though shuffles the order of hidden/visible
+prop_view_reversible (x :: T) = do
+ n <- arbitraryTag x
+ return $ normal (view n' (view n x)) == normal x
+ where
+ n' = currentTag x