diff options
| author | Akshay Nair <phenax5@gmail.com> | 2024-12-28 22:14:05 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2024-12-28 22:14:05 +0530 |
| commit | 1bd86a46dcf21a75656edd181f97035739fa238d (patch) | |
| tree | 3f6e1aafa95351cd3e5d8a3d77bf90630d57e852 /specs/Specs/ViewSpec.hs | |
| parent | 9b5c8368daa97a5b58a378d9c4eab66ebb018cb0 (diff) | |
| download | chelleport-1bd86a46dcf21a75656edd181f97035739fa238d.tar.gz chelleport-1bd86a46dcf21a75656edd181f97035739fa238d.zip | |
Refactor text styles
Diffstat (limited to '')
| -rw-r--r-- | specs/Specs/ViewSpec.hs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/specs/Specs/ViewSpec.hs b/specs/Specs/ViewSpec.hs index a5a67c9..9d7dfda 100644 --- a/specs/Specs/ViewSpec.hs +++ b/specs/Specs/ViewSpec.hs @@ -19,10 +19,10 @@ test = do (_, mock) <- runWithMocks $ do Mock_windowSize `mockReturns` mockWindowSize render currentState - mock `shouldHaveCalled` Mock_drawText (460, 10) colorWhite FontLG "ABC" - mock `shouldHaveCalled` Mock_drawText (1420, 10) colorWhite FontLG "DEF" - mock `shouldHaveCalled` Mock_drawText (460, 550) colorWhite FontLG "DJK" - mock `shouldHaveCalled` Mock_drawText (1420, 550) colorWhite FontLG "JKL" + 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" context "when there is a partial match" $ do let currentState = defaultState {stateMode = ModeHints (modeHintsData $ stateMode defaultState) {stateKeySequence = "D"}} @@ -30,13 +30,13 @@ test = do it "draws matching text labels" $ do (_, mock) <- runWithMocks $ do Mock_windowSize `mockReturns` mockWindowSize - Mock_drawText (1420, 10) colorLightGray FontLG "D" `mockReturns` (10, 0) - Mock_drawText (460, 550) colorLightGray FontLG "D" `mockReturns` (10, 0) + Mock_drawText (1420, 10) (hintLabelTextStyle {textColor = colorLightGray}) "D" `mockReturns` (10, 0) + Mock_drawText (460, 550) (hintLabelTextStyle {textColor = colorLightGray}) "D" `mockReturns` (10, 0) render currentState - mock `shouldHaveCalled` Mock_drawText (1420, 10) colorLightGray FontLG "D" - mock `shouldHaveCalled` Mock_drawText (1430, 10) colorAccent FontLG "EF" - mock `shouldHaveCalled` Mock_drawText (460, 550) colorLightGray FontLG "D" - mock `shouldHaveCalled` Mock_drawText (470, 550) colorAccent FontLG "JK" + 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" context "when key sequence is complete match" $ do let currentState = defaultState {stateMode = ModeHints (modeHintsData $ stateMode defaultState) {stateKeySequence = "DEF"}} @@ -45,17 +45,17 @@ test = do (_, mock) <- runWithMocks $ do Mock_windowSize `mockReturns` mockWindowSize render currentState - mock `shouldHaveCalled` Mock_drawText (1420, 10) colorLightGray FontLG "DEF" + mock `shouldHaveCalled` Mock_drawText (1420, 10) (hintLabelTextStyle {textColor = colorLightGray}) "DEF" describe "#renderKeySequence" $ do context "when there is a partial match" $ do it "draws the matched section and highlights the remaining characters" $ do (_, mock) <- runWithMocks $ do Mock_windowSize `mockReturns` mockWindowSize - Mock_drawText (0, 0) colorLightGray FontLG "ABC" `mockReturns` (30, 0) + Mock_drawText (0, 0) (hintLabelTextStyle {textColor = colorLightGray}) "ABC" `mockReturns` (30, 0) renderKeySequence "ABC" "ABCDE" (0, 0) - mock `shouldHaveCalled` Mock_drawText (0, 0) colorLightGray FontLG "ABC" - mock `shouldHaveCalled` Mock_drawText (30, 0) colorAccent FontLG "DE" + mock `shouldHaveCalled` Mock_drawText (0, 0) (hintLabelTextStyle {textColor = colorLightGray}) "ABC" + mock `shouldHaveCalled` Mock_drawText (30, 0) (hintLabelTextStyle {textColor = colorAccent}) "DE" it "return true as the text is visible" $ do (isVisible, _) <- runWithMocks $ renderKeySequence "ABC" "ABCDE" (0, 0) @@ -64,7 +64,7 @@ test = do context "when there is no input key sequence" $ do it "draws text as a single chunk" $ do (_, mock) <- runWithMocks $ renderKeySequence "" "ABCD" (0, 0) - mock `shouldHaveCalled` Mock_drawText (0, 0) colorWhite FontLG "ABCD" + mock `shouldHaveCalled` Mock_drawText (0, 0) (hintLabelTextStyle {textColor = colorWhite}) "ABCD" it "return true as the text is visible" $ do (isVisible, _) <- runWithMocks $ renderKeySequence "" "ABCD" (0, 0) |
