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
|
|
|
|
|
2013-06-01 17:47:29 +04:00
|
|
|
is_horiz_text_of_columns :: Image -> Int -> Bool
|
2009-12-29 02:32:18 +03:00
|
|
|
is_horiz_text_of_columns (HorizText { output_width = in_w }) expected_w = in_w == expected_w
|
|
|
|
is_horiz_text_of_columns (BGFill { output_width = in_w }) expected_w = in_w == expected_w
|
2009-09-04 21:29:28 +04:00
|
|
|
is_horiz_text_of_columns _image _expected_w = False
|
|
|
|
|
|
|
|
verify_horiz_contat_wo_attr_change_simplifies :: SingleRowSingleAttrImage -> Bool
|
|
|
|
verify_horiz_contat_wo_attr_change_simplifies (SingleRowSingleAttrImage _attr char_count image) =
|
|
|
|
is_horiz_text_of_columns image char_count
|
|
|
|
|
2009-12-29 02:32:18 +03:00
|
|
|
verify_horiz_contat_w_attr_change_simplifies :: SingleRowTwoAttrImage -> Bool
|
2011-07-04 00:31:23 +04:00
|
|
|
verify_horiz_contat_w_attr_change_simplifies ( SingleRowTwoAttrImage (SingleRowSingleAttrImage attr0 char_count0 _image0)
|
|
|
|
(SingleRowSingleAttrImage attr1 char_count1 _image1)
|
2009-12-29 02:32:18 +03:00
|
|
|
i
|
|
|
|
)
|
2009-09-04 21:29:28 +04:00
|
|
|
| char_count0 == 0 || char_count1 == 0 || attr0 == attr1 = is_horiz_text_of_columns i (char_count0 + char_count1)
|
|
|
|
| otherwise = False == is_horiz_text_of_columns i (char_count0 + char_count1)
|
|
|
|
|
2012-10-10 07:58:00 +04:00
|
|
|
tests :: IO [Test]
|
|
|
|
tests = return
|
|
|
|
[ verify "verify_horiz_contat_wo_attr_change_simplifies" verify_horiz_contat_wo_attr_change_simplifies
|
|
|
|
, verify "verify_horiz_contat_w_attr_change_simplifies" verify_horiz_contat_w_attr_change_simplifies
|
|
|
|
]
|
|
|
|
|