@@ -10,7 +10,6 @@ module Testable.Element exposing
1010 , below
1111 , centerX
1212 , centerY
13− , clip
1413 , column
1514 , el
1615 , expectRoundedEquality
@@ -20,14 +19,8 @@ module Testable.Element exposing
2019 , inFront
2120 , isVisible
2221 , label
23− , layout
24− , link
2522 , maximum
2623 , minimum
27− , moveDown
28− , moveLeft
29− , moveRight
30− , moveUp
3124 , none
3225 , onLeft
3326 , onRight
@@ -35,17 +28,11 @@ module Testable.Element exposing
3528 , paddingXY
3629 , paragraph
3730 , px
38− , rgb
39− , rgba
4031 , row
41− , scrollbarX
42− , scrollbarY
43− , scrollbars
4432 , shrink
4533 , spacing
4634 , text
4735 , textColumn
48− , toProgram
4936 , transparent
5037 , width
5138 )
@@ -64,21 +51,9 @@ In order to run the test:
6451
6552import Dict
6653import Element
54+import Expect
6755import Html.Attributes
6856import Testable
69−import Testable.Runner
70−
71−
72−{-| This is used when we want to run all tests in a test suite instead of one at a time.
73−-}
74−toProgram : Testable.Runner.Testable -> Testable.Runner.TestableProgram
75−toProgram testable =
76− Testable.Runner.program [ testable ]
77−
78−
79−layout : List (Testable.Attr msg) -> Testable.Element Testable.Runner.Msg -> Testable.Runner.Testable
80−layout attrs elem =
81− Testable.Runner.testable "Test" elem
8257
8358
8459text : String -> Testable.Element msg
@@ -87,18 +62,18 @@ text =
8762
8863
8964el : List (Testable.Attr msg) -> Testable.Element msg -> Testable.Element msg
90−el attrs =
91− Testable.El (implicitWidthHeightShrink attrs)
65+el =
66+ Testable.El
9267
9368
9469row : List (Testable.Attr msg) -> List (Testable.Element msg) -> Testable.Element msg
95−row attrs =
96− Testable.Row (implicitWidthHeightShrink attrs)
70+row =
71+ Testable.Row
9772
9873
9974column : List (Testable.Attr msg) -> List (Testable.Element msg) -> Testable.Element msg
100−column attrs =
101− Testable.Column (implicitWidthHeightShrink attrs)
75+column =
76+ Testable.Column
10277
10378
10479none : Testable.Element msg
@@ -107,82 +82,13 @@ none =
10782
10883
10984paragraph : List (Testable.Attr msg) -> List (Testable.Element msg) -> Testable.Element msg
110−paragraph attrs =
111− let
112− withImplicits =
113− implicitTest (widthHelper Nothing Nothing (Fill 1))
114− :: implicitTest (heightHelper Nothing Nothing Shrink)
115− :: attrs
116− in
117− Testable.Paragraph (skipOverridden withImplicits)
85+paragraph =
86+ Testable.Paragraph
11887
11988
12089textColumn : List (Testable.Attr msg) -> List (Testable.Element msg) -> Testable.Element msg
121−textColumn attrs =
122− let
123− withImplicits =
124− implicitTest (widthHelper (Just 500) (Just 750) (Fill 1))
125− :: implicitTest (heightHelper Nothing Nothing Shrink)
126− :: attrs
127− in
128− Testable.TextColumn (skipOverridden withImplicits)
129−
130−
131−link :
132− List (Testable.Attr msg)
133− ->
134− { url : String
135− , label : Testable.Element msg
136− }
137− -> Testable.Element msg
138−link attrs details =
139− Testable.Link details.url
140− (implicitWidthHeightShrink attrs)
141− details.label
142−
143−
144−clip =
145− Testable.Attr Element.clip
146−
147−
148−{-| -}
149−scrollbars : Testable.Attr msg
150−scrollbars =
151− Testable.Attr Element.scrollbars
152−
153−
154−{-| -}
155−scrollbarY : Testable.Attr msg
156−scrollbarY =
157− Testable.Attr Element.scrollbarY
158−
159−
160−{-| -}
161−scrollbarX : Testable.Attr msg
162−scrollbarX =
163− Testable.Attr Element.scrollbarX
164−
165−
166−{-| Old labeling mechanism that i removed to hastily
167−-}
168−label str =
169− Testable.Batch []
170−
171−
172−moveUp x =
173− Testable.Attr (Element.moveUp x)
174−
175−
176−moveDown x =
177− Testable.Attr (Element.moveDown x)
178−
179−
180−moveRight x =
181− Testable.Attr (Element.moveRight x)
182−
183−
184−moveLeft x =
185− Testable.Attr (Element.moveLeft x)
90+textColumn =
91+ Testable.TextColumn
18692
18793
18894type Length
@@ -201,14 +107,6 @@ maximum =
201107 Maximum
202108
203109
204−rgb =
205− Element.rgb
206−
207−
208−rgba =
209− Element.rgba
210−
211−
212110px : Int -> Length
213111px =
214112 Px
@@ -229,6 +127,11 @@ fillPortion =
229127 Fill
230128
231129
130+label : String -> Testable.Attr msg
131+label =
132+ Testable.Label
133+
134+
232135transparent : Bool -> Testable.Attr msg
233136transparent on =
234137 Testable.LabeledTest
@@ -239,9 +142,8 @@ transparent on =
239142 else
240143 "opaque"
241144 , attr = Element.transparent on
242− , id = Testable.NoId
243145 , test =
244− \context ->
146+ \context _ ->
245147 let
246148 selfTransparency =
247149 context.self.style
@@ -255,19 +157,19 @@ transparent on =
255157 else
256158 "1"
257159 in
258− [ Testable.equal value selfTransparency ]
160+ Expect.equal value selfTransparency
259161 }
260162
261163
262164{-| -}
263165isVisible : Testable.Attr msg
264166isVisible =
265− Testable.AttrTest
167+ Testable.LabeledTest
266168 { label = "is-visible"
267− , id = Testable.NoId
169+ , attr = Element.htmlAttribute (Html.Attributes.style "not" "applicable")
268170 , test =
269− \context ->
270− [ Testable.equal context.self.isVisible True ]
171+ \context _ ->
172+ Expect.equal context.self.isVisible True
271173 }
272174
273175
@@ -277,16 +179,15 @@ alpha a =
277179 Testable.LabeledTest
278180 { label = "alpha-" ++ String.fromFloat a
279181 , attr = Element.alpha a
280− , id = Testable.NoId
281182 , test =
282− \context ->
183+ \context _ ->
283184 let
284185 selfTransparency =
285186 context.self.style
286187 |> Dict.get "opacity"
287188 |> Maybe.withDefault "notfound"
288189 in
289− [ Testable.equal (String.fromFloat a) selfTransparency ]
190+ Expect.equal (String.fromFloat a) selfTransparency
290191 }
291192
292193
@@ -296,10 +197,9 @@ padding pad =
296197 Testable.LabeledTest
297198 { label = "padding " ++ String.fromInt pad
298199 , attr = Element.padding pad
299− , id = Testable.NoId
300200 , test =
301− \found ->
302− [ Testable.true ("Padding " ++ String.fromInt pad ++ " is present")
201+ \found _ ->
202+ Expect.true ("Padding " ++ String.fromInt pad ++ " is present")
303203 (List.all ((==) pad)
304204 [ floor found.self.bbox.padding.left
305205 , floor found.self.bbox.padding.right
@@ -307,7 +207,6 @@ padding pad =
307207 , floor found.self.bbox.padding.bottom
308208 ]
309209 )
310− ]
311210 }
312211
313212
@@ -317,10 +216,9 @@ paddingXY x y =
317216 Testable.LabeledTest
318217 { label = "paddingXY " ++ String.fromInt x ++ ", " ++ String.fromInt y
319218 , attr = Element.paddingXY x y
320− , id = Testable.NoId
321219 , test =
322− \found ->
323− [ Testable.true ("PaddingXY (" ++ String.fromInt x ++ ", " ++ String.fromInt y ++ ") is present")
220+ \found _ ->
221+ Expect.true ("PaddingXY (" ++ String.fromInt x ++ ", " ++ String.fromInt y ++ ") is present")
324222 (List.all ((==) x)
325223 [ floor found.self.bbox.padding.left
326224 , floor found.self.bbox.padding.right
@@ -330,15 +228,9 @@ paddingXY x y =
330228 , floor found.self.bbox.padding.bottom
331229 ]
332230 )
333− ]
334231 }
335232
336233
337−listIf ls =
338− List.filter Tuple.first ls
339− |> List.map Tuple.second
340−
341−
342234widthHelper maybeMin maybeMax len =
343235 let
344236 addMin l =
@@ -398,7 +290,6 @@ widthHelper maybeMin maybeMax len =
398290 -- Pixel values should ignore min and max?
399291 Testable.LabeledTest
400292 { label = "width " ++ String.fromInt val ++ "px" ++ minLabel ++ maxLabel
401− , id = Testable.IsWidth
402293 , attr =
403294 Element.width
404295 (Element.px val
@@ -406,24 +297,18 @@ widthHelper maybeMin maybeMax len =
406297 |> addMax
407298 )
408299 , test =
409− \found ->
410− [ expectRoundedEquality
411− { expected = toFloat val
412− , found = found.self.bbox.width
413− }
414− , Testable.true "min/max is upheld" (minMaxTest (floor found.self.bbox.width))
415− ]
300+ \found _ ->
301+ Expect.all
302+ [ \_ ->
303+ Expect.true "exact width is exact" (floor found.self.bbox.width == val)
304+ , \_ -> Expect.true "min/max is upheld" (minMaxTest (floor found.self.bbox.width))
305+ ]
306+ ()
416307 }
417308
418309 Fill portion ->
419310 Testable.LabeledTest
420− { label =
421− if portion == 1 then
422− "width fill" ++ minLabel ++ maxLabel
423−
424− else
425− "width fill-" ++ String.fromInt portion ++ minLabel ++ maxLabel
426− , id = Testable.IsWidth
311+ { label = "width fill-" ++ String.fromInt portion ++ minLabel ++ maxLabel
427312 , attr =
428313 Element.width
429314 (Element.fillPortion portion
@@ -431,102 +316,41 @@ widthHelper maybeMin maybeMax len =
431316 |> addMax
432317 )
433318 , test =
434− \context ->
435− if List.member context.parentLayout [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
436− [ Testable.true "width fill doesn't apply to onright/onleft elements" True ]
319+ \context _ ->
320+ if List.member context.location [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
321+ Expect.true "width fill doesn't apply to onright/onleft elements" True
437322
438323 else
439324 let
440325 parentAvailableWidth =
441326 context.parent.bbox.width - (context.self.bbox.padding.left + context.self.bbox.padding.right)
442327 in
443− List.concat
444− [ case context.parentLayout of
445− Testable.IsNearby _ ->
446− [ Testable.true "Nearby Element has fill width"
447− ((floor context.parent.bbox.width == floor context.self.bbox.width)
448− || minMaxTest (floor context.self.bbox.width)
449− )
450− ]
451−
452− Testable.InColumn ->
453− [ Testable.true "Element within column has fill width"
454− ((floor parentAvailableWidth == floor context.self.bbox.width)
455− || minMaxTest (floor context.self.bbox.width)
456− )
457− ]
458−
459− Testable.InEl ->
460− [ Testable.true "Element within element has fill width" <|
461− (floor parentAvailableWidth == floor context.self.bbox.width)
462− || minMaxTest (floor context.self.bbox.width)
463− ]
464−
465− _ ->
466− let
467− spacePerPortion =
468− parentAvailableWidth / toFloat (List.length context.siblings + 1)
469− in
470− [ Testable.true "element has fill width" <|
471− (floor spacePerPortion == floor context.self.bbox.width)
472− || minMaxTest (floor context.self.bbox.width)
473− ]
474− , [ Testable.lessThanOrEqual "not larger than parent"
475− context.self.bbox.width
476− context.parent.bbox.width
477− ]
478− , case context.selfElement of
479− Testable.Paragraph _ _ ->
480− -- A paragraph with width fill
481− -- we want to test for correct text wrapping here.
482− --
483− let
484− childWidth child =
485− child.bbox.width
486−
487− totalChildren =
488− context.children
489− |> List.map childWidth
490− |> List.append (List.map .width context.self.textMetrics)
491− |> List.sum
492−
493− horizontalPadding =
494− context.self.bbox.padding.left + context.self.bbox.padding.right
495−
496− totalCalculatedWidth =
497− totalChildren + horizontalPadding
498−
499− expectedLines =
500− if boxChildrenHeight > 20 then
501− ceiling (boxChildrenHeight / 20)
502−
503− else
504− ceiling (totalCalculatedWidth / context.self.bbox.width)
505−
506− boxChildrenHeight =
507− context.children
508− |> List.map
509− (\c ->
510− c.bbox.height
511− )
512− |> List.sum
513− in
514− [ Testable.true "text wrapping, checking height"
515− -- all we're doing here is testing if wrapping is occurring
516− -- not the exact height, which is a little tricky to calculate perfectly without more information.
517− (if expectedLines > 1 then
518− context.self.bbox.height >= (20 * 2)
519−
520− else
521− -- then it's less than 2 ~ line heights
522− -- there's some weird variance here which makes it hard to be exact.
523− context.self.bbox.height < (20 * 2)
524− )
525− ]
526−
527− _ ->
528− []
529− ]
328+ case context.location of
329+ Testable.IsNearby _ ->
330+ Expect.true "Nearby Element has fill width"
331+ ((floor context.parent.bbox.width == floor context.self.bbox.width)
332+ || minMaxTest (floor context.self.bbox.width)
333+ )
334+
335+ Testable.InColumn ->
336+ Expect.true "Element within column has fill width"
337+ ((floor parentAvailableWidth == floor context.self.bbox.width)
338+ || minMaxTest (floor context.self.bbox.width)
339+ )
340+
341+ Testable.InEl ->
342+ Expect.true "Element within element has fill width" <|
343+ (floor parentAvailableWidth == floor context.self.bbox.width)
344+ || minMaxTest (floor context.self.bbox.width)
345+
346+ _ ->
347+ let
348+ spacePerPortion =
349+ parentAvailableWidth / toFloat (List.length context.siblings + 1)
350+ in
351+ Expect.true "element has fill width" <|
352+ (floor spacePerPortion == floor context.self.bbox.width)
353+ || minMaxTest (floor context.self.bbox.width)
530354 }
531355
532356 Shrink ->
@@ -538,211 +362,33 @@ widthHelper maybeMin maybeMax len =
538362 |> addMin
539363 |> addMax
540364 )
541− , id = Testable.IsWidth
542365 , test =
543− \context ->
544− case context.selfElement of
545− Testable.El _ _ ->
546− let
547− childWidth child =
548− child.bbox.width
549−
550− totalChildren =
551− context.children
552− |> List.map childWidth
553− |> List.append (List.map .width context.self.textMetrics)
554− |> List.sum
555−
556− horizontalPadding =
557− context.self.bbox.padding.left + context.self.bbox.padding.right
558− in
559− listIf
560− [ ( (context.parentLayout /= Testable.InParagraph)
561− && (context.parentLayout /= Testable.InTextCol)
562− , Testable.rounded "equals children"
563− { expected = totalChildren + horizontalPadding
564− , found = context.self.bbox.width
565− }
566− )
567− , ( context.parentLayout /= Testable.AtRoot
568− , Testable.lessThanOrEqual "not larger than parent"
569− context.self.bbox.width
570− context.parent.bbox.width
571− )
572− ]
573−
574− Testable.Link _ _ _ ->
575− let
576− childWidth child =
577− child.bbox.width
578−
579− totalChildren =
580− context.children
581− |> List.map childWidth
582− |> List.append (List.map .width context.self.textMetrics)
583− |> List.sum
584−
585− horizontalPadding =
586− context.self.bbox.padding.left + context.self.bbox.padding.right
587− in
588− listIf
589− [ ( (context.parentLayout /= Testable.InParagraph)
590− && (context.parentLayout /= Testable.InTextCol)
591− , Testable.rounded "equals children"
592− { expected = totalChildren + horizontalPadding
593− , found = context.self.bbox.width
594− }
595− )
596− , ( context.parentLayout /= Testable.AtRoot
597− , Testable.lessThanOrEqual "not larger than parent"
598− context.self.bbox.width
599− context.parent.bbox.width
600− )
601− ]
602−
603− Testable.Row rowAttrs _ ->
604− -- width of row is the sum of all children widths
605− -- both text elements and others.
606− let
607− childWidth child =
608− child.bbox.width
609−
610− totalChildren =
611− context.children
612− |> List.map childWidth
613− |> List.append (List.map .width context.self.textMetrics)
614− |> List.sum
615−
616− horizontalPadding =
617− context.self.bbox.padding.left + context.self.bbox.padding.right
618−
619− spacingAmount =
620− Testable.getSpacingFromAttributes rowAttrs
621−
622− totalSpacing =
623− toFloat spacingAmount * (toFloat (List.length context.children) - 1)
624− in
625− listIf
626− [ ( True
627− , expectRoundedEquality
628− { expected = totalChildren + horizontalPadding + totalSpacing
629− , found = context.self.bbox.width
630− }
631− )
632− , ( context.parentLayout /= Testable.AtRoot
633− , Testable.lessThanOrEqual "not larger than parent"
634− context.self.bbox.width
635− context.parent.bbox.width
636− )
637− ]
366+ \context _ ->
367+ let
368+ childWidth child =
369+ -- TODO: add margin values to widths
370+ child.bbox.width
371+
372+ totalChildren =
373+ context.children
374+ |> List.map childWidth
375+ |> List.sum
376+
377+ horizontalPadding =
378+ context.self.bbox.padding.left + context.self.bbox.padding.right
379+
380+ spacingValue =
381+ toFloat context.parentSpacing * (toFloat (List.length context.children) - 1)
382+ in
383+ if totalChildren == 0 then
384+ -- TODO: The issue is that we have a hard time measuring `text` elements
385+ -- So if a element has a text child, then it's width isn't going to show up in the system.
386+ expectRoundedEquality context.self.bbox.width context.self.bbox.width
638387
639− Testable.Column _ _ ->
640− -- The width of the column is the width of the widest child.
641− let
642− childWidth child =
643− child.bbox.width
644− + context.self.bbox.padding.left
645− + context.self.bbox.padding.right
646−
647− textChildren =
648− List.map
649− (\txt ->
650− txt.width
651− + context.self.bbox.padding.left
652− + context.self.bbox.padding.right
653− )
654− context.self.textMetrics
655−
656− allChildren =
657− context.children
658− |> List.map childWidth
659− |> List.append textChildren
660− in
661− listIf
662− [ ( True
663− , expectRoundedEquality
664− { expected = Maybe.withDefault 0 (List.maximum allChildren)
665− , found = context.self.bbox.width
666− }
667− )
668− , ( context.parentLayout /= Testable.AtRoot
669− , Testable.lessThanOrEqual "not larger than parent"
670− context.self.bbox.width
671− context.parent.bbox.width
672− )
673− ]
674−
675− Testable.TextColumn _ _ ->
676− -- The width of the column is the width of the widest child.
677− let
678− childWidth child =
679− child.bbox.width
680− + context.self.bbox.padding.left
681− + context.self.bbox.padding.right
682−
683− textChildren =
684− List.map
685− (\txt ->
686− txt.width
687− + context.self.bbox.padding.left
688− + context.self.bbox.padding.right
689− )
690− context.self.textMetrics
691−
692− allChildren =
693− context.children
694− |> List.map childWidth
695− |> List.append textChildren
696− in
697− listIf
698− [ ( True
699− , expectRoundedEquality
700− { expected = Maybe.withDefault 0 (List.maximum allChildren)
701− , found = context.self.bbox.width
702− }
703− )
704− , ( context.parentLayout /= Testable.AtRoot
705− , Testable.lessThanOrEqual "not larger than parent"
706− context.self.bbox.width
707− context.parent.bbox.width
708− )
709− ]
710−
711− Testable.Paragraph _ _ ->
712− -- This should be the size it's text,
713− -- unless it takes up all available space, in which case it should wrap.
714− let
715− childWidth child =
716− child.bbox.width
717−
718− totalChildren =
719− context.children
720− |> List.map childWidth
721− |> List.append (List.map .width context.self.textMetrics)
722− |> List.sum
723−
724− horizontalPadding =
725− context.self.bbox.padding.left + context.self.bbox.padding.right
726− in
727− listIf
728− [ ( True
729− , expectRoundedEquality
730− { expected = totalChildren + horizontalPadding
731− , found = context.self.bbox.width
732− }
733− )
734− , ( context.parentLayout /= Testable.AtRoot
735− , Testable.lessThanOrEqual "not larger than parent"
736− context.self.bbox.width
737− context.parent.bbox.width
738− )
739− ]
740−
741− Testable.Text _ ->
742− []
743−
744− Testable.Empty ->
745− []
388+ else
389+ -- This fails if this element is actually a column
390+ -- So we need to capture what this element is in order to do this calculation.
391+ expectRoundedEquality (totalChildren + horizontalPadding + spacingValue) context.self.bbox.width
746392 }
747393
748394
@@ -811,16 +457,17 @@ heightHelper maybeMin maybeMax len =
811457 |> addMin
812458 |> addMax
813459 )
814− , id = Testable.IsHeight
815460 , test =
816− \found ->
817− [ expectRoundedEquality
818− { expected = toFloat val
819− , found = found.self.bbox.height
820− }
821− , Testable.true "min/max holds true"
822− (minMaxTest (floor found.self.bbox.height))
823− ]
461+ \found _ ->
462+ Expect.all
463+ [ \_ ->
464+ Expect.true ("exact height is exact: " ++ String.fromInt (floor found.self.bbox.height) ++ "," ++ String.fromInt val)
465+ (floor found.self.bbox.height == val)
466+ , \_ ->
467+ Expect.true "min/max holds true"
468+ (minMaxTest (floor found.self.bbox.height))
469+ ]
470+ ()
824471 }
825472
826473 Fill portion ->
@@ -832,32 +479,31 @@ heightHelper maybeMin maybeMax len =
832479 |> addMin
833480 |> addMax
834481 )
835− , id = Testable.IsHeight
836482 , test =
837− \context ->
838− [ if List.member context.parentLayout [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
839− Testable.true "height fill doesn't apply to above/below elements" True
483+ \context _ ->
484+ if List.member context.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
485+ Expect.true "height fill doesn't apply to above/below elements" True
840486
841− else
487+ else
842488 let
843489 parentAvailableHeight =
844490 context.parent.bbox.height - (context.self.bbox.padding.top + context.self.bbox.padding.bottom)
845491 in
846− case context.parentLayout of
492+ case context.location of
847493 Testable.IsNearby _ ->
848− Testable.true "Nearby Element has fill height"
494+ Expect.true "Nearby Element has fill height"
849495 ((floor context.parent.bbox.height == floor context.self.bbox.height)
850496 || minMaxTest (floor context.self.bbox.height)
851497 )
852498
853499 Testable.InColumn ->
854− Testable.true "Element within column has fill height"
500+ Expect.true "Element within column has fill height"
855501 ((floor parentAvailableHeight == floor context.self.bbox.height)
856502 || minMaxTest (floor context.self.bbox.height)
857503 )
858504
859505 Testable.InEl ->
860− Testable.true "Element within el has fill height" <|
506+ Expect.true "Element within el has fill height" <|
861507 (floor parentAvailableHeight == floor context.self.bbox.height)
862508 || minMaxTest (floor context.self.bbox.height)
863509
@@ -866,10 +512,9 @@ heightHelper maybeMin maybeMax len =
866512 spacePerPortion =
867513 parentAvailableHeight / toFloat (List.length context.siblings + 1)
868514 in
869− Testable.true "el has fill height" <|
515+ Expect.true "el has fill height" <|
870516 (floor spacePerPortion == floor context.self.bbox.height)
871517 || minMaxTest (floor context.self.bbox.height)
872− ]
873518 }
874519
875520 Shrink ->
@@ -881,134 +526,33 @@ heightHelper maybeMin maybeMax len =
881526 |> addMin
882527 |> addMax
883528 )
884− , id = Testable.IsHeight
885529 , test =
886− \context ->
887− case context.selfElement of
888− Testable.El _ _ ->
889− let
890− childHeight child =
891− child.bbox.height
892− in
893− if List.isEmpty context.children then
894− -- context.self.textMetrics
895− -- |> List.map Testable.textHeight
896− -- |> List.sum
897− -- TODO: apparently the font metrics we have are for the literal characters rendered
898− -- not for the font itself.
899− [ Testable.todo "calculate height from actual text metrics"
900− ]
901−
902− else
903− [ expectRoundedEquality
904− { expected =
905− context.children
906− |> List.map childHeight
907− |> List.sum
908− |> (\h -> h + context.self.bbox.padding.top + context.self.bbox.padding.bottom)
909− , found = context.self.bbox.height
910− }
911− , Testable.lessThanOrEqual "not larger than parent"
912− context.self.bbox.height
913− context.parent.bbox.height
914− ]
915−
916− Testable.Link _ _ _ ->
917− let
918− childHeight child =
919− child.bbox.height
920− in
921− if List.isEmpty context.children then
922− -- context.self.textMetrics
923− -- |> List.map Testable.textHeight
924− -- |> List.sum
925− -- TODO: apparently the font metrics we have are for the literal characters rendered
926− -- not for the font itself.
927− [ Testable.todo "calculate height from actual text metrics"
928− ]
530+ \context _ ->
531+ let
532+ childWidth child =
533+ -- TODO: add margin values to heights
534+ child.bbox.height
535+
536+ totalChildren =
537+ context.children
538+ |> List.map childWidth
539+ |> List.sum
540+
541+ verticalPadding =
542+ context.self.bbox.padding.top + context.self.bbox.padding.bottom
543+
544+ spacingValue =
545+ toFloat context.parentSpacing * (toFloat (List.length context.children) - 1)
546+ in
547+ if totalChildren == 0 then
548+ -- TODO: The issue is that we have a hard time measuring `text` elements
549+ -- So if a element has a text child, then it's height isn't going to show up in the system.
550+ expectRoundedEquality context.self.bbox.height context.self.bbox.height
929551
930− else
931− [ expectRoundedEquality
932− { expected =
933− context.children
934− |> List.map childHeight
935− |> List.sum
936− |> (\h -> h + context.self.bbox.padding.top + context.self.bbox.padding.bottom)
937− , found = context.self.bbox.height
938− }
939− , Testable.lessThanOrEqual "not larger than parent"
940− context.self.bbox.height
941− context.parent.bbox.height
942− ]
943−
944− Testable.Row _ _ ->
945− let
946− childHeight child =
947− child.bbox.height
948− in
949− if List.isEmpty context.children then
950− -- context.self.textMetrics
951− -- |> List.map Testable.textHeight
952− -- |> List.sum
953− -- TODO: apparently the font metrics we have are for the literal characters rendered
954− -- not for the font itself.
955− [ Testable.todo "calculate height from actual text metrics" ]
956−
957− else
958− [ expectRoundedEquality
959− { expected =
960− context.children
961− |> List.map childHeight
962− |> List.maximum
963− |> Maybe.withDefault 0
964− |> (\h -> h + context.self.bbox.padding.top + context.self.bbox.padding.bottom)
965− , found = context.self.bbox.height
966− }
967− , Testable.lessThanOrEqual "not larger than parent"
968− context.self.bbox.height
969− context.parent.bbox.height
970− ]
971−
972− Testable.Column colAttrs _ ->
973− let
974− childHeight child =
975− child.bbox.height
976−
977− totalChildren =
978− context.children
979− |> List.map childHeight
980− |> List.append (List.map Testable.textHeight context.self.textMetrics)
981− |> List.sum
982−
983− verticalPadding =
984− context.self.bbox.padding.top + context.self.bbox.padding.bottom
985−
986− spacingAmount =
987− Testable.getSpacingFromAttributes colAttrs
988−
989− totalSpacing =
990− toFloat spacingAmount * (toFloat (List.length context.children) - 1)
991− in
992− [ expectRoundedEquality
993− { expected = totalChildren + verticalPadding + totalSpacing
994− , found = context.self.bbox.height
995− }
996− , Testable.lessThanOrEqual "not larger than parent"
997− context.self.bbox.height
998− context.parent.bbox.height
999− ]
1000−
1001− Testable.TextColumn _ _ ->
1002− []
1003−
1004− Testable.Paragraph _ _ ->
1005− []
1006−
1007− Testable.Text _ ->
1008− []
1009−
1010− Testable.Empty ->
1011− []
552+ else
553+ -- This fails if this element is actually a column
554+ -- So we need to capture what this element is in order to do this calculation.
555+ expectRoundedEquality (totalChildren + verticalPadding + spacingValue) context.self.bbox.height
1012556 }
1013557
1014558
@@ -1029,9 +573,8 @@ spacing space =
1029573 , Testable.LabeledTest
1030574 { label = "spacing: " ++ String.fromInt space
1031575 , attr = Element.spacing space
1032− , id = Testable.NoId
1033576 , test =
1034− \found ->
577+ \found _ ->
1035578 let
1036579 findDistance child total =
1037580 List.concatMap
@@ -1077,7 +620,7 @@ spacing space =
1077620 []
1078621 distances
1079622 in
1080− [ Testable.true
623+ Expect.true
1081624 ("All children are at least "
1082625 ++ String.fromInt space
1083626 ++ " pixels apart."
@@ -1085,7 +628,6 @@ spacing space =
1085628 ++ " are not though"
1086629 )
1087630 (allAreSpaced == [])
1088− ]
1089631 }
1090632 ]
1091633
@@ -1108,33 +650,30 @@ alignLeft =
1108650 Testable.LabeledTest
1109651 { label = "alignLeft"
1110652 , attr = Element.alignLeft
1111− , id = Testable.NoId
1112653 , test =
1113− \found ->
1114− [ if List.member found.parentLayout [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
1115− Testable.true "alignLeft doesn't apply to elements that are onLeft or onRight" True
654+ \found _ ->
655+ if List.member found.location [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
656+ Expect.true "alignLeft doesn't apply to elements that are onLeft or onRight" True
1116657
1117− else if
1118− List.member found.parentLayout
658+ else if
659+ List.member found.location
1119660 [ Testable.IsNearby Testable.InFront
1120661 , Testable.IsNearby Testable.Behind
1121662 , Testable.IsNearby Testable.Above
1122663 , Testable.IsNearby Testable.Below
1123664 ]
1124− then
665+ then
1125666 expectRoundedEquality
1126− { found = found.self.bbox.left
1127− , expected = found.parent.bbox.left
1128− }
667+ found.self.bbox.left
668+ found.parent.bbox.left
1129669
1130− else if List.length found.siblings == 0 then
670+ else if List.length found.siblings == 0 then
1131671 expectRoundedEquality
1132− { found = found.self.bbox.left
1133− , expected = found.parent.bbox.left + found.parent.bbox.padding.left
1134− }
672+ found.self.bbox.left
673+ (found.parent.bbox.left + found.parent.bbox.padding.left)
1135674
1136− else
1137− case found.parentLayout of
675+ else
676+ case found.location of
1138677 Testable.InRow ->
1139678 let
1140679 siblingsOnLeft =
@@ -1149,16 +688,13 @@ alignLeft =
1149688 |> List.sum
1150689 in
1151690 expectRoundedEquality
1152− { found = found.self.bbox.left
1153− , expected = found.parent.bbox.left + (found.parent.bbox.padding.left + widthsOnLeft + spacings)
1154− }
691+ found.self.bbox.left
692+ (found.parent.bbox.left + (found.parent.bbox.padding.left + widthsOnLeft + spacings))
1155693
1156694 _ ->
1157695 expectRoundedEquality
1158− { found = found.self.bbox.left
1159− , expected = found.parent.bbox.left + found.parent.bbox.padding.left
1160− }
1161− ]
696+ found.self.bbox.left
697+ (found.parent.bbox.left + found.parent.bbox.padding.left)
1162698 }
1163699
1164700
@@ -1168,9 +704,8 @@ centerX =
1168704 Testable.LabeledTest
1169705 { label = "centerX"
1170706 , attr = Element.centerX
1171− , id = Testable.NoId
1172707 , test =
1173− \found ->
708+ \found _ ->
1174709 let
1175710 selfCenter : Float
1176711 selfCenter =
@@ -1180,18 +715,16 @@ centerX =
1180715 parentCenter =
1181716 found.parent.bbox.left + (found.parent.bbox.width / 2)
1182717 in
1183− if List.member found.parentLayout [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
1184− [ Testable.true "centerX doesn't apply to elements that are onLeft or onRight" True ]
718+ if List.member found.location [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
719+ Expect.true "centerX doesn't apply to elements that are onLeft or onRight" True
1185720
1186721 else if List.length found.siblings == 0 then
1187− [ expectRoundedEquality
1188− { found = selfCenter
1189− , expected = parentCenter
1190− }
1191− ]
722+ expectRoundedEquality
723+ selfCenter
724+ parentCenter
1192725
1193726 else
1194− case found.parentLayout of
727+ case found.location of
1195728 Testable.InRow ->
1196729 let
1197730 siblingsOnLeft =
@@ -1221,18 +754,12 @@ centerX =
1221754 / 2
1222755 )
1223756 in
1224− [ expectRoundedEquality
1225− { found = selfCenter
1226− , expected = expectedCenter
1227− }
1228− ]
757+ expectRoundedEquality
758+ selfCenter
759+ expectedCenter
1229760
1230761 _ ->
1231− [ expectRoundedEquality
1232− { found = selfCenter
1233− , expected = parentCenter
1234− }
1235− ]
762+ expectRoundedEquality selfCenter parentCenter
1236763 }
1237764
1238765
@@ -1242,35 +769,30 @@ alignRight =
1242769 Testable.LabeledTest
1243770 { label = "alignRight"
1244771 , attr = Element.alignRight
1245− , id = Testable.NoId
1246772 , test =
1247− \found ->
1248− if List.member found.parentLayout [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
1249− [ Testable.true "alignRight doesn't apply to elements that are onLeft or onRight" True ]
773+ \found _ ->
774+ if List.member found.location [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
775+ Expect.true "alignRight doesn't apply to elements that are onLeft or onRight" True
1250776
1251777 else if
1252− List.member found.parentLayout
778+ List.member found.location
1253779 [ Testable.IsNearby Testable.InFront
1254780 , Testable.IsNearby Testable.Behind
1255781 , Testable.IsNearby Testable.Above
1256782 , Testable.IsNearby Testable.Below
1257783 ]
1258784 then
1259− [ expectRoundedEquality
1260− { found = found.self.bbox.right
1261− , expected = found.parent.bbox.right
1262− }
1263− ]
785+ expectRoundedEquality
786+ found.self.bbox.right
787+ found.parent.bbox.right
1264788
1265789 else if List.length found.siblings == 0 then
1266− [ expectRoundedEquality
1267− { found = found.self.bbox.right
1268− , expected = found.parent.bbox.right + found.parent.bbox.padding.right
1269− }
1270− ]
790+ expectRoundedEquality
791+ found.self.bbox.right
792+ (found.parent.bbox.right + found.parent.bbox.padding.right)
1271793
1272794 else
1273− case found.parentLayout of
795+ case found.location of
1274796 Testable.InRow ->
1275797 let
1276798 siblingsOnRight =
@@ -1284,18 +806,14 @@ alignRight =
1284806 |> List.map (.width << .bbox)
1285807 |> List.sum
1286808 in
1287− [ expectRoundedEquality
1288− { found = found.self.bbox.right
1289− , expected = found.parent.bbox.right - (found.parent.bbox.padding.right + widthsOnRight + spacings)
1290− }
1291− ]
809+ expectRoundedEquality
810+ found.self.bbox.right
811+ (found.parent.bbox.right - (found.parent.bbox.padding.right + widthsOnRight + spacings))
1292812
1293813 _ ->
1294− [ expectRoundedEquality
1295− { found = found.self.bbox.right
1296− , expected = found.parent.bbox.right + found.parent.bbox.padding.right
1297− }
1298− ]
814+ expectRoundedEquality
815+ found.self.bbox.right
816+ (found.parent.bbox.right + found.parent.bbox.padding.right)
1299817 }
1300818
1301819
@@ -1305,35 +823,30 @@ alignTop =
1305823 Testable.LabeledTest
1306824 { label = "alignTop"
1307825 , attr = Element.alignTop
1308− , id = Testable.NoId
1309826 , test =
1310− \found ->
1311− if List.member found.parentLayout [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
1312− [ Testable.true "alignTop doesn't apply to elements that are above or below" True ]
827+ \found _ ->
828+ if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
829+ Expect.true "alignTop doesn't apply to elements that are above or below" True
1313830
1314831 else if
1315− List.member found.parentLayout
832+ List.member found.location
1316833 [ Testable.IsNearby Testable.InFront
1317834 , Testable.IsNearby Testable.Behind
1318835 , Testable.IsNearby Testable.OnRight
1319836 , Testable.IsNearby Testable.OnLeft
1320837 ]
1321838 then
1322− [ expectRoundedEquality
1323− { found = found.self.bbox.top
1324− , expected = found.parent.bbox.top
1325− }
1326− ]
839+ expectRoundedEquality
840+ found.self.bbox.top
841+ found.parent.bbox.top
1327842
1328843 else if List.length found.siblings == 0 then
1329− [ expectRoundedEquality
1330− { found = found.self.bbox.top
1331− , expected = found.parent.bbox.top + found.parent.bbox.padding.top
1332− }
1333− ]
844+ expectRoundedEquality
845+ found.self.bbox.top
846+ (found.parent.bbox.top + found.parent.bbox.padding.top)
1334847
1335848 else
1336− case found.parentLayout of
849+ case found.location of
1337850 Testable.InColumn ->
1338851 let
1339852 siblingsAbove =
@@ -1347,18 +860,14 @@ alignTop =
1347860 |> List.map (.height << .bbox)
1348861 |> List.sum
1349862 in
1350− [ expectRoundedEquality
1351− { found = found.self.bbox.top
1352− , expected = found.parent.bbox.top + (found.parent.bbox.padding.top + heightsAbove + spacings)
1353− }
1354− ]
863+ expectRoundedEquality
864+ found.self.bbox.top
865+ (found.parent.bbox.top + (found.parent.bbox.padding.top + heightsAbove + spacings))
1355866
1356867 _ ->
1357− [ expectRoundedEquality
1358− { found = found.self.bbox.top
1359− , expected = found.parent.bbox.top
1360− }
1361− ]
868+ expectRoundedEquality
869+ found.self.bbox.top
870+ found.parent.bbox.top
1362871 }
1363872
1364873
@@ -1368,35 +877,30 @@ alignBottom =
1368877 Testable.LabeledTest
1369878 { label = "alignBottom"
1370879 , attr = Element.alignBottom
1371− , id = Testable.NoId
1372880 , test =
1373− \found ->
1374− if List.member found.parentLayout [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
1375− [ Testable.true "alignBottom doesn't apply to elements that are above or below" True ]
881+ \found _ ->
882+ if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
883+ Expect.true "alignBottom doesn't apply to elements that are above or below" True
1376884
1377885 else if
1378− List.member found.parentLayout
886+ List.member found.location
1379887 [ Testable.IsNearby Testable.InFront
1380888 , Testable.IsNearby Testable.Behind
1381889 , Testable.IsNearby Testable.OnRight
1382890 , Testable.IsNearby Testable.OnLeft
1383891 ]
1384892 then
1385− [ expectRoundedEquality
1386− { found = found.self.bbox.bottom
1387− , expected = found.parent.bbox.bottom
1388− }
1389− ]
893+ expectRoundedEquality
894+ found.self.bbox.bottom
895+ found.parent.bbox.bottom
1390896
1391897 else if List.length found.siblings == 0 then
1392− [ expectRoundedEquality
1393− { found = found.self.bbox.bottom
1394− , expected = found.parent.bbox.bottom + found.parent.bbox.padding.bottom
1395− }
1396− ]
898+ expectRoundedEquality
899+ found.self.bbox.bottom
900+ (found.parent.bbox.bottom + found.parent.bbox.padding.bottom)
1397901
1398902 else
1399− case found.parentLayout of
903+ case found.location of
1400904 Testable.InColumn ->
1401905 let
1402906 siblingsBelow =
@@ -1410,31 +914,20 @@ alignBottom =
1410914 |> List.map (.height << .bbox)
1411915 |> List.sum
1412916 in
1413− [ expectRoundedEquality
1414− { found = found.self.bbox.bottom
1415− , expected = found.parent.bbox.bottom - (found.parent.bbox.padding.bottom + heightsBelow + spacings)
1416− }
1417− ]
917+ expectRoundedEquality
918+ found.self.bbox.bottom
919+ (found.parent.bbox.bottom - (found.parent.bbox.padding.bottom + heightsBelow + spacings))
1418920
1419921 _ ->
1420− [ expectRoundedEquality
1421− { found = found.self.bbox.bottom
1422− , expected = found.parent.bbox.bottom + found.parent.bbox.padding.bottom
1423− }
1424− ]
922+ expectRoundedEquality
923+ found.self.bbox.bottom
924+ (found.parent.bbox.bottom + found.parent.bbox.padding.bottom)
1425925 }
1426926
1427927
1428−expectRoundedEquality : { expected : Float, found : Float } -> Testable.LayoutExpectation
1429−expectRoundedEquality { expected, found } =
1430− Testable.true
1431− ("expected " ++ floatToString expected ++ ", found " ++ floatToString found)
1432− (abs (expected - found) < 1)
1433−
1434−
1435−floatToString : Float -> String
1436−floatToString x =
1437− String.fromFloat (toFloat (round (x * 100)) / 100)
928+expectRoundedEquality x y =
929+ Expect.true ("within 1 of each other " ++ String.fromFloat x ++ ":" ++ String.fromFloat y)
930+ (abs (x - y) < 1)
1438931
1439932
1440933{-| -}
@@ -1443,9 +936,8 @@ centerY =
1443936 Testable.LabeledTest
1444937 { label = "centerY"
1445938 , attr = Element.centerY
1446− , id = Testable.NoId
1447939 , test =
1448− \found ->
940+ \found _ ->
1449941 let
1450942 selfCenter =
1451943 found.self.bbox.top + (found.self.bbox.height / 2)
@@ -1453,18 +945,16 @@ centerY =
1453945 parentCenter =
1454946 found.parent.bbox.top + (found.parent.bbox.height / 2)
1455947 in
1456− if List.member found.parentLayout [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
1457− [ Testable.true "centerY doesn't apply to elements that are above or below" True ]
948+ if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
949+ Expect.true "centerY doesn't apply to elements that are above or below" True
1458950
1459951 else if List.length found.siblings == 0 then
1460− [ expectRoundedEquality
1461− { found = selfCenter
1462− , expected = parentCenter
1463− }
1464− ]
952+ expectRoundedEquality
953+ selfCenter
954+ parentCenter
1465955
1466956 else
1467− case found.parentLayout of
957+ case found.location of
1468958 Testable.InColumn ->
1469959 let
1470960 siblingsOnTop =
@@ -1494,18 +984,12 @@ centerY =
1494984 / 2
1495985 )
1496986 in
1497− [ expectRoundedEquality
1498− { found = selfCenter
1499− , expected = expectedCenter
1500− }
1501− ]
987+ expectRoundedEquality
988+ selfCenter
989+ expectedCenter
1502990
1503991 _ ->
1504− [ expectRoundedEquality
1505− { found = selfCenter
1506− , expected = parentCenter
1507− }
1508− ]
992+ expectRoundedEquality selfCenter parentCenter
1509993 }
1510994
1511995
@@ -1517,12 +1001,8 @@ above element =
15171001 , element = element
15181002 , label = "above"
15191003 , test =
1520− \found ->
1521− [ expectRoundedEquality
1522− { found = found.self.bbox.bottom
1523− , expected = found.parent.bbox.top
1524− }
1525− ]
1004+ \found _ ->
1005+ expectRoundedEquality found.self.bbox.bottom found.parent.bbox.top
15261006 }
15271007
15281008
@@ -1534,12 +1014,8 @@ below element =
15341014 , element = element
15351015 , label = "below"
15361016 , test =
1537− \found ->
1538− [ expectRoundedEquality
1539− { found = found.self.bbox.top
1540− , expected = found.parent.bbox.bottom
1541− }
1542− ]
1017+ \found _ ->
1018+ expectRoundedEquality found.self.bbox.top found.parent.bbox.bottom
15431019 }
15441020
15451021
@@ -1551,12 +1027,8 @@ onRight element =
15511027 , element = element
15521028 , label = "onRight"
15531029 , test =
1554− \found ->
1555− [ expectRoundedEquality
1556− { found = found.self.bbox.left
1557− , expected = found.parent.bbox.right
1558− }
1559− ]
1030+ \found _ ->
1031+ expectRoundedEquality found.self.bbox.left found.parent.bbox.right
15601032 }
15611033
15621034
@@ -1568,12 +1040,8 @@ onLeft element =
15681040 , element = element
15691041 , label = "onLeft"
15701042 , test =
1571− \found ->
1572− [ expectRoundedEquality
1573− { found = found.self.bbox.right
1574− , expected = found.parent.bbox.left
1575− }
1576− ]
1043+ \found _ ->
1044+ expectRoundedEquality found.self.bbox.right found.parent.bbox.left
15771045 }
15781046
15791047
@@ -1589,12 +1057,11 @@ inFront element =
15891057 , element = element
15901058 , label = "inFront"
15911059 , test =
1592− \found ->
1593− [ withinHelper found ]
1060+ withinHelper
15941061 }
15951062
15961063
1597−withinHelper found =
1064+withinHelper found _ =
15981065 let
15991066 horizontalCheck =
16001067 if found.self.bbox.width > found.parent.bbox.width then
@@ -1618,7 +1085,7 @@ withinHelper found =
16181085 , compare found.self.bbox.bottom (<=) found.parent.bbox.bottom
16191086 ]
16201087 in
1621− Testable.true "within the confines of the parent"
1088+ Expect.true "within the confines of the parent"
16221089 (List.all ((==) True)
16231090 (List.concat
16241091 [ horizontalCheck
@@ -1636,88 +1103,5 @@ behindContent element =
16361103 , element = element
16371104 , label = "behindContent"
16381105 , test =
1639− \found ->
1640− [ withinHelper found ]
1106+ withinHelper
16411107 }
1642−
1643−
1644−
1645−{- Implicit width/height calcualtions -}
1646−
1647−
1648−implicitWidthHeightShrink attrs =
1649− let
1650− withImplicits =
1651− implicitTest (widthHelper Nothing Nothing Shrink)
1652− :: implicitTest (heightHelper Nothing Nothing Shrink)
1653− :: attrs
1654− in
1655− skipOverridden withImplicits
1656−
1657−
1658−attrId attr =
1659− case attr of
1660− Testable.LabeledTest details ->
1661− details.id
1662−
1663− Testable.AttrTest details ->
1664− details.id
1665−
1666− _ ->
1667− Testable.NoId
1668−
1669−
1670−skipOverridden ls =
1671− List.foldr
1672− (\attr ( found, caught ) ->
1673− let
1674− ( skip, has ) =
1675− case attrId attr of
1676− Testable.NoId ->
1677− ( False, found )
1678−
1679− Testable.IsWidth ->
1680− ( found.hasWidth
1681− , { hasWidth = True
1682− , hasHeight = found.hasHeight
1683− }
1684− )
1685−
1686− Testable.IsHeight ->
1687− ( found.hasHeight
1688− , { hasWidth = found.hasWidth
1689− , hasHeight = True
1690− }
1691− )
1692− in
1693− ( has
1694− , if skip then
1695− caught
1696−
1697− else
1698− attr :: caught
1699− )
1700− )
1701− ( { hasWidth = False
1702− , hasHeight = False
1703− }
1704− , []
1705− )
1706− ls
1707− |> Tuple.second
1708− |> List.reverse
1709−
1710−
1711−{-| This is taking a normal test and rmoving its ability to attach a real `Element` attribute.
1712−-}
1713−implicitTest attr =
1714− case attr of
1715− Testable.LabeledTest details ->
1716− Testable.AttrTest
1717− { test = details.test
1718− , label = "Implicit -> " ++ details.label
1719− , id = details.id
1720− }
1721−
1722− otherwise ->
1723− otherwise