diff options
| author | Akshay Nair <phenax5@gmail.com> | 2024-12-29 21:13:50 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2024-12-29 21:23:04 +0530 |
| commit | 2f35bbd272d7b1414003bf437cc6ad675fe81400 (patch) | |
| tree | bb24c7588ae17a01c541e5f61b793b9599d9098b /specs/Specs | |
| parent | fc2a09facce2fe6d06769712ea992f99bf15c8e2 (diff) | |
| download | chelleport-2f35bbd272d7b1414003bf437cc6ad675fe81400.tar.gz chelleport-2f35bbd272d7b1414003bf437cc6ad675fe81400.zip | |
Change font to roboto mono + hint position changes
Diffstat (limited to 'specs/Specs')
| -rw-r--r-- | specs/Specs/ViewSpec.hs | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/specs/Specs/ViewSpec.hs b/specs/Specs/ViewSpec.hs index 9d7dfda..13d4a9f 100644 --- a/specs/Specs/ViewSpec.hs +++ b/specs/Specs/ViewSpec.hs @@ -12,6 +12,11 @@ test = do let defaultState = def {stateGridRows = 2, stateGridCols = 2, stateMode = ModeHints def {stateGrid = [["ABC", "DEF"], ["DJK", "JKL"]]}} describe "#render" $ do + let drawTextCalls mock = + filter + (\(CallWrapper c) -> case c of Mock_drawText {} -> True; _ -> False) + $ calls mock + context "when key sequence is empty" $ do let currentState = defaultState {stateMode = ModeHints (modeHintsData $ stateMode defaultState) {stateKeySequence = ""}} @@ -19,10 +24,11 @@ test = do (_, mock) <- runWithMocks $ do Mock_windowSize `mockReturns` mockWindowSize render currentState - mock `shouldHaveCalled` Mock_drawText (460, 10) (hintLabelTextStyle {textColor = colorWhite}) "ABC" - mock `shouldHaveCalled` Mock_drawText (1420, 10) (hintLabelTextStyle {textColor = colorWhite}) "DEF" - mock `shouldHaveCalled` Mock_drawText (460, 550) (hintLabelTextStyle {textColor = colorWhite}) "DJK" - mock `shouldHaveCalled` Mock_drawText (1420, 550) (hintLabelTextStyle {textColor = colorWhite}) "JKL" + mock `shouldHaveCalled` Mock_drawText (464, 20) (hintLabelTextStyle {textColor = colorWhite}) "ABC" + mock `shouldHaveCalled` Mock_drawText (1424, 20) (hintLabelTextStyle {textColor = colorWhite}) "DEF" + mock `shouldHaveCalled` Mock_drawText (464, 560) (hintLabelTextStyle {textColor = colorWhite}) "DJK" + mock `shouldHaveCalled` Mock_drawText (1424, 560) (hintLabelTextStyle {textColor = colorWhite}) "JKL" + length (drawTextCalls mock) `shouldBe` 4 context "when there is a partial match" $ do let currentState = defaultState {stateMode = ModeHints (modeHintsData $ stateMode defaultState) {stateKeySequence = "D"}} @@ -30,13 +36,14 @@ test = do it "draws matching text labels" $ do (_, mock) <- runWithMocks $ do Mock_windowSize `mockReturns` mockWindowSize - Mock_drawText (1420, 10) (hintLabelTextStyle {textColor = colorLightGray}) "D" `mockReturns` (10, 0) - Mock_drawText (460, 550) (hintLabelTextStyle {textColor = colorLightGray}) "D" `mockReturns` (10, 0) + Mock_drawText (1424, 20) (hintLabelTextStyle {textColor = colorLightGray}) "D" `mockReturns` (10, 0) + Mock_drawText (464, 560) (hintLabelTextStyle {textColor = colorLightGray}) "D" `mockReturns` (10, 0) render currentState - mock `shouldHaveCalled` Mock_drawText (1420, 10) (hintLabelTextStyle {textColor = colorLightGray}) "D" - mock `shouldHaveCalled` Mock_drawText (1430, 10) (hintLabelTextStyle {textColor = colorAccent}) "EF" - mock `shouldHaveCalled` Mock_drawText (460, 550) (hintLabelTextStyle {textColor = colorLightGray}) "D" - mock `shouldHaveCalled` Mock_drawText (470, 550) (hintLabelTextStyle {textColor = colorAccent}) "JK" + mock `shouldHaveCalled` Mock_drawText (1424, 20) (hintLabelTextStyle {textColor = colorLightGray}) "D" + mock `shouldHaveCalled` Mock_drawText (1434, 20) (hintLabelTextStyle {textColor = colorAccent}) "EF" + mock `shouldHaveCalled` Mock_drawText (464, 560) (hintLabelTextStyle {textColor = colorLightGray}) "D" + mock `shouldHaveCalled` Mock_drawText (474, 560) (hintLabelTextStyle {textColor = colorAccent}) "JK" + length (drawTextCalls mock) `shouldBe` 4 context "when key sequence is complete match" $ do let currentState = defaultState {stateMode = ModeHints (modeHintsData $ stateMode defaultState) {stateKeySequence = "DEF"}} @@ -45,7 +52,8 @@ test = do (_, mock) <- runWithMocks $ do Mock_windowSize `mockReturns` mockWindowSize render currentState - mock `shouldHaveCalled` Mock_drawText (1420, 10) (hintLabelTextStyle {textColor = colorLightGray}) "DEF" + mock `shouldHaveCalled` Mock_drawText (1424, 20) (hintLabelTextStyle {textColor = colorLightGray}) "DEF" + length (drawTextCalls mock) `shouldBe` 1 describe "#renderKeySequence" $ do context "when there is a partial match" $ do |
