Skip to content

Commit

Permalink
bump vty
Browse files Browse the repository at this point in the history
  • Loading branch information
locallycompact committed Feb 8, 2024
1 parent f5be884 commit 5313e5f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions hydra-tui/test/Hydra/TUISpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ import Graphics.Vty (
defaultConfig,
displayContext,
initialAssumedState,
outputFd,
outputForConfig,
outputPicture,
shutdownInput,
termName,
)
import Graphics.Vty.Image (DisplayRegion)
import Hydra.Cardano.Api (Key (getVerificationKey), Lovelace)
Expand All @@ -47,6 +44,9 @@ import Hydra.TUI.Options (Options (..))
import HydraNode (HydraClient (HydraClient, hydraNodeId), HydraNodeLog, withHydraNode)
import System.FilePath ((</>))
import System.Posix (OpenMode (WriteOnly), closeFd, defaultFileFlags, openFd)
import Graphics.Vty.Platform.Unix.Output (buildOutput)
import Graphics.Vty.Platform.Unix.Settings (defaultSettings)
import Graphics.Vty.Platform.Unix.Input (buildInput)

tuiContestationPeriod :: ContestationPeriod
tuiContestationPeriod = UnsafeContestationPeriod 10
Expand Down Expand Up @@ -238,15 +238,15 @@ withTUITest region action = do
findBytes bytes = BS.concat $ BS.drop 1 . BS.dropWhile (/= 109) <$> BS.split 27 bytes

buildVty q frameBuffer = do
input <- inputForConfig defaultConfig
input <- buildInput defaultConfig =<< defaultSettings
-- NOTE(SN): This is used by outputPicture and we hack it such that it
-- always has the initial state to get a full rendering of the picture. That
-- way we can capture output bytes line-by-line and drop the cursor moving.
as <- newIORef initialAssumedState
-- NOTE(SN): The null device should allow using this in CI, while we do
-- capture the output via `outputByteBuffer` anyway.
nullFd <- openFd "/dev/null" WriteOnly defaultFileFlags
realOut <- outputForConfig $ defaultConfig{outputFd = Just nullFd, termName = Just "xterm"}
realOut <- buildOutput =<< defaultSettings
closeFd nullFd
let output = testOut realOut as frameBuffer
pure $
Expand Down

0 comments on commit 5313e5f

Please sign in to comment.