mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-06 01:06:01 +02:00
tests: TTextStrings
git-svn-id: trunk@42122 -
This commit is contained in:
parent
a77679e736
commit
bc30518a35
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -7028,6 +7028,7 @@ test/lazutils/testunicode.pas svneol=native#text/pascal
|
||||
test/lcltests/testmethodcompare.pas svneol=native#text/plain
|
||||
test/lcltests/testpen.pas svneol=native#text/plain
|
||||
test/lcltests/testpreferredsize.pas svneol=native#text/plain
|
||||
test/lcltests/testtextstrings.pas svneol=native#text/plain
|
||||
test/lcltests/testunicode.pas svneol=native#text/plain
|
||||
test/manual/lcl/textextent/mainform.lfm svneol=native#text/plain
|
||||
test/manual/lcl/textextent/mainform.pas svneol=native#text/plain
|
||||
|
58
test/lcltests/testtextstrings.pas
Normal file
58
test/lcltests/testtextstrings.pas
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
Test all with:
|
||||
./runtests --format=plain --suite=TTestTextStrings
|
||||
|
||||
Test specific with:
|
||||
./runtests --format=plain --suite=TestTextStringsBasic
|
||||
}
|
||||
unit TestTextStrings;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, Forms, Controls, ExtCtrls, TextStrings,
|
||||
fpcunit, testglobals;
|
||||
|
||||
type
|
||||
|
||||
{ TTestTextStrings }
|
||||
|
||||
TTestTextStrings = class(TTestCase)
|
||||
published
|
||||
procedure TestTextStringsBasic;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TTestTextStrings }
|
||||
|
||||
procedure TTestTextStrings.TestTextStringsBasic;
|
||||
var
|
||||
ts: TTextStrings;
|
||||
begin
|
||||
ts:=TTextStrings.Create;
|
||||
try
|
||||
ts.AddObject('a',TObject(123));
|
||||
ts.AddObject('b',TObject(234));
|
||||
AssertEquals('ab',2,ts.Count);
|
||||
AssertEquals('a at 0','a',ts[0]);
|
||||
AssertEquals('b at 1','b',ts[1]);
|
||||
AssertEquals('123 at 0',123,integer(PtrUInt(ts.Objects[0])));
|
||||
AssertEquals('234 at 1',234,integer(PtrUInt(ts.Objects[1])));
|
||||
|
||||
ts.Delete(0);
|
||||
AssertEquals('b',1,ts.Count);
|
||||
AssertEquals('b at 0','b',ts[0]);
|
||||
AssertEquals('234 at 0',234,integer(PtrUInt(ts.Objects[0])));
|
||||
finally
|
||||
ts.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
AddToLCLTestSuite(TTestTextStrings);
|
||||
|
||||
end.
|
||||
|
@ -23,7 +23,7 @@
|
||||
<Filename Value="runtests"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<OtherUnitFiles Value="bugs;lcltests;codetoolstests;lazutils;lazutils"/>
|
||||
<OtherUnitFiles Value="bugs;lcltests;codetoolstests;lazutils"/>
|
||||
<UnitOutputDirectory Value="units\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Conditionals Value="if defined(EnableCTRange) then
|
||||
@ -123,9 +123,9 @@
|
||||
<UnitName Value="TestPen"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="lcltests\testpreferredsize.pas"/>
|
||||
<Filename Value="lcltests\testtextstrings.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="TestPreferredSize"/>
|
||||
<UnitName Value="TestTextStrings"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="codetoolstests\testbasiccodetools.pas"/>
|
||||
|
@ -35,7 +35,7 @@ uses
|
||||
TestBasicCodetools, TestCTXMLFixFragments, TestCTRangeScan, TestCTH2Pas,
|
||||
TestCompleteBlock, TestStdCodetools, TestMethodJumpTool, TestCfgScript,
|
||||
// lcltests
|
||||
testunicode, testpen, TestPreferredSize
|
||||
testunicode, testpen, TestPreferredSize, TestTextStrings
|
||||
{$IFNDEF NoSemiAutomatedTests}
|
||||
// semi-automatic tests
|
||||
, semiautotest, idesemiautotests, lclsemiautotests
|
||||
|
Loading…
Reference in New Issue
Block a user