~jaro/balkon

ref: 0bee8136697d2c892cbb567c2780cfa35cb8d01b balkon/test/Data/Text/ParagraphLayout/RichSpec.hs -rw-r--r-- 833 bytes
0bee8136Jaro Test Rich layout. 1 year, 15 days 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
module Data.Text.ParagraphLayout.RichSpec (spec) where

import Test.Hspec
import System.FilePath ((</>))
import Data.Text.ParagraphLayout.FontLoader
import Data.Text.ParagraphLayout.PrettyShow.Golden
import Data.Text.ParagraphLayout.Rich
import Data.Text.ParagraphLayout.Rich.ParagraphData

spec :: Spec
spec = do

    describe "layoutRich" $ do
        let
            goldenDir = ".golden" </> "richParagraphLayout"
            shouldBeGolden = goldenTest goldenDir id id

        describe "with Latin font" $ do
            font <- runIO $ loadFont latinFont 0 testingOptions

            it "handles nested boxes" $ do
                let opts = defaultParagraphOptions
                let input = nestedBoxesParagraph font opts
                let result = layoutRich input
                result `shouldBeGolden` "nestedBoxes"