|
@@ -13,18 +13,22 @@ type
|
|
|
|
|
|
TTestFlowLayout = class(TCustomTestFresnelCSS)
|
|
|
published
|
|
|
- procedure TestFlowLayout_BodyDiv;
|
|
|
- procedure TestFlowLayout_Slider_WithoutRangePoint;
|
|
|
- procedure TestFlowLayout_SliderRangePoint;
|
|
|
-
|
|
|
- procedure TestMarginPercentage;
|
|
|
- procedure TestPaddingPercentage;
|
|
|
- procedure TestPositionAbsolute_Right_WidthAuto;
|
|
|
- procedure TestPositionAbsolute_DivDefaultPosBehindStatic;
|
|
|
- procedure TestPositionAbsolute_DivDefaultPosBehindRelative;
|
|
|
- procedure TestPositionAbsolute_Left_ScrollWidth;
|
|
|
+ procedure TestFL_BodyDiv;
|
|
|
+ procedure TestFL_Slider_WithoutRangePoint;
|
|
|
+ procedure TestFL_SliderRangePoint;
|
|
|
+
|
|
|
+ procedure TestFL_MarginPercentage;
|
|
|
+ procedure TestFL_PaddingPercentage;
|
|
|
+ procedure TestFL_PositionAbsolute_Right_WidthAuto;
|
|
|
+ procedure TestFL_PositionAbsolute_DivDefaultPosBehindStatic;
|
|
|
+ procedure TestFL_PositionAbsolute_DivDefaultPosBehindRelative;
|
|
|
+
|
|
|
+ // scroll
|
|
|
+ procedure TestFL_PositionAbsolute_Left_ScrollWidth;
|
|
|
+ procedure TestFL_OverflowSizeNested; // todo
|
|
|
// todo procedure TestPositionAbsolute_DivTop100Percent;
|
|
|
- // todo: test break line
|
|
|
+
|
|
|
+ // todo: test break line aka fragments
|
|
|
end;
|
|
|
|
|
|
|
|
@@ -32,7 +36,7 @@ implementation
|
|
|
|
|
|
{ TTestFlowLayout }
|
|
|
|
|
|
-procedure TTestFlowLayout.TestFlowLayout_BodyDiv;
|
|
|
+procedure TTestFlowLayout.TestFL_BodyDiv;
|
|
|
var
|
|
|
Body: TBody;
|
|
|
Div1: TDiv;
|
|
@@ -88,7 +92,7 @@ begin
|
|
|
AssertEquals('Div1.UsedBorderBox.Bottom',10,r.Bottom);
|
|
|
end;
|
|
|
|
|
|
-procedure TTestFlowLayout.TestFlowLayout_Slider_WithoutRangePoint;
|
|
|
+procedure TTestFlowLayout.TestFL_Slider_WithoutRangePoint;
|
|
|
var
|
|
|
Body: TBody;
|
|
|
SliderDiv: TDiv;
|
|
@@ -119,7 +123,7 @@ begin
|
|
|
AssertEquals('SliderDiv.UsedBorderBox.Bottom',18,SliderDiv.UsedBorderBox.Bottom);
|
|
|
end;
|
|
|
|
|
|
-procedure TTestFlowLayout.TestFlowLayout_SliderRangePoint;
|
|
|
+procedure TTestFlowLayout.TestFL_SliderRangePoint;
|
|
|
var
|
|
|
Body: TBody;
|
|
|
SliderDiv, RangeDiv, PointDiv: TDiv;
|
|
@@ -245,7 +249,7 @@ begin
|
|
|
AssertEquals('PointDiv.UsedContentBox.Bottom',13,PointDiv.UsedContentBox.Bottom);
|
|
|
end;
|
|
|
|
|
|
-procedure TTestFlowLayout.TestMarginPercentage;
|
|
|
+procedure TTestFlowLayout.TestFL_MarginPercentage;
|
|
|
var
|
|
|
Body: TBody;
|
|
|
Div1: TDiv;
|
|
@@ -283,7 +287,7 @@ begin
|
|
|
AssertEquals('Div1.UsedBorderBox.Bottom',50,Div1.UsedBorderBox.Bottom);
|
|
|
end;
|
|
|
|
|
|
-procedure TTestFlowLayout.TestPaddingPercentage;
|
|
|
+procedure TTestFlowLayout.TestFL_PaddingPercentage;
|
|
|
var
|
|
|
Body: TBody;
|
|
|
Div1: TDiv;
|
|
@@ -321,7 +325,7 @@ begin
|
|
|
AssertEquals('Div1.UsedContentBox.Bottom',50,Div1.UsedContentBox.Bottom);
|
|
|
end;
|
|
|
|
|
|
-procedure TTestFlowLayout.TestPositionAbsolute_Right_WidthAuto;
|
|
|
+procedure TTestFlowLayout.TestFL_PositionAbsolute_Right_WidthAuto;
|
|
|
var
|
|
|
Body: TBody;
|
|
|
Div1, Div2, Div3: TDiv;
|
|
@@ -407,7 +411,7 @@ begin
|
|
|
AssertEquals('Div2.LayoutNode.Height',52,Div2.LayoutNode.Height);
|
|
|
end;
|
|
|
|
|
|
-procedure TTestFlowLayout.TestPositionAbsolute_DivDefaultPosBehindStatic;
|
|
|
+procedure TTestFlowLayout.TestFL_PositionAbsolute_DivDefaultPosBehindStatic;
|
|
|
var
|
|
|
Body: TBody;
|
|
|
Div1: TDiv;
|
|
@@ -474,7 +478,7 @@ begin
|
|
|
AssertEquals('Div1.UsedBorderBox.Top',23,Div1.UsedBorderBox.Top);
|
|
|
end;
|
|
|
|
|
|
-procedure TTestFlowLayout.TestPositionAbsolute_DivDefaultPosBehindRelative;
|
|
|
+procedure TTestFlowLayout.TestFL_PositionAbsolute_DivDefaultPosBehindRelative;
|
|
|
var
|
|
|
Body: TBody;
|
|
|
Div1: TDiv;
|
|
@@ -533,7 +537,7 @@ begin
|
|
|
AssertEquals('Div1.UsedBorderBox.Top',23,Div1.UsedBorderBox.Top);
|
|
|
end;
|
|
|
|
|
|
-procedure TTestFlowLayout.TestPositionAbsolute_Left_ScrollWidth;
|
|
|
+procedure TTestFlowLayout.TestFL_PositionAbsolute_Left_ScrollWidth;
|
|
|
var
|
|
|
Body: TBody;
|
|
|
Div1: TDiv;
|
|
@@ -582,6 +586,69 @@ begin
|
|
|
AssertEquals('Body.LayoutNode.ScrollHeight',34,Body.LayoutNode.ScrollHeight);
|
|
|
end;
|
|
|
|
|
|
+procedure TTestFlowLayout.TestFL_OverflowSizeNested;
|
|
|
+var
|
|
|
+ Div1, Div2, Div3, Div4: TDiv;
|
|
|
+begin
|
|
|
+ // test, if overflow size is propagated, except when clipping
|
|
|
+ exit;
|
|
|
+
|
|
|
+ Div1:=TDiv.Create(Viewport);
|
|
|
+ Div1.Name:='Div1';
|
|
|
+ Div1.Parent:=Viewport;
|
|
|
+
|
|
|
+ Div2:=TDiv.Create(Viewport);
|
|
|
+ Div2.Name:='Div2';
|
|
|
+ Div2.Parent:=Div1;
|
|
|
+
|
|
|
+ Div3:=TDiv.Create(Viewport);
|
|
|
+ Div3.Name:='Div3';
|
|
|
+ Div3.Parent:=Div2;
|
|
|
+
|
|
|
+ Div4:=TDiv.Create(Viewport);
|
|
|
+ Div4.Name:='Div4';
|
|
|
+ Div4.Parent:=Div3;
|
|
|
+
|
|
|
+ Viewport.Stylesheet.Text:=LinesToStr([
|
|
|
+ 'div {',
|
|
|
+ ' margin: 2px;',
|
|
|
+ ' border: 1px;',
|
|
|
+ ' padding: 7px;',
|
|
|
+ '}',
|
|
|
+ '#Div1 {',
|
|
|
+ ' width: 50px;',
|
|
|
+ ' height: 50px;',
|
|
|
+ ' overflow: auto;',
|
|
|
+ '}',
|
|
|
+ // Div2 fits into Div1, but its content does not
|
|
|
+ '#Div2 {',
|
|
|
+ ' width: 30px;',
|
|
|
+ ' height: 20px;',
|
|
|
+ '}',
|
|
|
+ // Div3 causes Div1 to scroll, but only for its size, not its clipped content
|
|
|
+ '#Div3 {',
|
|
|
+ ' width: 100px;',
|
|
|
+ ' height: 100px;',
|
|
|
+ ' overflow: auto;',
|
|
|
+ '}',
|
|
|
+ // Div4 causes Div3 to scroll
|
|
|
+ '#Div4 {',
|
|
|
+ ' width: 200px;',
|
|
|
+ ' height: 200px;',
|
|
|
+ '}']);
|
|
|
+
|
|
|
+ Viewport.Draw;
|
|
|
+ AssertEquals('Div4.UsedBorderBox.Width',216,Div4.UsedBorderBox.Width);
|
|
|
+ AssertEquals('Div4.UsedBorderBox.Height',216,Div4.UsedBorderBox.Height);
|
|
|
+ AssertEquals('Div4.ScrollWidth',200,Div4.ScrollWidth);
|
|
|
+ AssertEquals('Div4.ScrollHeight',200,Div4.ScrollHeight);
|
|
|
+
|
|
|
+ AssertEquals('Div3.UsedBorderBox.Width',116,Div3.UsedBorderBox.Width);
|
|
|
+ AssertEquals('Div3.UsedBorderBox.Height',116,Div3.UsedBorderBox.Height);
|
|
|
+ AssertEquals('Div3.ScrollWidth',220,Div3.ScrollWidth);
|
|
|
+ AssertEquals('Div3.ScrollHeight',220,Div3.ScrollHeight);
|
|
|
+end;
|
|
|
+
|
|
|
Initialization
|
|
|
RegisterTests([TTestFlowLayout]);
|
|
|
end.
|