vty/test/VerifyImageTrans.hs

35 lines
1.4 KiB
Haskell
Raw Normal View History

{-# LANGUAGE NamedFieldPuns #-}
2012-10-10 07:58:00 +04:00
module VerifyImageTrans where
import Verify.Graphics.Vty.Image
import Graphics.Vty.Image.Internal
import Verify
import Data.Word
isHorizTextOfColumns :: Image -> Int -> Bool
isHorizTextOfColumns (HorizText { outputWidth = inW }) expectedW = inW == expectedW
isHorizTextOfColumns (BGFill { outputWidth = inW }) expectedW = inW == expectedW
isHorizTextOfColumns _image _expectedW = False
verifyHorizContatWoAttrChangeSimplifies :: SingleRowSingleAttrImage -> Bool
verifyHorizContatWoAttrChangeSimplifies (SingleRowSingleAttrImage _attr charCount image) =
isHorizTextOfColumns image charCount
verifyHorizContatWAttrChangeSimplifies :: SingleRowTwoAttrImage -> Bool
verifyHorizContatWAttrChangeSimplifies ( SingleRowTwoAttrImage (SingleRowSingleAttrImage attr0 charCount0 _image0)
(SingleRowSingleAttrImage attr1 charCount1 _image1)
i
)
| charCount0 == 0 || charCount1 == 0 || attr0 == attr1 = isHorizTextOfColumns i (charCount0 + charCount1)
| otherwise = False == isHorizTextOfColumns i (charCount0 + charCount1)
2012-10-10 07:58:00 +04:00
tests :: IO [Test]
tests = return
[ verify "verifyHorizContatWoAttrChangeSimplifies" verifyHorizContatWoAttrChangeSimplifies
, verify "verifyHorizContatWAttrChangeSimplifies" verifyHorizContatWAttrChangeSimplifies
2012-10-10 07:58:00 +04:00
]