You've already forked lazarus-ccr
linux fixing, TRttiExpUnicodeStringNodeItem implementation
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@569 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -44,10 +44,16 @@ type
|
|||||||
FIntProp: Integer;
|
FIntProp: Integer;
|
||||||
FStrProp: string;
|
FStrProp: string;
|
||||||
FWideStrProp: widestring;
|
FWideStrProp: widestring;
|
||||||
|
{$IFDEF WST_UNICODESTRING}
|
||||||
|
FUnicodeStrProp: UnicodeString;
|
||||||
|
{$ENDIF WST_UNICODESTRING}
|
||||||
published
|
published
|
||||||
property IntProp : Integer read FIntProp write FIntProp;
|
property IntProp : Integer read FIntProp write FIntProp;
|
||||||
property StrProp : string read FStrProp write FStrProp;
|
property StrProp : string read FStrProp write FStrProp;
|
||||||
property WideStrProp : widestring read FWideStrProp write FWideStrProp;
|
property WideStrProp : widestring read FWideStrProp write FWideStrProp;
|
||||||
|
{$IFDEF WST_UNICODESTRING}
|
||||||
|
property UnicodeStrProp : UnicodeString read FUnicodeStrProp write FUnicodeStrProp;
|
||||||
|
{$ENDIF WST_UNICODESTRING}
|
||||||
property EnumProp : TSampleEnum read FEnumProp write FEnumProp;
|
property EnumProp : TSampleEnum read FEnumProp write FEnumProp;
|
||||||
property BoolProp : Boolean read FBoolProp write FBoolProp;
|
property BoolProp : Boolean read FBoolProp write FBoolProp;
|
||||||
end;
|
end;
|
||||||
@ -96,6 +102,17 @@ type
|
|||||||
procedure Evaluate_EqualCaseInsensitive();
|
procedure Evaluate_EqualCaseInsensitive();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF WST_UNICODESTRING}
|
||||||
|
{ TRttiExpUnicodeStringNodeItem_Test }
|
||||||
|
|
||||||
|
TRttiExpUnicodeStringNodeItem_Test = class(TTestCase)
|
||||||
|
published
|
||||||
|
procedure Create_Test();
|
||||||
|
procedure Evaluate_EqualCaseSensitive();
|
||||||
|
procedure Evaluate_EqualCaseInsensitive();
|
||||||
|
end;
|
||||||
|
{$ENDIF WST_UNICODESTRING}
|
||||||
|
|
||||||
{ TRttiExpNode_Test }
|
{ TRttiExpNode_Test }
|
||||||
|
|
||||||
TRttiExpNode_Test = class(TTestCase)
|
TRttiExpNode_Test = class(TTestCase)
|
||||||
@ -881,7 +898,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRttiExpwWideStringNodeItem_Test.Evaluate_EqualCaseSensitive();
|
procedure TRttiExpwWideStringNodeItem_Test.Evaluate_EqualCaseSensitive();
|
||||||
const VAL_1 = 'AzertY';
|
const VAL_1 : WideString = 'AzertY';
|
||||||
var
|
var
|
||||||
x : TRttiExpWideStringNodeItem;
|
x : TRttiExpWideStringNodeItem;
|
||||||
t : TClass_A;
|
t : TClass_A;
|
||||||
@ -909,7 +926,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRttiExpwWideStringNodeItem_Test.Evaluate_EqualCaseInsensitive();
|
procedure TRttiExpwWideStringNodeItem_Test.Evaluate_EqualCaseInsensitive();
|
||||||
const VAL_1 = 'AzertY';
|
const VAL_1 : WideString = 'AzertY';
|
||||||
var
|
var
|
||||||
x : TRttiExpWideStringNodeItem;
|
x : TRttiExpWideStringNodeItem;
|
||||||
t : TClass_A;
|
t : TClass_A;
|
||||||
@ -923,12 +940,64 @@ begin
|
|||||||
Check( x.Evaluate(t) = False ,'False');
|
Check( x.Evaluate(t) = False ,'False');
|
||||||
|
|
||||||
t.WideStrProp := UpperCase(VAL_1);
|
t.WideStrProp := UpperCase(VAL_1);
|
||||||
Check( x.Evaluate(t) = True ,'True');
|
Check( x.Evaluate(t) = True ,'True 1');
|
||||||
|
|
||||||
t.WideStrProp := LowerCase(VAL_1);
|
t.WideStrProp := LowerCase(VAL_1);
|
||||||
Check( x.Evaluate(t) = True ,'True');
|
Check( x.Evaluate(t) = True ,'True 2');
|
||||||
|
|
||||||
t.WideStrProp := VAL_1;
|
t.WideStrProp := VAL_1;
|
||||||
|
Check( x.Evaluate(t) = True, 'True 3' );
|
||||||
|
finally
|
||||||
|
x.Free();
|
||||||
|
t.Free();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$IFDEF WST_UNICODESTRING}
|
||||||
|
{ TRttiExpUnicodeStringNodeItem_Test }
|
||||||
|
|
||||||
|
procedure TRttiExpUnicodeStringNodeItem_Test.Create_Test();
|
||||||
|
var
|
||||||
|
x : TRttiExpUnicodeStringNodeItem;
|
||||||
|
begin
|
||||||
|
x := nil;
|
||||||
|
try
|
||||||
|
try
|
||||||
|
x := TRttiExpUnicodeStringNodeItem.Create(GetPropInfo(TClass_A,'IntProp'),sfoEqualCaseInsensitive,'Azerty');
|
||||||
|
Check(False);
|
||||||
|
except
|
||||||
|
on e : EAssertionFailedError do
|
||||||
|
raise;
|
||||||
|
on e : ERttiFilterException do begin
|
||||||
|
// nothing!
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
x.Free();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRttiExpUnicodeStringNodeItem_Test.Evaluate_EqualCaseSensitive();
|
||||||
|
const VAL_1 : UnicodeString = 'AzertY';
|
||||||
|
var
|
||||||
|
x : TRttiExpUnicodeStringNodeItem;
|
||||||
|
t : TClass_A;
|
||||||
|
begin
|
||||||
|
x := nil;
|
||||||
|
t := TClass_A.Create();
|
||||||
|
try
|
||||||
|
x := TRttiExpUnicodeStringNodeItem.Create(GetPropInfo(t,'UnicodeStrProp'),sfoEqualCaseSensitive,VAL_1);
|
||||||
|
|
||||||
|
t.UnicodeStrProp := 'aaadddd';
|
||||||
|
Check( x.Evaluate(t) = False ,'False');
|
||||||
|
|
||||||
|
t.UnicodeStrProp := UpperCase(VAL_1);
|
||||||
|
Check( x.Evaluate(t) = False ,'False');
|
||||||
|
|
||||||
|
t.UnicodeStrProp := LowerCase(VAL_1);
|
||||||
|
Check( x.Evaluate(t) = False ,'False');
|
||||||
|
|
||||||
|
t.UnicodeStrProp := VAL_1;
|
||||||
Check( x.Evaluate(t) = True, 'True' );
|
Check( x.Evaluate(t) = True, 'True' );
|
||||||
finally
|
finally
|
||||||
x.Free();
|
x.Free();
|
||||||
@ -936,6 +1005,34 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TRttiExpUnicodeStringNodeItem_Test.Evaluate_EqualCaseInsensitive();
|
||||||
|
const VAL_1 : UnicodeString = 'AzertY';
|
||||||
|
var
|
||||||
|
x : TRttiExpUnicodeStringNodeItem;
|
||||||
|
t : TClass_A;
|
||||||
|
begin
|
||||||
|
x := nil;
|
||||||
|
t := TClass_A.Create();
|
||||||
|
try
|
||||||
|
x := TRttiExpUnicodeStringNodeItem.Create(GetPropInfo(t,'UnicodeStrProp'),sfoEqualCaseInsensitive,VAL_1);
|
||||||
|
|
||||||
|
t.UnicodeStrProp := 'aaadddd';
|
||||||
|
Check( x.Evaluate(t) = False ,'False');
|
||||||
|
|
||||||
|
t.UnicodeStrProp := UpperCase(VAL_1);
|
||||||
|
Check( x.Evaluate(t) = True ,'True');
|
||||||
|
|
||||||
|
t.UnicodeStrProp := LowerCase(VAL_1);
|
||||||
|
Check( x.Evaluate(t) = True ,'True');
|
||||||
|
|
||||||
|
t.UnicodeStrProp := VAL_1;
|
||||||
|
Check( x.Evaluate(t) = True, 'True' );
|
||||||
|
finally
|
||||||
|
x.Free();
|
||||||
|
t.Free();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$ENDIF WST_UNICODESTRING}
|
||||||
|
|
||||||
{ TRttiParser_Test }
|
{ TRttiParser_Test }
|
||||||
|
|
||||||
@ -1374,11 +1471,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Initialization
|
Initialization
|
||||||
RegisterTest('Cursors',TRttiExpIntegerNodeItem_Test.Suite);
|
RegisterTest('Cursors',TRttiExpIntegerNodeItem_Test.Suite);
|
||||||
RegisterTest('Cursors',TRttiExpEnumNodeItem_Test.Suite);
|
RegisterTest('Cursors',TRttiExpEnumNodeItem_Test.Suite);
|
||||||
RegisterTest('Cursors',TRttiExpAnsiStringNodeItem_Test.Suite);
|
RegisterTest('Cursors',TRttiExpAnsiStringNodeItem_Test.Suite);
|
||||||
RegisterTest('Cursors',TRttiExpwWideStringNodeItem_Test.Suite);
|
RegisterTest('Cursors',TRttiExpwWideStringNodeItem_Test.Suite);
|
||||||
|
{$IFDEF WST_UNICODESTRING}
|
||||||
|
RegisterTest('Cursors',TRttiExpUnicodeStringNodeItem_Test.Suite);
|
||||||
|
{$ENDIF WST_UNICODESTRING}
|
||||||
RegisterTest('Cursors',TRttiExpNode_Test.Suite);
|
RegisterTest('Cursors',TRttiExpNode_Test.Suite);
|
||||||
RegisterTest('Cursors',TRttiFilterCreator_Test.Suite);
|
RegisterTest('Cursors',TRttiFilterCreator_Test.Suite);
|
||||||
RegisterTest('Cursors',TRttiParser_Test.Suite);
|
RegisterTest('Cursors',TRttiParser_Test.Suite);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="/"/>
|
||||||
<Version Value="6"/>
|
<Version Value="6"/>
|
||||||
<General>
|
<General>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
@ -33,47 +33,47 @@
|
|||||||
<UnitName Value="testformatter_unit"/>
|
<UnitName Value="testformatter_unit"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
<Unit2>
|
<Unit2>
|
||||||
<Filename Value="..\..\server_service_soap.pas"/>
|
<Filename Value="../../server_service_soap.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="server_service_soap"/>
|
<UnitName Value="server_service_soap"/>
|
||||||
</Unit2>
|
</Unit2>
|
||||||
<Unit3>
|
<Unit3>
|
||||||
<Filename Value="..\..\soap_formatter.pas"/>
|
<Filename Value="../../soap_formatter.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="soap_formatter"/>
|
<UnitName Value="soap_formatter"/>
|
||||||
</Unit3>
|
</Unit3>
|
||||||
<Unit4>
|
<Unit4>
|
||||||
<Filename Value="..\..\base_binary_formatter.pas"/>
|
<Filename Value="../../base_binary_formatter.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="base_binary_formatter"/>
|
<UnitName Value="base_binary_formatter"/>
|
||||||
</Unit4>
|
</Unit4>
|
||||||
<Unit5>
|
<Unit5>
|
||||||
<Filename Value="..\..\base_service_intf.pas"/>
|
<Filename Value="../../base_service_intf.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="base_service_intf"/>
|
<UnitName Value="base_service_intf"/>
|
||||||
</Unit5>
|
</Unit5>
|
||||||
<Unit6>
|
<Unit6>
|
||||||
<Filename Value="..\..\base_soap_formatter.pas"/>
|
<Filename Value="../../base_soap_formatter.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="base_soap_formatter"/>
|
<UnitName Value="base_soap_formatter"/>
|
||||||
</Unit6>
|
</Unit6>
|
||||||
<Unit7>
|
<Unit7>
|
||||||
<Filename Value="..\..\binary_formatter.pas"/>
|
<Filename Value="../../binary_formatter.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="binary_formatter"/>
|
<UnitName Value="binary_formatter"/>
|
||||||
</Unit7>
|
</Unit7>
|
||||||
<Unit8>
|
<Unit8>
|
||||||
<Filename Value="..\..\binary_streamer.pas"/>
|
<Filename Value="../../binary_streamer.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="binary_streamer"/>
|
<UnitName Value="binary_streamer"/>
|
||||||
</Unit8>
|
</Unit8>
|
||||||
<Unit9>
|
<Unit9>
|
||||||
<Filename Value="..\..\server_binary_formatter.pas"/>
|
<Filename Value="../../server_binary_formatter.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="server_binary_formatter"/>
|
<UnitName Value="server_binary_formatter"/>
|
||||||
</Unit9>
|
</Unit9>
|
||||||
<Unit10>
|
<Unit10>
|
||||||
<Filename Value="..\..\metadata_repository.pas"/>
|
<Filename Value="../../metadata_repository.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="metadata_repository"/>
|
<UnitName Value="metadata_repository"/>
|
||||||
</Unit10>
|
</Unit10>
|
||||||
@ -83,27 +83,27 @@
|
|||||||
<UnitName Value="testmetadata_unit"/>
|
<UnitName Value="testmetadata_unit"/>
|
||||||
</Unit11>
|
</Unit11>
|
||||||
<Unit12>
|
<Unit12>
|
||||||
<Filename Value="..\..\ws_helper\metadata_generator.pas"/>
|
<Filename Value="../../ws_helper/metadata_generator.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="metadata_generator"/>
|
<UnitName Value="metadata_generator"/>
|
||||||
</Unit12>
|
</Unit12>
|
||||||
<Unit13>
|
<Unit13>
|
||||||
<Filename Value="..\..\metadata_wsdl.pas"/>
|
<Filename Value="../../metadata_wsdl.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="metadata_wsdl"/>
|
<UnitName Value="metadata_wsdl"/>
|
||||||
</Unit13>
|
</Unit13>
|
||||||
<Unit14>
|
<Unit14>
|
||||||
<Filename Value="..\..\server_service_intf.pas"/>
|
<Filename Value="../../server_service_intf.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="server_service_intf"/>
|
<UnitName Value="server_service_intf"/>
|
||||||
</Unit14>
|
</Unit14>
|
||||||
<Unit15>
|
<Unit15>
|
||||||
<Filename Value="..\..\base_xmlrpc_formatter.pas"/>
|
<Filename Value="../../base_xmlrpc_formatter.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="base_xmlrpc_formatter"/>
|
<UnitName Value="base_xmlrpc_formatter"/>
|
||||||
</Unit15>
|
</Unit15>
|
||||||
<Unit16>
|
<Unit16>
|
||||||
<Filename Value="..\..\wst_fpc_xml.pas"/>
|
<Filename Value="../../wst_fpc_xml.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="wst_fpc_xml"/>
|
<UnitName Value="wst_fpc_xml"/>
|
||||||
</Unit16>
|
</Unit16>
|
||||||
@ -113,7 +113,7 @@
|
|||||||
<UnitName Value="test_utilities"/>
|
<UnitName Value="test_utilities"/>
|
||||||
</Unit17>
|
</Unit17>
|
||||||
<Unit18>
|
<Unit18>
|
||||||
<Filename Value="..\..\server_service_xmlrpc.pas"/>
|
<Filename Value="../../server_service_xmlrpc.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="server_service_xmlrpc"/>
|
<UnitName Value="server_service_xmlrpc"/>
|
||||||
</Unit18>
|
</Unit18>
|
||||||
@ -123,27 +123,27 @@
|
|||||||
<UnitName Value="test_parsers"/>
|
<UnitName Value="test_parsers"/>
|
||||||
</Unit19>
|
</Unit19>
|
||||||
<Unit20>
|
<Unit20>
|
||||||
<Filename Value="..\..\ws_helper\wsdl_generator.pas"/>
|
<Filename Value="../../ws_helper/wsdl_generator.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="wsdl_generator"/>
|
<UnitName Value="wsdl_generator"/>
|
||||||
</Unit20>
|
</Unit20>
|
||||||
<Unit21>
|
<Unit21>
|
||||||
<Filename Value="..\..\ws_helper\xsd_generator.pas"/>
|
<Filename Value="../../ws_helper/xsd_generator.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="xsd_generator"/>
|
<UnitName Value="xsd_generator"/>
|
||||||
</Unit21>
|
</Unit21>
|
||||||
<Unit22>
|
<Unit22>
|
||||||
<Filename Value="..\..\ws_helper\xsd_consts.pas"/>
|
<Filename Value="../../ws_helper/xsd_consts.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="xsd_consts"/>
|
<UnitName Value="xsd_consts"/>
|
||||||
</Unit22>
|
</Unit22>
|
||||||
<Unit23>
|
<Unit23>
|
||||||
<Filename Value="..\..\ws_helper\wsdl_parser.pas"/>
|
<Filename Value="../../ws_helper/wsdl_parser.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="wsdl_parser"/>
|
<UnitName Value="wsdl_parser"/>
|
||||||
</Unit23>
|
</Unit23>
|
||||||
<Unit24>
|
<Unit24>
|
||||||
<Filename Value="..\..\base_json_formatter.pas"/>
|
<Filename Value="../../base_json_formatter.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="base_json_formatter"/>
|
<UnitName Value="base_json_formatter"/>
|
||||||
</Unit24>
|
</Unit24>
|
||||||
@ -153,7 +153,7 @@
|
|||||||
<UnitName Value="test_support"/>
|
<UnitName Value="test_support"/>
|
||||||
</Unit25>
|
</Unit25>
|
||||||
<Unit26>
|
<Unit26>
|
||||||
<Filename Value="..\..\basex_encode.pas"/>
|
<Filename Value="../../basex_encode.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="basex_encode"/>
|
<UnitName Value="basex_encode"/>
|
||||||
</Unit26>
|
</Unit26>
|
||||||
@ -163,12 +163,12 @@
|
|||||||
<UnitName Value="test_basex_encode"/>
|
<UnitName Value="test_basex_encode"/>
|
||||||
</Unit27>
|
</Unit27>
|
||||||
<Unit28>
|
<Unit28>
|
||||||
<Filename Value="..\..\json_formatter.pas"/>
|
<Filename Value="../../json_formatter.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="json_formatter"/>
|
<UnitName Value="json_formatter"/>
|
||||||
</Unit28>
|
</Unit28>
|
||||||
<Unit29>
|
<Unit29>
|
||||||
<Filename Value="..\..\server_service_json.pas"/>
|
<Filename Value="../../server_service_json.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="server_service_json"/>
|
<UnitName Value="server_service_json"/>
|
||||||
</Unit29>
|
</Unit29>
|
||||||
@ -211,13 +211,12 @@
|
|||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="8"/>
|
<Version Value="8"/>
|
||||||
<PathDelim Value="\"/>
|
|
||||||
<Target>
|
<Target>
|
||||||
<Filename Value="wst_test_suite.exe"/>
|
<Filename Value="wst_test_suite.exe"/>
|
||||||
</Target>
|
</Target>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<IncludeFiles Value="..\..\"/>
|
<IncludeFiles Value="../../"/>
|
||||||
<OtherUnitFiles Value="..\..\;..\..\ws_helper\;..\..\wst_rtti_filter\;..\..\fcl-json\src\"/>
|
<OtherUnitFiles Value="../../;../../ws_helper/;../../wst_rtti_filter/;../../fcl-json/src/"/>
|
||||||
<UnitOutputDirectory Value="obj"/>
|
<UnitOutputDirectory Value="obj"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Parsing>
|
<Parsing>
|
||||||
|
@ -5,7 +5,7 @@ program wst_test_suite;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
cthreads,
|
cthreads, cwstring,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
custapp, classes, sysutils, fpcunit, testreport, testregistry,
|
custapp, classes, sysutils, fpcunit, testreport, testregistry,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="/"/>
|
||||||
<Version Value="6"/>
|
<Version Value="6"/>
|
||||||
<General>
|
<General>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
@ -96,12 +96,12 @@
|
|||||||
<UnitName Value="test_rtti_filter"/>
|
<UnitName Value="test_rtti_filter"/>
|
||||||
</Unit11>
|
</Unit11>
|
||||||
<Unit12>
|
<Unit12>
|
||||||
<Filename Value="..\..\wst_rtti_filter\rtti_filters.pas"/>
|
<Filename Value="../../wst_rtti_filter/rtti_filters.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="rtti_filters"/>
|
<UnitName Value="rtti_filters"/>
|
||||||
</Unit12>
|
</Unit12>
|
||||||
<Unit13>
|
<Unit13>
|
||||||
<Filename Value="..\..\wst_rtti_filter\wst_cursors.pas"/>
|
<Filename Value="../../wst_rtti_filter/wst_cursors.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="wst_cursors"/>
|
<UnitName Value="wst_cursors"/>
|
||||||
</Unit13>
|
</Unit13>
|
||||||
@ -129,13 +129,12 @@
|
|||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="8"/>
|
<Version Value="8"/>
|
||||||
<PathDelim Value="\"/>
|
|
||||||
<Target>
|
<Target>
|
||||||
<Filename Value="wst_test_suite_gui.exe"/>
|
<Filename Value="wst_test_suite_gui.exe"/>
|
||||||
</Target>
|
</Target>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<IncludeFiles Value="..\..\"/>
|
<IncludeFiles Value="../../"/>
|
||||||
<OtherUnitFiles Value="..\..\;..\..\ws_helper\;..\..\wst_rtti_filter\;..\..\fcl-json\src\"/>
|
<OtherUnitFiles Value="../../;../../ws_helper/;../../wst_rtti_filter/;../../fcl-json/src/"/>
|
||||||
<UnitOutputDirectory Value="obj"/>
|
<UnitOutputDirectory Value="obj"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Parsing>
|
<Parsing>
|
||||||
|
@ -4,7 +4,7 @@ program wst_test_suite_gui;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
cthreads,
|
cthreads, cwstring,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Interfaces, Forms, GuiTestRunner,
|
Interfaces, Forms, GuiTestRunner,
|
||||||
TestFormatter_unit, testmetadata_unit,
|
TestFormatter_unit, testmetadata_unit,
|
||||||
|
@ -86,6 +86,14 @@ type
|
|||||||
const AValue : WideString;
|
const AValue : WideString;
|
||||||
const AConnector : TFilterConnector
|
const AConnector : TFilterConnector
|
||||||
) : TRttiFilterCreator;overload;
|
) : TRttiFilterCreator;overload;
|
||||||
|
{$IFDEF WST_UNICODESTRING}
|
||||||
|
function AddCondition(
|
||||||
|
const APropertyName : string;
|
||||||
|
const AOperator : TStringFilterOperator;
|
||||||
|
const AValue : UnicodeString;
|
||||||
|
const AConnector : TFilterConnector
|
||||||
|
) : TRttiFilterCreator;overload;
|
||||||
|
{$ENDIF WST_UNICODESTRING}
|
||||||
|
|
||||||
function BeginGroup(const AConnector : TFilterConnector):TRttiFilterCreator;
|
function BeginGroup(const AConnector : TFilterConnector):TRttiFilterCreator;
|
||||||
function EndGroup():TRttiFilterCreator;
|
function EndGroup():TRttiFilterCreator;
|
||||||
@ -226,6 +234,23 @@ type
|
|||||||
property ComparedValue : WideString read FComparedValue;
|
property ComparedValue : WideString read FComparedValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF WST_UNICODESTRING}
|
||||||
|
{ TRttiExpUnicodeStringNodeItem }
|
||||||
|
|
||||||
|
TRttiExpUnicodeStringNodeItem = class(TRttiExpStringNodeItem)
|
||||||
|
private
|
||||||
|
FComparedValue: UnicodeString;
|
||||||
|
public
|
||||||
|
constructor Create(
|
||||||
|
const APropInfo : PPropInfo;
|
||||||
|
const AOperation : TStringFilterOperator;
|
||||||
|
const AComparedValue : UnicodeString
|
||||||
|
);
|
||||||
|
function Evaluate(AInstance : TRttiFilterCreatorTarget):Boolean;override;
|
||||||
|
property ComparedValue : UnicodeString read FComparedValue;
|
||||||
|
end;
|
||||||
|
{$ENDIF WST_UNICODESTRING}
|
||||||
|
|
||||||
procedure ParseFilter(const AFilterText: string; AFltrCrtr : TRttiFilterCreator);overload;
|
procedure ParseFilter(const AFilterText: string; AFltrCrtr : TRttiFilterCreator);overload;
|
||||||
function ParseFilter(
|
function ParseFilter(
|
||||||
const AFilterText : string;
|
const AFilterText : string;
|
||||||
@ -282,6 +307,9 @@ var
|
|||||||
var
|
var
|
||||||
s : string;
|
s : string;
|
||||||
ws : WideString;
|
ws : WideString;
|
||||||
|
{$IFDEF WST_UNICODESTRING}
|
||||||
|
us : UnicodeString;
|
||||||
|
{$ENDIF WST_UNICODESTRING}
|
||||||
fltrOp : TStringFilterOperator;
|
fltrOp : TStringFilterOperator;
|
||||||
begin
|
begin
|
||||||
MoveNext();
|
MoveNext();
|
||||||
@ -301,14 +329,26 @@ var
|
|||||||
end;
|
end;
|
||||||
MoveNext();
|
MoveNext();
|
||||||
prsr.CheckToken(toString);
|
prsr.CheckToken(toString);
|
||||||
if ( propInfo^.PropType^.Kind = tkWString ) then begin
|
case propInfo^.PropType^.Kind of
|
||||||
|
tkWString :
|
||||||
|
begin
|
||||||
ws := prsr.TokenString();
|
ws := prsr.TokenString();
|
||||||
AFltrCrtr.AddCondition(propName,fltrOp,ws,lastCntr);
|
AFltrCrtr.AddCondition(propName,fltrOp,ws,lastCntr);
|
||||||
end else begin
|
end;
|
||||||
|
{$IFDEF WST_UNICODESTRING}
|
||||||
|
tkUString :
|
||||||
|
begin
|
||||||
|
us := prsr.TokenString();
|
||||||
|
AFltrCrtr.AddCondition(propName,fltrOp,us,lastCntr);
|
||||||
|
end;
|
||||||
|
{$ENDIF WST_UNICODESTRING}
|
||||||
|
else
|
||||||
|
begin
|
||||||
s := prsr.TokenString();
|
s := prsr.TokenString();
|
||||||
AFltrCrtr.AddCondition(propName,fltrOp,s,lastCntr);
|
AFltrCrtr.AddCondition(propName,fltrOp,s,lastCntr);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure Handle_Integer();
|
procedure Handle_Integer();
|
||||||
var
|
var
|
||||||
@ -408,7 +448,13 @@ begin
|
|||||||
propInfo := GetPropInfo(AFltrCrtr.TargetClass,propName);
|
propInfo := GetPropInfo(AFltrCrtr.TargetClass,propName);
|
||||||
if ( propInfo = nil ) then
|
if ( propInfo = nil ) then
|
||||||
raise ERttiFilterException.CreateFmt('Invalid property : "%s"',[propName]);
|
raise ERttiFilterException.CreateFmt('Invalid property : "%s"',[propName]);
|
||||||
if ( propInfo^.PropType^.Kind in [{$IFDEF FPC}tkSString,tkAString,{$ENDIF}tkLString,tkWString] ) then
|
if ( propInfo^.PropType^.Kind in
|
||||||
|
[ {$IFDEF FPC}tkSString,tkAString,{$ENDIF}
|
||||||
|
{$IFDEF WST_UNICODESTRING}tkUString,{$ENDIF}
|
||||||
|
tkLString,tkWString
|
||||||
|
]
|
||||||
|
)
|
||||||
|
then
|
||||||
Handle_String()
|
Handle_String()
|
||||||
else if ( propInfo^.PropType^.Kind in [tkInteger,tkInt64{$IFDEF HAS_QWORD},tkQWord{$ENDIF}] ) then
|
else if ( propInfo^.PropType^.Kind in [tkInteger,tkInt64{$IFDEF HAS_QWORD},tkQWord{$ENDIF}] ) then
|
||||||
Handle_Integer()
|
Handle_Integer()
|
||||||
@ -654,6 +700,22 @@ begin
|
|||||||
Result := Self;
|
Result := Self;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF WST_UNICODESTRING}
|
||||||
|
function TRttiFilterCreator.AddCondition(
|
||||||
|
const APropertyName: string;
|
||||||
|
const AOperator: TStringFilterOperator;
|
||||||
|
const AValue: UnicodeString;
|
||||||
|
const AConnector: TFilterConnector
|
||||||
|
) : TRttiFilterCreator;
|
||||||
|
begin
|
||||||
|
AddNode(
|
||||||
|
TRttiExpUnicodeStringNodeItem.Create(GetPropInfo(TargetClass,APropertyName),AOperator,AValue),
|
||||||
|
AConnector
|
||||||
|
);
|
||||||
|
Result := Self;
|
||||||
|
end;
|
||||||
|
{$ENDIF WST_UNICODESTRING}
|
||||||
|
|
||||||
function TRttiFilterCreator.BeginGroup(const AConnector: TFilterConnector):TRttiFilterCreator;
|
function TRttiFilterCreator.BeginGroup(const AConnector: TFilterConnector):TRttiFilterCreator;
|
||||||
var
|
var
|
||||||
gn : TRttiExpNode;
|
gn : TRttiExpNode;
|
||||||
@ -755,8 +817,8 @@ constructor TRttiExpWideStringNodeItem.Create(
|
|||||||
);
|
);
|
||||||
begin
|
begin
|
||||||
Assert(Assigned(APropInfo));
|
Assert(Assigned(APropInfo));
|
||||||
if not ( APropInfo^.PropType^.Kind in [tkWString] ) then
|
if not ( APropInfo^.PropType^.Kind in [tkWString{$IFDEF WST_UNICODESTRING},tkUString{$ENDIF}] ) then
|
||||||
raise ERttiFilterException.CreateFmt('Invalid property data type. "%s" excpeted.',['WideString']);
|
raise ERttiFilterException.CreateFmt('Invalid property data type. "%s" excpeted, got "%s".',['WideString',GetEnumName(TypeInfo(TTypeKind),Ord(APropInfo^.PropType^.Kind))]);
|
||||||
inherited Create(APropInfo,AOperation);
|
inherited Create(APropInfo,AOperation);
|
||||||
FComparedValue := AComparedValue;
|
FComparedValue := AComparedValue;
|
||||||
end;
|
end;
|
||||||
@ -764,14 +826,44 @@ end;
|
|||||||
function TRttiExpWideStringNodeItem.Evaluate(AInstance: TRttiFilterCreatorTarget): Boolean;
|
function TRttiExpWideStringNodeItem.Evaluate(AInstance: TRttiFilterCreatorTarget): Boolean;
|
||||||
begin
|
begin
|
||||||
case Operation of
|
case Operation of
|
||||||
sfoEqualCaseSensitive : Result := AnsiSameStr(GetStrProp(AInstance,PropInfo),ComparedValue);
|
sfoEqualCaseSensitive : Result := ( GetWideStrProp(AInstance,PropInfo) = ComparedValue );
|
||||||
sfoEqualCaseInsensitive : Result := AnsiSameText(GetStrProp(AInstance,PropInfo),ComparedValue);
|
sfoEqualCaseInsensitive : Result := ( LowerCase(GetWideStrProp(AInstance,PropInfo)) = LowerCase(ComparedValue) );
|
||||||
sfoNotEqual : Result := not AnsiSameText(GetStrProp(AInstance,PropInfo),ComparedValue);
|
sfoNotEqual : Result := not SameText(GetWideStrProp(AInstance,PropInfo),ComparedValue);
|
||||||
else
|
else
|
||||||
Assert(False);
|
Assert(False);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF WST_UNICODESTRING}
|
||||||
|
{ TRttiExpUnicodeStringNodeItem }
|
||||||
|
|
||||||
|
constructor TRttiExpUnicodeStringNodeItem.Create(
|
||||||
|
const APropInfo: PPropInfo;
|
||||||
|
const AOperation: TStringFilterOperator;
|
||||||
|
const AComparedValue: UnicodeString
|
||||||
|
);
|
||||||
|
begin
|
||||||
|
Assert(Assigned(APropInfo));
|
||||||
|
if not ( APropInfo^.PropType^.Kind in [tkUString,tkWString] ) then
|
||||||
|
raise ERttiFilterException.CreateFmt('Invalid property data type. "%s" excpeted, got "%s".',['UnicodeString',GetEnumName(TypeInfo(TTypeKind),Ord(APropInfo^.PropType^.Kind))]);
|
||||||
|
inherited Create(APropInfo,AOperation);
|
||||||
|
FComparedValue := AComparedValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TRttiExpUnicodeStringNodeItem.Evaluate(
|
||||||
|
AInstance: TRttiFilterCreatorTarget
|
||||||
|
): Boolean;
|
||||||
|
begin
|
||||||
|
case Operation of
|
||||||
|
sfoEqualCaseSensitive : Result := ( GetUnicodeStrProp(AInstance,PropInfo) = ComparedValue );
|
||||||
|
sfoEqualCaseInsensitive : Result := ( LowerCase(GetUnicodeStrProp(AInstance,PropInfo)) = LowerCase(ComparedValue));
|
||||||
|
sfoNotEqual : Result := not SameText(GetUnicodeStrProp(AInstance,PropInfo),ComparedValue);
|
||||||
|
else
|
||||||
|
Assert(False);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$ENDIF WST_UNICODESTRING}
|
||||||
|
|
||||||
{ TRttiExpEnumNodeItem }
|
{ TRttiExpEnumNodeItem }
|
||||||
|
|
||||||
constructor TRttiExpEnumNodeItem.Create(
|
constructor TRttiExpEnumNodeItem.Create(
|
||||||
|
Reference in New Issue
Block a user