@@ -1,6 +1,6 @@
11{-# LANGUAGE DisambiguateRecordFields #-}
22{-# LANGUAGE NamedFieldPuns #-}
3−module VerifySpanOps where
3+module VerifySimpleSpanGeneration where
44
55import Verify.Graphics.Vty.DisplayRegion
66import Verify.Graphics.Vty.Image
@@ -149,69 +149,6 @@ single_attr_single_span_stack_op_coverage stack =
149149 ops = display_ops_for_pic p (region_for_window w)
150150 in verify_all_spans_have_width (stack_image stack) ops (stack_width stack)
151151
152−crop_op_display_ops :: (Int -> Image -> Image) ->
153− Int -> Image -> (DisplayOps, Image)
154−crop_op_display_ops crop_op v i =
155− let i_out = crop_op v i
156− p = pic_for_image i_out
157− w = MockWindow (image_width i_out) (image_height i_out)
158− in (display_ops_for_pic p (region_for_window w), i_out)
159−
160−width_crop_output_columns :: (Int -> Image -> Image) ->
161− SingleAttrSingleSpanStack ->
162− NonNegative Int ->
163− Property
164−width_crop_output_columns crop_op s (NonNegative w) = stack_width s > w ==>
165− let (ops, i_out) = crop_op_display_ops crop_op w (stack_image s)
166− in verify_all_spans_have_width i_out ops w
167−
168−height_crop_output_columns :: (Int -> Image -> Image) ->
169− SingleAttrSingleSpanStack ->
170− NonNegative Int ->
171− Property
172−height_crop_output_columns crop_op s (NonNegative h) = stack_height s > h ==>
173− let (ops, _) = crop_op_display_ops crop_op h (stack_image s)
174− in display_ops_rows ops == h
175−
176−crop_right_output_columns :: SingleAttrSingleSpanStack -> NonNegative Int -> Property
177−crop_right_output_columns = width_crop_output_columns crop_right
178−
179−crop_left_output_columns :: SingleAttrSingleSpanStack -> NonNegative Int -> Property
180−crop_left_output_columns = width_crop_output_columns crop_left
181−
182−crop_top_output_rows :: SingleAttrSingleSpanStack -> NonNegative Int -> Property
183−crop_top_output_rows = height_crop_output_columns crop_top
184−
185−crop_bottom_output_rows :: SingleAttrSingleSpanStack -> NonNegative Int -> Property
186−crop_bottom_output_rows = height_crop_output_columns crop_bottom
187−
188−-- TODO: known benign failure.
189−crop_right_and_left_rejoined_equivalence :: SingleAttrSingleSpanStack -> Property
190−crop_right_and_left_rejoined_equivalence stack = image_width (stack_image stack) `mod` 2 == 0 ==>
191− let i = stack_image stack
192− -- the right part is made by cropping the image from the left.
193− i_r = crop_left (image_width i `div` 2) i
194− -- the left part is made by cropping the image from the right
195− i_l = crop_right (image_width i `div` 2) i
196− i_alt = i_l <|> i_r
197− i_ops = display_ops_for_image i
198− i_alt_ops = display_ops_for_image i_alt
199− in if i_ops == i_alt_ops
200− then succeeded
201− else failed { reason = "ops for alternate image " ++ show i_alt_ops
202− ++ " are not the same as " ++ show i_ops
203− }
204−
205−crop_top_and_bottom_rejoined_equivalence :: SingleAttrSingleSpanStack -> Property
206−crop_top_and_bottom_rejoined_equivalence stack = image_height (stack_image stack) `mod` 2 == 0 ==>
207− let i = stack_image stack
208− -- the top part is made by cropping the image from the bottom.
209− i_t = crop_bottom (image_height i `div` 2) i
210− -- the bottom part is made by cropping the image from the top.
211− i_b = crop_top (image_height i `div` 2) i
212− i_alt = i_t <-> i_b
213− in display_ops_for_image i == display_ops_for_image i_alt
214−
215152image_coverage_matches_bounds :: Image -> Result
216153image_coverage_matches_bounds i =
217154 let p = pic_for_image i
@@ -229,9 +166,6 @@ tests = return
229166 , verify "horiz span image is not cropped when window size == size of image [height]" horiz_span_image_and_equal_window_1
230167 , verify "horiz span image is not cropped when window size < size of image [width]" horiz_span_image_and_lesser_window_0
231168 , verify "horiz span image is not cropped when window size > size of image [width]" horiz_span_image_and_greater_window_0
232− , verify "arbitrary image is padded or cropped" arb_image_is_cropped
233− , verify "The span ops actually define content for all the rows in the output region" span_ops_actually_fill_rows
234− , verify "The span ops actually define content for all the columns in the output region" span_ops_actually_fill_columns
235169 , verify "first span op is always to set the text attribute" first_span_op_sets_attr
236170 , verify "a stack of single attr text spans should define content for all the columns [output region == size of stack]"
237171 single_attr_single_span_stack_op_coverage
@@ -247,19 +181,6 @@ tests = return
247181 single_attr_single_span_stack_cropped_4
248182 , verify "single attr text span <-> single attr text span display cropped. [height]"
249183 single_attr_single_span_stack_cropped_5
250− , verify "cropping from the bottom produces display operations covering the expected rows"
251− crop_bottom_output_rows
252− , verify "cropping from the top produces display operations covering the expected rows"
253− crop_top_output_rows
254− , verify "cropping from the left produces display operations covering the expected columns"
255− crop_left_output_columns
256− , verify "cropping from the right produces display operations covering the expected columns"
257− crop_right_output_columns
258− -- TODO: known benign failure.
259− -- , verify "the output of a stack is the same as that stack cropped left & right and joined together"
260− -- crop_right_and_left_rejoined_equivalence
261− , verify "the output of a stack is the same as that stack cropped top & bottom and joined together"
262− crop_top_and_bottom_rejoined_equivalence
263184 , verify "an arbitrary image when rendered to a window of the same size will cover the entire window"
264185 image_coverage_matches_bounds
265186 ]