wip: switching from ncurses to brick
This commit is contained in:
+17
-7
@@ -22,7 +22,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
module HandlersSpec (spec) where
|
||||
|
||||
import Test.Hspec (Spec, context, describe, it, shouldBe)
|
||||
import qualified UI.NCurses as C
|
||||
|
||||
import Brick.Types (BrickEvent (VtyEvent))
|
||||
import Graphics.Vty.Input.Events (Event (EvKey, EvResize), Key (KChar))
|
||||
|
||||
import Mtlstats.Handlers
|
||||
|
||||
@@ -37,10 +39,18 @@ ynHandlerSpec = describe "ynHandler" $ mapM_
|
||||
it ("should be " ++ show expected) $
|
||||
ynHandler event `shouldBe` expected)
|
||||
-- description, event, expected
|
||||
[ ( "Y pressed", C.EventCharacter 'Y', Just True )
|
||||
, ( "y pressed", C.EventCharacter 'y', Just True )
|
||||
, ( "N pressed", C.EventCharacter 'N', Just False )
|
||||
, ( "n pressed", C.EventCharacter 'n', Just False )
|
||||
, ( "x pressed", C.EventCharacter 'x', Nothing )
|
||||
, ( "other event", C.EventResized, Nothing )
|
||||
[ ( "Y pressed", capitalY, Just True )
|
||||
, ( "y pressed", lowerY, Just True )
|
||||
, ( "N pressed", capitalN, Just False )
|
||||
, ( "n pressed", lowerN, Just False )
|
||||
, ( "x pressed", lowerX, Nothing )
|
||||
, ( "other event", otherEvent, Nothing )
|
||||
]
|
||||
where
|
||||
capitalY = chE 'Y'
|
||||
lowerY = chE 'y'
|
||||
capitalN = chE 'N'
|
||||
lowerN = chE 'n'
|
||||
lowerX = chE 'x'
|
||||
otherEvent = VtyEvent $ EvResize 0 0
|
||||
chE c = VtyEvent $ EvKey (KChar c) []
|
||||
|
||||
Reference in New Issue
Block a user