From 07b55a3860ee3d685303213a96c9b7bad0fec7ad Mon Sep 17 00:00:00 2001 From: Jaro Date: Mon, 22 May 2023 07:52:06 +0200 Subject: [PATCH] Add expected run lengths to test data. --- test/Data/Text/ParagraphLayout/Internal/RunSpec.hs | 4 ++-- test/Data/Text/ParagraphLayout/TextData.hs | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/test/Data/Text/ParagraphLayout/Internal/RunSpec.hs b/test/Data/Text/ParagraphLayout/Internal/RunSpec.hs index 6305767..98d5511 100644 --- a/test/Data/Text/ParagraphLayout/Internal/RunSpec.hs +++ b/test/Data/Text/ParagraphLayout/Internal/RunSpec.hs @@ -15,8 +15,8 @@ import Data.Text.ParagraphLayout.TextData defaultBox :: Direction -> ResolvedBox () defaultBox dir = ResolvedBox () 0 defaultBoxOptions dir -sampleSpan :: (Direction, String, Text) -> ResolvedSpan () -sampleSpan (dir, lang, text) = ResolvedSpan +sampleSpan :: (Direction, String, Text, a) -> ResolvedSpan () +sampleSpan (dir, lang, text, _) = ResolvedSpan { spanUserData = () , spanIndex = 0 , spanOffsetInParagraph = 0 diff --git a/test/Data/Text/ParagraphLayout/TextData.hs b/test/Data/Text/ParagraphLayout/TextData.hs index 6bff6cc..793bcf5 100644 --- a/test/Data/Text/ParagraphLayout/TextData.hs +++ b/test/Data/Text/ParagraphLayout/TextData.hs @@ -14,13 +14,15 @@ import Data.Text (Text, empty, pack) import Data.Text.Glyphize (Direction (DirLTR, DirRTL)) type Language = String -type Sample = (Direction, Language, Text) +type DirectionRunLengths = [Int] +type Sample = (Direction, Language, Text, DirectionRunLengths) arabicEmpty :: Sample arabicEmpty = ( DirRTL , "ar" , empty + , [] ) englishEmpty :: Sample @@ -28,6 +30,7 @@ englishEmpty = ( DirLTR , "en" , empty + , [] ) englishWord :: Sample @@ -35,6 +38,7 @@ englishWord = ( DirRTL , "en" , pack "word" + , [4] ) arabicHello :: Sample @@ -42,6 +46,7 @@ arabicHello = ( DirRTL , "ar" , pack "سلام" + , [4] ) czechHello :: Sample @@ -49,6 +54,7 @@ czechHello = ( DirLTR , "cs" , pack "Ahoj, světe!" + , [12] ) serbianMixedScript :: Sample @@ -56,6 +62,7 @@ serbianMixedScript = ( DirLTR , "sr" , pack "Vikipedija (Википедија)" + , [23] ) -- | Source: @@ -65,6 +72,8 @@ arabicAroundEnglish = ( DirRTL , "ar" , pack "في XHTML 1.0 يتم تحقيق ذلك بإضافة العنصر المضمن bdo." + -- TODO: Should be [3, 9, 36, 3, 1] according to Unicode BiDi. + , [3, 10, 35, 4] ) -- | Source: @@ -74,4 +83,6 @@ englishAroundArabic = ( DirLTR , "en" , pack "The title is مفتاح معايير الويب in Arabic." + -- TODO: Should be [13, 18, 11] according to Unicode BiDi. + , [13, 19, 10] ) -- 2.30.2