test: added pen test based on code from Paul

git-svn-id: trunk@16832 -
This commit is contained in:
vincents 2008-10-01 20:44:46 +00:00
parent 8b00789839
commit a4e981a88f
6 changed files with 67 additions and 4 deletions

1
.gitattributes vendored
View File

@ -3782,6 +3782,7 @@ test/bugs/testfileproc.pas svneol=native#text/plain
test/bugs/testfileutil.pas svneol=native#text/plain
test/bugtestcase.pas svneol=native#text/plain
test/hello.ahk svneol=native#text/plain
test/lcltests/testpen.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

47
test/lcltests/testpen.pas Normal file
View File

@ -0,0 +1,47 @@
unit TestPen;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, fpcunit,
Interfaces, LCLType, LCLIntf,
testglobals;
type
{ TTestPen }
TTestPen = class(TTestCase)
published
procedure TestOne;
end;
implementation
{ TTestPen }
procedure TTestPen.TestOne;
var
APen: HPEN;
LP, Test: TLogPen;
begin
LP.lopnColor := $FF0000;
LP.lopnStyle := PS_DASHDOTDOT;
LP.lopnWidth := Point(2, 0);
APen := CreatePenIndirect(LP);
AssertFalse('Creating of APen failed', APen = 0);
// APen created
AssertEquals('Wrong return value of GetObject(APen, 0, nil)',
SizeOf(TLogPen), GetObject(APen, 0, nil));
GetObject(APen, SizeOf(Test), @Test);
AssertTrue( 'Pens are not equal', CompareMem(@Test, @LP, SizeOf(TLogPen)));
DeleteObject(APen);
end;
initialization
AddToLCLTestSuite(TTestPen);
end.

View File

@ -5,7 +5,7 @@ unit TestUnicode;
interface
uses
Classes, SysUtils, fpcunit, testregistry, LCLProc, testglobals;
Classes, SysUtils, fpcunit, LCLProc, testglobals;
type

View File

@ -35,7 +35,7 @@
<PackageName Value="LCL"/>
</Item4>
</RequiredPackages>
<Units Count="5">
<Units Count="7">
<Unit0>
<Filename Value="runtests.lpr"/>
<IsPartOfProject Value="True"/>
@ -61,6 +61,16 @@
<IsPartOfProject Value="True"/>
<UnitName Value="TestUnicode"/>
</Unit4>
<Unit5>
<Filename Value="testunits.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="testunits"/>
</Unit5>
<Unit6>
<Filename Value="lcltests\testpen.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="TestPen"/>
</Unit6>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -35,7 +35,7 @@
<PackageName Value="CodeTools"/>
</Item4>
</RequiredPackages>
<Units Count="8">
<Units Count="9">
<Unit0>
<Filename Value="runtestsgui.lpr"/>
<IsPartOfProject Value="True"/>
@ -76,6 +76,11 @@
<IsPartOfProject Value="True"/>
<UnitName Value="BugTestCase"/>
</Unit7>
<Unit8>
<Filename Value="lcltests\testpen.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="TestPen"/>
</Unit8>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -30,7 +30,7 @@ uses
TestLpi, BugTestCase,
bug8432, testfileutil, testfileproc,
// lcltests
testunicode;
testunicode, testpen;
implementation