mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 21:56:00 +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/testmethodcompare.pas svneol=native#text/plain
|
||||||
test/lcltests/testpen.pas svneol=native#text/plain
|
test/lcltests/testpen.pas svneol=native#text/plain
|
||||||
test/lcltests/testpreferredsize.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/lcltests/testunicode.pas svneol=native#text/plain
|
||||||
test/manual/lcl/textextent/mainform.lfm svneol=native#text/plain
|
test/manual/lcl/textextent/mainform.lfm svneol=native#text/plain
|
||||||
test/manual/lcl/textextent/mainform.pas 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"/>
|
<Filename Value="runtests"/>
|
||||||
</Target>
|
</Target>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<OtherUnitFiles Value="bugs;lcltests;codetoolstests;lazutils;lazutils"/>
|
<OtherUnitFiles Value="bugs;lcltests;codetoolstests;lazutils"/>
|
||||||
<UnitOutputDirectory Value="units\$(TargetCPU)-$(TargetOS)"/>
|
<UnitOutputDirectory Value="units\$(TargetCPU)-$(TargetOS)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Conditionals Value="if defined(EnableCTRange) then
|
<Conditionals Value="if defined(EnableCTRange) then
|
||||||
@ -123,9 +123,9 @@
|
|||||||
<UnitName Value="TestPen"/>
|
<UnitName Value="TestPen"/>
|
||||||
</Unit6>
|
</Unit6>
|
||||||
<Unit7>
|
<Unit7>
|
||||||
<Filename Value="lcltests\testpreferredsize.pas"/>
|
<Filename Value="lcltests\testtextstrings.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="TestPreferredSize"/>
|
<UnitName Value="TestTextStrings"/>
|
||||||
</Unit7>
|
</Unit7>
|
||||||
<Unit8>
|
<Unit8>
|
||||||
<Filename Value="codetoolstests\testbasiccodetools.pas"/>
|
<Filename Value="codetoolstests\testbasiccodetools.pas"/>
|
||||||
|
@ -35,7 +35,7 @@ uses
|
|||||||
TestBasicCodetools, TestCTXMLFixFragments, TestCTRangeScan, TestCTH2Pas,
|
TestBasicCodetools, TestCTXMLFixFragments, TestCTRangeScan, TestCTH2Pas,
|
||||||
TestCompleteBlock, TestStdCodetools, TestMethodJumpTool, TestCfgScript,
|
TestCompleteBlock, TestStdCodetools, TestMethodJumpTool, TestCfgScript,
|
||||||
// lcltests
|
// lcltests
|
||||||
testunicode, testpen, TestPreferredSize
|
testunicode, testpen, TestPreferredSize, TestTextStrings
|
||||||
{$IFNDEF NoSemiAutomatedTests}
|
{$IFNDEF NoSemiAutomatedTests}
|
||||||
// semi-automatic tests
|
// semi-automatic tests
|
||||||
, semiautotest, idesemiautotests, lclsemiautotests
|
, semiautotest, idesemiautotests, lclsemiautotests
|
||||||
|
Loading…
Reference in New Issue
Block a user