diff options
| author | Akshay Nair <phenax5@gmail.com> | 2024-12-21 13:19:48 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2024-12-21 13:19:56 +0530 |
| commit | a2a8e8dd046678816c3797cb894b20abfe84e360 (patch) | |
| tree | 0b40288086b055b0a13f3a5621b836eca1d7b2c5 /specs/Specs | |
| parent | d8667213fa49242701db4bf592754ab87749efa5 (diff) | |
| download | chelleport-a2a8e8dd046678816c3797cb894b20abfe84e360.tar.gz chelleport-a2a8e8dd046678816c3797cb894b20abfe84e360.zip | |
Fix issue with pointer coordinates + Add mouse press/release actions
Diffstat (limited to 'specs/Specs')
| -rw-r--r-- | specs/Specs/AppStateUpdateSpec.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/specs/Specs/AppStateUpdateSpec.hs b/specs/Specs/AppStateUpdateSpec.hs index 3f8ca47..fd79c95 100644 --- a/specs/Specs/AppStateUpdateSpec.hs +++ b/specs/Specs/AppStateUpdateSpec.hs @@ -2,7 +2,7 @@ module Specs.AppStateUpdateSpec where import Chelleport (initialState, update) import Chelleport.Types -import Chelleport.Utils (uniq) +import Chelleport.Utils (intToCInt, uniq) import Control.Monad (join) import Mock import qualified SDL @@ -90,6 +90,8 @@ test = do context "with action MoveMousePosition" $ do let currentState = defaultState + let rows = intToCInt $ length $ stateGrid currentState + let columns = intToCInt $ length $ head $ stateGrid currentState -- TODO: Test with inline mocked values it "moves mouse pointer to center of cell of given coordinates" $ do @@ -98,7 +100,10 @@ test = do -- [ CallPressMouseButton LeftClick `returns` (1, 2), -- CallHideWindow `returns` () -- ] - mock `shouldHaveCalled` CallMoveMousePosition 25 25 + mock + `shouldHaveCalled` CallMoveMousePosition + (mockWindowOffsetX + mockWindowWidth `div` columns `div` 2) + (mockWindowOffsetY + mockWindowHeight `div` rows `div` 2) it "does not continue or update state" $ do (result, _) <- runWithMocks $ update currentState $ MoveMousePosition (0, 0) |
