2009-09-04 21:29:28 +04:00
|
|
|
{-# LANGUAGE NamedFieldPuns #-}
|
2012-10-10 07:58:00 +04:00
|
|
|
module VerifyImageTrans where
|
2009-09-04 21:29:28 +04:00
|
|
|
|
|
|
|
import Verify.Graphics.Vty.Image
|
|
|
|
|
2013-06-01 17:47:29 +04:00
|
|
|
import Graphics.Vty.Image.Internal
|
|
|
|
|
2009-09-04 21:29:28 +04:00
|
|
|
import Verify
|
|
|
|
|
|
|
|
import Data.Word
|
|
|
|
|
2014-04-12 04:51:13 +04:00
|
|
|
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
|
2009-12-29 02:32:18 +03:00
|
|
|
)
|
2014-04-12 04:51:13 +04:00
|
|
|
| charCount0 == 0 || charCount1 == 0 || attr0 == attr1 = isHorizTextOfColumns i (charCount0 + charCount1)
|
|
|
|
| otherwise = False == isHorizTextOfColumns i (charCount0 + charCount1)
|
2009-09-04 21:29:28 +04:00
|
|
|
|
2012-10-10 07:58:00 +04:00
|
|
|
tests :: IO [Test]
|
|
|
|
tests = return
|
2014-04-12 04:51:13 +04:00
|
|
|
[ verify "verifyHorizContatWoAttrChangeSimplifies" verifyHorizContatWoAttrChangeSimplifies
|
|
|
|
, verify "verifyHorizContatWAttrChangeSimplifies" verifyHorizContatWAttrChangeSimplifies
|
2012-10-10 07:58:00 +04:00
|
|
|
]
|
|
|
|
|