diff options
author | Don Stewart <dons@cse.unsw.edu.au> | 2007-06-26 06:09:07 +0200 |
---|---|---|
committer | Don Stewart <dons@cse.unsw.edu.au> | 2007-06-26 06:09:07 +0200 |
commit | 8bd90a4871d8d37cf6ddfbcb6a6c029fabe4052b (patch) | |
tree | 65edaf0b87a563bc1d944e7ccdce822737e7b554 | |
parent | f28115bb92086d8842896ba48b5ff7a36356c0de (diff) | |
download | metatile-8bd90a4871d8d37cf6ddfbcb6a6c029fabe4052b.tar metatile-8bd90a4871d8d37cf6ddfbcb6a6c029fabe4052b.zip |
add 2 properties to state where focus goes on delete of focused window
darcs-hash:20070626040907-9c5c1-397ec2ac01fda2e3f307605bf0f765bbc5724350
-rw-r--r-- | tests/Properties.hs | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/Properties.hs b/tests/Properties.hs index 638f7ec..c96dcc0 100644 --- a/tests/Properties.hs +++ b/tests/Properties.hs @@ -376,7 +376,7 @@ prop_delete_insert (x :: T) = y = swapMaster x -- delete should be local -prop_delete_local (x :: T) = +prop_delete_local (x :: T) = case peek x of Nothing -> True Just i -> hidden_spaces x == hidden_spaces (delete i x) @@ -384,6 +384,27 @@ prop_delete_local (x :: T) = -- delete should not affect focus unless the focused element is what is being deleted prop_delete_focus n (x :: T) = member n x && Just n /= peek x ==> peek (delete n x) == peek x +-- focus movement in the presence of delete: +-- when the last window in the stack set is focused, focus moves `up'. +-- usual case is that it moves 'down'. +prop_delete_focus_end (x :: T) = + length (index x) > 1 + ==> + peek (delete n y) == peek (focusUp y) + where + n = last (index x) + y = focusWindow n x -- focus last window in stack + +-- focus movement in the presence of delete: +-- when not in the last item in the stack, focus moves down +prop_delete_focus_not_end (x :: T) = + length (index x) > 1 && + n /= last (index x) + ==> + peek (delete n x) == peek (focusDown x) + where + Just n = peek x + -- --------------------------------------------------------------------- -- swapUp, swapDown, swapMaster: reordiring windows @@ -528,6 +549,8 @@ main = do ,("delete is reversible", mytest prop_delete_insert) ,("delete is local" , mytest prop_delete_local) ,("delete/focus" , mytest prop_delete_focus) + ,("delete last/focus up", mytest prop_delete_focus_end) + ,("delete ~last/focus down", mytest prop_delete_focus_not_end) ,("swapMaster: invariant", mytest prop_swap_master_I) ,("swapUp: invariant" , mytest prop_swap_left_I) |