~jaro/balkon

0620e1ad3e28d9a5be169930acbc31ba8841fc91 — Jaro 1 year, 9 months ago 7ca58a1
Test effect of paragraph prefix.
A .golden/devanagariAccentParagraph/golden => .golden/devanagariAccentParagraph/golden +6 -0
@@ 0,0 1,6 @@
ParagraphLayout {paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 645, y_size = -1000}, spanLayouts = [
    SpanLayout [Fragment {fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 645, y_size = -1000}, fragmentPen = (0,-500), fragmentGlyphs =
        [(GlyphInfo {codepoint = 529, cluster = 0, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False},GlyphPos {x_advance = 645, y_advance = 0, x_offset = 0, y_offset = 0}),
        (GlyphInfo {codepoint = 424, cluster = 0, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False},GlyphPos {x_advance = 0, y_advance = 0, x_offset = 0, y_offset = 0})]
    }]
]}

A .golden/devanagariPrefixedAccentParagraph/golden => .golden/devanagariPrefixedAccentParagraph/golden +5 -0
@@ 0,0 1,5 @@
ParagraphLayout {paragraphRect = Rect {x_origin = 0, y_origin = 0, x_size = 0, y_size = -1000}, spanLayouts = [
    SpanLayout [Fragment {fragmentRect = Rect {x_origin = 0, y_origin = 0, x_size = 0, y_size = -1000}, fragmentPen = (0,-500), fragmentGlyphs =
        [(GlyphInfo {codepoint = 424, cluster = 1, unsafeToBreak = False, unsafeToConcat = False, safeToInsertTatweel = False},GlyphPos {x_advance = 0, y_advance = 0, x_offset = 0, y_offset = 0})]
    }]
]}

M test/Data/Text/ParagraphLayout/ParagraphData.hs => test/Data/Text/ParagraphLayout/ParagraphData.hs +8 -0
@@ 1,7 1,9 @@
module Data.Text.ParagraphLayout.ParagraphData
    (arabicFillerParagraph
    ,czechHelloParagraph
    ,devanagariAccentParagraph
    ,devanagariParagraph
    ,devanagariPrefixedAccentParagraph
    ,emptyParagraph
    ,emptySpanParagraph
    ,ligatureParagraph


@@ 83,3 85,9 @@ mixedLanguageLTRParagraph = "Tak " |< cs "jsem tady, " >|< ja "世界!" >| "zzzz
-- | Source: <https://faultlore.com/blah/text-hates-you/>
devanagariParagraph :: ParagraphOptions -> Paragraph
devanagariParagraph = "xxxxxxxx" |< zxx "पन्ह पन्ह त्र र्च कृकृ ड्ड न्हृे" >| "zzzzzzzz"

devanagariAccentParagraph :: ParagraphOptions -> Paragraph
devanagariAccentParagraph = "" |< zxx "\x954" >| ""

devanagariPrefixedAccentParagraph :: ParagraphOptions -> Paragraph
devanagariPrefixedAccentParagraph = "#" |< zxx "\x954" >| ""

M test/Data/Text/ParagraphLayoutSpec.hs => test/Data/Text/ParagraphLayoutSpec.hs +20 -0
@@ 103,6 103,26 @@ spec = do
                        { paragraphMaxWidth = 20000 }
                paragraphRect withoutSpans `shouldBe` paragraphRect withSpans
        describe "with Devanagari font" $ before loadSaralaRegular $ do
            describe "lone accent character" $ do
                let
                    result = \font -> layoutPlain $
                        devanagariAccentParagraph $
                        opts font
                it "inserts a dotted circle" $ \font -> do
                    x_size (paragraphRect (result font)) `shouldBe` 645
                it "is golden" $ \font -> do
                    result font `shouldBeGolden`
                        "devanagariAccentParagraph"
            describe "lone accent character after prefix" $ do
                let
                    result = \font -> layoutPlain $
                        devanagariPrefixedAccentParagraph $
                        opts font
                it "does not insert a dotted circle" $ \font -> do
                    x_size (paragraphRect (result font)) `shouldBe` 0
                it "is golden" $ \font -> do
                    result font `shouldBeGolden`
                        "devanagariPrefixedAccentParagraph"
            it "handles input without wrapping" $ \font -> do
                let
                    result = layoutPlain $ devanagariParagraph $