|
@@ -25,6 +25,7 @@ type
|
|
|
|
|
|
// scroll
|
|
|
procedure TestFL_PositionAbsolute_Left_ScrollWidth;
|
|
|
+ procedure TestFL_Viewport_PositionAbsolute;
|
|
|
procedure TestFL_OverflowSizeNested;
|
|
|
// todo procedure TestPositionAbsolute_DivTop100Percent;
|
|
|
|
|
@@ -586,6 +587,73 @@ begin
|
|
|
AssertEquals('Body.ScrollHeight',34,Body.ScrollHeight);
|
|
|
end;
|
|
|
|
|
|
+procedure TTestFlowLayout.TestFL_Viewport_PositionAbsolute;
|
|
|
+var
|
|
|
+ Div1: TDiv;
|
|
|
+ VPWidth, VPHeight: TFresnelLength;
|
|
|
+begin
|
|
|
+ Div1:=TDiv.Create(Viewport);
|
|
|
+ Div1.Name:='Div1';
|
|
|
+ Div1.Parent:=Viewport;
|
|
|
+
|
|
|
+ Viewport.Stylesheet.Text:=LinesToStr([
|
|
|
+ 'div {',
|
|
|
+ ' margin: 2px;',
|
|
|
+ ' border: 1px;',
|
|
|
+ ' padding: 7px;',
|
|
|
+ '}',
|
|
|
+ '#Div1 {',
|
|
|
+ ' width: 50px;',
|
|
|
+ ' height: 50px;',
|
|
|
+ ' position: absolute;',
|
|
|
+ '}']);
|
|
|
+
|
|
|
+ VPWidth:=Viewport.Width;
|
|
|
+ VPHeight:=Viewport.Height;
|
|
|
+
|
|
|
+ // check default: div1 fits into viewport
|
|
|
+ Viewport.Draw;
|
|
|
+ AssertEquals('Viewport.GetComputedString(fcaOverflowX)','auto',Viewport.GetComputedString(fcaOverflowX));
|
|
|
+ AssertEquals('Viewport.GetComputedString(fcaOverflowY)','auto',Viewport.GetComputedString(fcaOverflowY));
|
|
|
+ AssertEquals('Viewport.GetComputedString(fcaOverflow)','auto',Viewport.GetComputedString(fcaOverflow));
|
|
|
+ AssertEquals('Default Viewport.Width',VPWidth,Viewport.Width);
|
|
|
+ AssertEquals('Default Viewport.Height',VPHeight,Viewport.Height);
|
|
|
+ AssertEquals('Default Viewport.ScrollWidth',VPWidth,Viewport.ScrollWidth);
|
|
|
+ AssertEquals('Default Viewport.ScrollHeight',VPHeight,Viewport.ScrollHeight);
|
|
|
+
|
|
|
+ // check Div1 outside right
|
|
|
+ Div1.Style:='left: '+FloatToCSSPx(VPWidth);
|
|
|
+ Viewport.Draw;
|
|
|
+ AssertEquals('Right Viewport.Width',VPWidth,Viewport.Width);
|
|
|
+ AssertEquals('Right Viewport.Height',VPHeight,Viewport.Height);
|
|
|
+ AssertEquals('Right Viewport.ScrollWidth',VPWidth+70,Viewport.ScrollWidth);
|
|
|
+ AssertEquals('Right Viewport.ScrollHeight',VPHeight,Viewport.ScrollHeight);
|
|
|
+
|
|
|
+ // check Div1 outside bottom
|
|
|
+ Div1.Style:='top: '+FloatToCSSPx(VPHeight);
|
|
|
+ Viewport.Draw;
|
|
|
+ AssertEquals('Bottom Viewport.Width',VPWidth,Viewport.Width);
|
|
|
+ AssertEquals('Bottom Viewport.Height',VPHeight,Viewport.Height);
|
|
|
+ AssertEquals('Bottom Viewport.ScrollWidth',VPWidth,Viewport.ScrollWidth);
|
|
|
+ AssertEquals('Bottom Viewport.ScrollHeight',VPHeight+70,Viewport.ScrollHeight);
|
|
|
+
|
|
|
+ // check Div1 outside left
|
|
|
+ Div1.Style:='left: -50px;';
|
|
|
+ Viewport.Draw;
|
|
|
+ AssertEquals('Left Viewport.Width',VPWidth,Viewport.Width);
|
|
|
+ AssertEquals('Leftt Viewport.Height',VPHeight,Viewport.Height);
|
|
|
+ AssertEquals('Left Viewport.ScrollWidth',VPWidth,Viewport.ScrollWidth);
|
|
|
+ AssertEquals('Left Viewport.ScrollHeight',VPHeight,Viewport.ScrollHeight);
|
|
|
+
|
|
|
+ // check Div1 outside top
|
|
|
+ Div1.Style:='top: -50px;';
|
|
|
+ Viewport.Draw;
|
|
|
+ AssertEquals('Left Viewport.Width',VPWidth,Viewport.Width);
|
|
|
+ AssertEquals('Leftt Viewport.Height',VPHeight,Viewport.Height);
|
|
|
+ AssertEquals('Left Viewport.ScrollWidth',VPWidth,Viewport.ScrollWidth);
|
|
|
+ AssertEquals('Left Viewport.ScrollHeight',VPHeight,Viewport.ScrollHeight);
|
|
|
+end;
|
|
|
+
|
|
|
procedure TTestFlowLayout.TestFL_OverflowSizeNested;
|
|
|
var
|
|
|
Div1, Div2, Div3, Div4: TDiv;
|