test: added test if TScrollBox has interface preferred size 0x0

git-svn-id: trunk@29034 -
This commit is contained in:
mattias 2011-01-15 13:16:36 +00:00
parent 0714e1cb71
commit 95f11f493b

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, LCLProc, Forms, Controls, StdCtrls, ExtCtrls, fpcunit, Classes, SysUtils, LCLProc, Forms, Controls, StdCtrls, ExtCtrls, fpcunit,
testglobals; WSControls, testglobals;
type type
@ -89,6 +89,8 @@ var
Form1: TForm; Form1: TForm;
ScrollBox1: TScrollBox; ScrollBox1: TScrollBox;
Panel1: TPanel; Panel1: TPanel;
IntfPreferredWidth: integer;
IntfPreferredHeight: integer;
begin begin
// create a scrollbox on a form and put a small panel into the box // create a scrollbox on a form and put a small panel into the box
Form1:=TForm.Create(nil); Form1:=TForm.Create(nil);
@ -106,6 +108,13 @@ begin
Form1.Show; Form1.Show;
Application.ProcessMessages; Application.ProcessMessages;
IntfPreferredWidth:=0;
IntfPreferredHeight:=0;
TWSWinControlClass(ScrollBox1.WidgetSetClass).GetPreferredSize(ScrollBox1,
IntfPreferredWidth, IntfPreferredHeight, false);
AssertEquals('ScrollBox must not have interface preferred width',0,IntfPreferredWidth);
AssertEquals('ScrollBox must not have interface preferred height',0,IntfPreferredHeight);
//writeln('TTestPreferredSize.TestScrollBoxOneChildPanel Range=',ScrollBox1.HorzScrollBar.Range,' ',ScrollBox1.HorzScrollBar.Page,' ',ScrollBox1.HorzScrollBar.Visible); //writeln('TTestPreferredSize.TestScrollBoxOneChildPanel Range=',ScrollBox1.HorzScrollBar.Range,' ',ScrollBox1.HorzScrollBar.Page,' ',ScrollBox1.HorzScrollBar.Visible);
AssertEquals('ScrollBox1.HorzScrollBar.Range should be the needed Right of all childs 60',60,ScrollBox1.HorzScrollBar.Range); AssertEquals('ScrollBox1.HorzScrollBar.Range should be the needed Right of all childs 60',60,ScrollBox1.HorzScrollBar.Range);
AssertEquals('ScrollBox1.VertScrollBar.Range should be the needed Bottom of all childs 50',50,ScrollBox1.VertScrollBar.Range); AssertEquals('ScrollBox1.VertScrollBar.Range should be the needed Bottom of all childs 50',50,ScrollBox1.VertScrollBar.Range);