~jaro/balkon

ref: c9c57b600e59c89dc1f4831c5df03c8cf4725056 balkon/test/Data/Text/ParagraphLayout/RectSpec.hs -rw-r--r-- 939 bytes
c9c57b60Jaro Test line splitting with many runs. 1 year, 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module Data.Text.ParagraphLayout.RectSpec (spec) where

import Data.Int (Int32)

import Test.Hspec
import Data.Text.ParagraphLayout.Rect

positiveRect :: Rect Int32
positiveRect = Rect 50 60 10 10

negativeRect :: Rect Int32
negativeRect = Rect 80 90 (-15) (-15)

spec :: Spec
spec = do
    describe "union of two rects" $ do
        let r = union positiveRect negativeRect
        it "has origin at 50,60" $
            (x_origin r, y_origin r) `shouldBe` (50, 60)
        it "has minimum coordinates at at 50,60" $
            (x_min r, y_min r) `shouldBe` (50, 60)
        it "has terminus at 80,90" $
            (x_terminus r, y_terminus r) `shouldBe` (80, 90)
        it "has maximum coordinates at 80,90" $
            (x_max r, y_max r) `shouldBe` (80, 90)
        it "has size 30,30" $
            (x_size r, y_size r) `shouldBe` (30, 30)
        it "has absolute size 30,30" $
            (width r, height r) `shouldBe` (30, 30)