mirror of
https://github.com/jtdaugherty/brick.git
synced 2024-11-26 09:06:56 +03:00
Upgrade Vty and expected Show formatting of Picture in Render.hs
This commit is contained in:
parent
62baeb66dd
commit
0a3a8f8012
@ -112,7 +112,7 @@ library
|
|||||||
Brick.Widgets.Internal
|
Brick.Widgets.Internal
|
||||||
|
|
||||||
build-depends: base >= 4.9.0.0 && < 4.17.0.0,
|
build-depends: base >= 4.9.0.0 && < 4.17.0.0,
|
||||||
vty >= 5.33,
|
vty >= 5.36,
|
||||||
transformers,
|
transformers,
|
||||||
data-clist >= 0.1,
|
data-clist >= 0.1,
|
||||||
directory >= 1.2.5.0,
|
directory >= 1.2.5.0,
|
||||||
|
@ -5,6 +5,7 @@ module Render
|
|||||||
where
|
where
|
||||||
|
|
||||||
import Brick
|
import Brick
|
||||||
|
import Control.Monad (when)
|
||||||
import qualified Graphics.Vty as V
|
import qualified Graphics.Vty as V
|
||||||
import Brick.Widgets.Border (hBorder)
|
import Brick.Widgets.Border (hBorder)
|
||||||
import Control.Exception (try)
|
import Control.Exception (try)
|
||||||
@ -25,7 +26,7 @@ myWidget = str "Why" <=> hBorder <=> str "not?"
|
|||||||
-- Since you can't Read a Picture, we have to compare the result with
|
-- Since you can't Read a Picture, we have to compare the result with
|
||||||
-- the Shown one
|
-- the Shown one
|
||||||
expectedResult :: String
|
expectedResult :: String
|
||||||
expectedResult = "Picture ?? [VertJoin {partTop = VertJoin {partTop = HorizText {attr = Attr {attrStyle = Default, attrForeColor = Default, attrBackColor = Default, attrURL = Default}, displayText = \"Why \", outputWidth = 30, charWidth = 30}, partBottom = VertJoin {partTop = HorizText {attr = Attr {attrStyle = Default, attrForeColor = Default, attrBackColor = Default, attrURL = Default}, displayText = \"\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\", outputWidth = 30, charWidth = 30}, partBottom = HorizText {attr = Attr {attrStyle = Default, attrForeColor = Default, attrBackColor = Default, attrURL = Default}, displayText = \"not? \", outputWidth = 30, charWidth = 30}, outputWidth = 30, outputHeight = 2}, outputWidth = 30, outputHeight = 3}, partBottom = BGFill {outputWidth = 30, outputHeight = 7}, outputWidth = 30, outputHeight = 10}] ??"
|
expectedResult = "Picture {picCursor = NoCursor, picLayers = [VertJoin {partTop = VertJoin {partTop = HorizText {attr = Attr {attrStyle = Default, attrForeColor = Default, attrBackColor = Default, attrURL = Default}, displayText = \"Why \", outputWidth = 30, charWidth = 30}, partBottom = VertJoin {partTop = HorizText {attr = Attr {attrStyle = Default, attrForeColor = Default, attrBackColor = Default, attrURL = Default}, displayText = \"\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\\9472\", outputWidth = 30, charWidth = 30}, partBottom = HorizText {attr = Attr {attrStyle = Default, attrForeColor = Default, attrBackColor = Default, attrURL = Default}, displayText = \"not? \", outputWidth = 30, charWidth = 30}, outputWidth = 30, outputHeight = 2}, outputWidth = 30, outputHeight = 3}, partBottom = BGFill {outputWidth = 30, outputHeight = 7}, outputWidth = 30, outputHeight = 10}], picBackground = Background {backgroundChar = ' ', backgroundAttr = Attr {attrStyle = Default, attrForeColor = Default, attrBackColor = Default, attrURL = Default}}}"
|
||||||
|
|
||||||
main :: IO Bool
|
main :: IO Bool
|
||||||
main = do
|
main = do
|
||||||
@ -46,4 +47,12 @@ main = do
|
|||||||
|
|
||||||
putStrLn ""
|
putStrLn ""
|
||||||
putStrLn $ "renderWidget test outcome: " <> msg
|
putStrLn $ "renderWidget test outcome: " <> msg
|
||||||
|
|
||||||
|
when (not matched) $ do
|
||||||
|
putStrLn "Expected result:"
|
||||||
|
putStrLn expectedResult
|
||||||
|
|
||||||
|
putStrLn "Actual result:"
|
||||||
|
putStrLn actualResult
|
||||||
|
|
||||||
return matched
|
return matched
|
||||||
|
Loading…
Reference in New Issue
Block a user