mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-15 10:19:23 +02:00
parent
48b31d3357
commit
10fc2e0c0c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -5576,6 +5576,7 @@ test/bugtestcase.pas svneol=native#text/plain
|
||||
test/codetoolstests/testcompleteblock.pas svneol=native#text/plain
|
||||
test/hello.ahk svneol=native#text/plain
|
||||
test/lcltests/testpen.pas svneol=native#text/plain
|
||||
test/lcltests/testpreferredsize.pas svneol=native#text/plain
|
||||
test/lcltests/testunicode.pas svneol=native#text/plain
|
||||
test/readme.txt svneol=native#text/plain
|
||||
test/runtests.lpi svneol=native#text/plain
|
||||
|
66
test/lcltests/testpreferredsize.pas
Normal file
66
test/lcltests/testpreferredsize.pas
Normal file
@ -0,0 +1,66 @@
|
||||
unit testpreferredsize;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, StdCtrls, fpcunit,
|
||||
testglobals;
|
||||
|
||||
type
|
||||
|
||||
{ TTestPreferredSize }
|
||||
|
||||
TTestPreferredSize = class(TTestCase)
|
||||
published
|
||||
procedure TestGroupBoxPreferredSize1;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TTestPreferredSize }
|
||||
|
||||
procedure TTestPreferredSize.TestGroupBoxPreferredSize1;
|
||||
var
|
||||
Form1: TForm;
|
||||
GroupBox1: TGroupBox;
|
||||
w1: integer;
|
||||
h1: integer;
|
||||
w2: Integer;
|
||||
h2: Integer;
|
||||
begin
|
||||
// create a groupbox on a form
|
||||
Form1:=TForm.Create(nil);
|
||||
Form1.SetBounds(100,100,300,300);
|
||||
GroupBox1:=TGroupBox.Create(Form1);
|
||||
GroupBox1.SetBounds(10,10,100,100);
|
||||
GroupBox1.Parent:=Form1;
|
||||
Form1.Show;
|
||||
Application.ProcessMessages;
|
||||
|
||||
// get the preferredsize of the groupbox with a size of 100x100
|
||||
w1:=0;
|
||||
h1:=0;
|
||||
GroupBox1.GetPreferredSize(w1,h1,true,false);
|
||||
writeln('TTestPreferredSize.TestGroupBox1 ',w1,',',h1);
|
||||
|
||||
// get the preferredsize of the groupbox with a size of 10x100
|
||||
GroupBox1.SetBounds(10,10,10,100);
|
||||
w2:=0;
|
||||
h2:=0;
|
||||
GroupBox1.GetPreferredSize(w2,h2,true,false);
|
||||
writeln('TTestPreferredSize.TestGroupBox1 ',w2,',',h2);
|
||||
|
||||
// the preferredsize must be independent of the the current width,height
|
||||
AssertEquals('TGroupBox.PreferredSize changed after SetBounds: ',true,(w1=w2) and (h1=h2));
|
||||
|
||||
Form1.Free;
|
||||
Application.ProcessMessages;
|
||||
end;
|
||||
|
||||
initialization
|
||||
AddToLCLTestSuite(TTestPreferredSize);
|
||||
|
||||
end.
|
||||
|
@ -22,7 +22,7 @@
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<CommandLineParams Value="-s bugs.2068 --file=results.xml"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="4">
|
||||
@ -39,7 +39,7 @@
|
||||
<PackageName Value="LCL"/>
|
||||
</Item4>
|
||||
</RequiredPackages>
|
||||
<Units Count="7">
|
||||
<Units Count="8">
|
||||
<Unit0>
|
||||
<Filename Value="runtests.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
@ -75,6 +75,11 @@
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="TestPen"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="lcltests\testpreferredsize.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="testpreferredsize"/>
|
||||
</Unit7>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
@ -86,7 +91,6 @@
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<CStyleOperator Value="False"/>
|
||||
<UseAnsiStrings Value="False"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<Linking>
|
||||
|
@ -24,7 +24,7 @@ uses
|
||||
Classes, consoletestrunner,
|
||||
testglobals, testunits, dom,
|
||||
{Unit needed to set the LCL version and widget set name}
|
||||
LCLVersion, InterfaceBase, Interfaces;
|
||||
LCLVersion, InterfaceBase, Interfaces, testpreferredsize;
|
||||
|
||||
type
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user