Added: testing for expected items
This commit is contained in:
parent
24ce12fdc5
commit
3df5f92709
@ -35,7 +35,6 @@ object MainForm: TMainForm
|
||||
AddQuotes = False
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
TabOrder = 0
|
||||
Text = 'F:\XTxXSD\Dealer.xsd'
|
||||
end
|
||||
object gbOutput: TGroupBox
|
||||
Left = 8
|
||||
@ -94,8 +93,9 @@ object MainForm: TMainForm
|
||||
Width = 321
|
||||
Height = 21
|
||||
AddQuotes = False
|
||||
DialogKind = dkSave
|
||||
DialogOptions = [ofOverwritePrompt, ofHideReadOnly]
|
||||
TabOrder = 0
|
||||
Text = 'F:\XTxXSD\Output\xml_Offerte.pas'
|
||||
end
|
||||
end
|
||||
object spFolder: TJvStandardPage
|
||||
|
@ -58,8 +58,6 @@ uses
|
||||
procedure TMainForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
plOutput.ActivePageIndex := 0;
|
||||
btnGenerate.Click;
|
||||
ModalResult := mrCancel;
|
||||
end;
|
||||
|
||||
|
||||
|
20
Tests/Data/01. Basic simple and complex types.xsd
Normal file
20
Tests/Data/01. Basic simple and complex types.xsd
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- edited with XMLSpy v2007 sp1 (http://www.altova.com) by M. van Renswoude (X²Software) -->
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
<xs:element name="TestElement">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Simple test element</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="SimpleType" type="xs:integer"/>
|
||||
<xs:element name="ComplexType" type="TestComplexType"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:complexType name="TestComplexType">
|
||||
<xs:sequence>
|
||||
<xs:element name="AnotherSimpleType" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
24
Tests/Data/01. Basic simple and complex types_expected.xml
Normal file
24
Tests/Data/01. Basic simple and complex types_expected.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<DataBindingResult xsi:noNamespaceSchemaLocation="F:\Archive\2007\XMLDataBinding\Tests\XSD\DataBindingResult.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Schemas>
|
||||
<Schema>
|
||||
<Name>01. Basic simple and complex types</Name>
|
||||
<Items>
|
||||
<Item>
|
||||
<ItemType>Interface</ItemType>
|
||||
<Name>TestElement</Name>
|
||||
<Interface>
|
||||
<InterfaceType>Interface</InterfaceType>
|
||||
</Interface>
|
||||
</Item>
|
||||
<Item>
|
||||
<ItemType>Interface</ItemType>
|
||||
<Name>TestComplexType</Name>
|
||||
<Interface>
|
||||
<InterfaceType>ComplexType</InterfaceType>
|
||||
</Interface>
|
||||
</Item>
|
||||
</Items>
|
||||
</Schema>
|
||||
</Schemas>
|
||||
</DataBindingResult>
|
391
Tests/Source/DataBindingResultXML.pas
Normal file
391
Tests/Source/DataBindingResultXML.pas
Normal file
@ -0,0 +1,391 @@
|
||||
|
||||
{****************************************************************************************}
|
||||
{ }
|
||||
{ XML Data Binding }
|
||||
{ }
|
||||
{ Generated on: 10-3-2008 20:12:45 }
|
||||
{ Generated from: F:\Archive\2007\XMLDataBinding\Tests\XSD\DataBindingResult.xsd }
|
||||
{ }
|
||||
{****************************************************************************************}
|
||||
|
||||
unit DataBindingResultXML;
|
||||
|
||||
interface
|
||||
|
||||
uses xmldom, XMLDoc, XMLIntf;
|
||||
|
||||
type
|
||||
|
||||
{ Forward Decls }
|
||||
|
||||
IXMLDataBindingResult = interface;
|
||||
IXMLSchemas = interface;
|
||||
IXMLSchema = interface;
|
||||
IXMLItems = interface;
|
||||
IXMLItem = interface;
|
||||
IXMLInterface_ = interface;
|
||||
IXMLCollection = interface;
|
||||
IXMLEnumeration = interface;
|
||||
|
||||
{ IXMLDataBindingResult }
|
||||
|
||||
IXMLDataBindingResult = interface(IXMLNode)
|
||||
['{B62DB507-8C4B-4966-BE94-F862B6546389}']
|
||||
{ Property Accessors }
|
||||
function Get_Schemas: IXMLSchemas;
|
||||
{ Methods & Properties }
|
||||
property Schemas: IXMLSchemas read Get_Schemas;
|
||||
end;
|
||||
|
||||
{ IXMLSchemas }
|
||||
|
||||
IXMLSchemas = interface(IXMLNodeCollection)
|
||||
['{EBDC76EA-3887-4479-8359-2D8038878707}']
|
||||
{ Property Accessors }
|
||||
function Get_Schema(Index: Integer): IXMLSchema;
|
||||
{ Methods & Properties }
|
||||
function Add: IXMLSchema;
|
||||
function Insert(const Index: Integer): IXMLSchema;
|
||||
property Schema[Index: Integer]: IXMLSchema read Get_Schema; default;
|
||||
end;
|
||||
|
||||
{ IXMLSchema }
|
||||
|
||||
IXMLSchema = interface(IXMLNode)
|
||||
['{6C82BA3F-537E-4112-BE1E-85B50482D4C1}']
|
||||
{ Property Accessors }
|
||||
function Get_Name: WideString;
|
||||
function Get_Items: IXMLItems;
|
||||
procedure Set_Name(Value: WideString);
|
||||
{ Methods & Properties }
|
||||
property Name: WideString read Get_Name write Set_Name;
|
||||
property Items: IXMLItems read Get_Items;
|
||||
end;
|
||||
|
||||
{ IXMLItems }
|
||||
|
||||
IXMLItems = interface(IXMLNodeCollection)
|
||||
['{4A1633BF-D402-4A8B-8DA2-0C7E06EE899F}']
|
||||
{ Property Accessors }
|
||||
function Get_Item(Index: Integer): IXMLItem;
|
||||
{ Methods & Properties }
|
||||
function Add: IXMLItem;
|
||||
function Insert(const Index: Integer): IXMLItem;
|
||||
property Item[Index: Integer]: IXMLItem read Get_Item; default;
|
||||
end;
|
||||
|
||||
{ IXMLItem }
|
||||
|
||||
IXMLItem = interface(IXMLNode)
|
||||
['{934648C4-4E29-4F45-B2AF-2BDC0B82A80A}']
|
||||
{ Property Accessors }
|
||||
function Get_ItemType: WideString;
|
||||
function Get_Name: WideString;
|
||||
function Get_Interface_: IXMLInterface_;
|
||||
function Get_Collection: IXMLCollection;
|
||||
function Get_Enumeration: IXMLEnumeration;
|
||||
procedure Set_ItemType(Value: WideString);
|
||||
procedure Set_Name(Value: WideString);
|
||||
{ Methods & Properties }
|
||||
property ItemType: WideString read Get_ItemType write Set_ItemType;
|
||||
property Name: WideString read Get_Name write Set_Name;
|
||||
property Interface_: IXMLInterface_ read Get_Interface_;
|
||||
property Collection: IXMLCollection read Get_Collection;
|
||||
property Enumeration: IXMLEnumeration read Get_Enumeration;
|
||||
end;
|
||||
|
||||
{ IXMLInterface_ }
|
||||
|
||||
IXMLInterface_ = interface(IXMLNode)
|
||||
['{F480A9C8-0B74-4CB7-A26C-C66A9ACA533B}']
|
||||
end;
|
||||
|
||||
{ IXMLCollection }
|
||||
|
||||
IXMLCollection = interface(IXMLNode)
|
||||
['{0D31D0E8-EE5F-4804-86F3-C3B3CA271F79}']
|
||||
{ Property Accessors }
|
||||
function Get_ItemName: WideString;
|
||||
procedure Set_ItemName(Value: WideString);
|
||||
{ Methods & Properties }
|
||||
property ItemName: WideString read Get_ItemName write Set_ItemName;
|
||||
end;
|
||||
|
||||
{ IXMLEnumeration }
|
||||
|
||||
IXMLEnumeration = interface(IXMLNode)
|
||||
['{3E1E8C1C-073B-4860-AC03-23EF7954C13D}']
|
||||
end;
|
||||
|
||||
{ Forward Decls }
|
||||
|
||||
TXMLDataBindingResult = class;
|
||||
TXMLSchemas = class;
|
||||
TXMLSchema = class;
|
||||
TXMLItems = class;
|
||||
TXMLItem = class;
|
||||
TXMLInterface_ = class;
|
||||
TXMLCollection = class;
|
||||
TXMLEnumeration = class;
|
||||
|
||||
{ TXMLDataBindingResult }
|
||||
|
||||
TXMLDataBindingResult = class(TXMLNode, IXMLDataBindingResult)
|
||||
protected
|
||||
{ IXMLDataBindingResult }
|
||||
function Get_Schemas: IXMLSchemas;
|
||||
public
|
||||
procedure AfterConstruction; override;
|
||||
end;
|
||||
|
||||
{ TXMLSchemas }
|
||||
|
||||
TXMLSchemas = class(TXMLNodeCollection, IXMLSchemas)
|
||||
protected
|
||||
{ IXMLSchemas }
|
||||
function Get_Schema(Index: Integer): IXMLSchema;
|
||||
function Add: IXMLSchema;
|
||||
function Insert(const Index: Integer): IXMLSchema;
|
||||
public
|
||||
procedure AfterConstruction; override;
|
||||
end;
|
||||
|
||||
{ TXMLSchema }
|
||||
|
||||
TXMLSchema = class(TXMLNode, IXMLSchema)
|
||||
protected
|
||||
{ IXMLSchema }
|
||||
function Get_Name: WideString;
|
||||
function Get_Items: IXMLItems;
|
||||
procedure Set_Name(Value: WideString);
|
||||
public
|
||||
procedure AfterConstruction; override;
|
||||
end;
|
||||
|
||||
{ TXMLItems }
|
||||
|
||||
TXMLItems = class(TXMLNodeCollection, IXMLItems)
|
||||
protected
|
||||
{ IXMLItems }
|
||||
function Get_Item(Index: Integer): IXMLItem;
|
||||
function Add: IXMLItem;
|
||||
function Insert(const Index: Integer): IXMLItem;
|
||||
public
|
||||
procedure AfterConstruction; override;
|
||||
end;
|
||||
|
||||
{ TXMLItem }
|
||||
|
||||
TXMLItem = class(TXMLNode, IXMLItem)
|
||||
protected
|
||||
{ IXMLItem }
|
||||
function Get_ItemType: WideString;
|
||||
function Get_Name: WideString;
|
||||
function Get_Interface_: IXMLInterface_;
|
||||
function Get_Collection: IXMLCollection;
|
||||
function Get_Enumeration: IXMLEnumeration;
|
||||
procedure Set_ItemType(Value: WideString);
|
||||
procedure Set_Name(Value: WideString);
|
||||
public
|
||||
procedure AfterConstruction; override;
|
||||
end;
|
||||
|
||||
{ TXMLInterface_ }
|
||||
|
||||
TXMLInterface_ = class(TXMLNode, IXMLInterface_)
|
||||
protected
|
||||
{ IXMLInterface_ }
|
||||
end;
|
||||
|
||||
{ TXMLCollection }
|
||||
|
||||
TXMLCollection = class(TXMLNode, IXMLCollection)
|
||||
protected
|
||||
{ IXMLCollection }
|
||||
function Get_ItemName: WideString;
|
||||
procedure Set_ItemName(Value: WideString);
|
||||
end;
|
||||
|
||||
{ TXMLEnumeration }
|
||||
|
||||
TXMLEnumeration = class(TXMLNode, IXMLEnumeration)
|
||||
protected
|
||||
{ IXMLEnumeration }
|
||||
end;
|
||||
|
||||
{ Global Functions }
|
||||
|
||||
function GetDataBindingResult(Doc: IXMLDocument): IXMLDataBindingResult;
|
||||
function LoadDataBindingResult(const FileName: WideString): IXMLDataBindingResult;
|
||||
function NewDataBindingResult: IXMLDataBindingResult;
|
||||
|
||||
const
|
||||
TargetNamespace = '';
|
||||
|
||||
implementation
|
||||
|
||||
{ Global Functions }
|
||||
|
||||
function GetDataBindingResult(Doc: IXMLDocument): IXMLDataBindingResult;
|
||||
begin
|
||||
Result := Doc.GetDocBinding('DataBindingResult', TXMLDataBindingResult, TargetNamespace) as IXMLDataBindingResult;
|
||||
end;
|
||||
|
||||
function LoadDataBindingResult(const FileName: WideString): IXMLDataBindingResult;
|
||||
begin
|
||||
Result := LoadXMLDocument(FileName).GetDocBinding('DataBindingResult', TXMLDataBindingResult, TargetNamespace) as IXMLDataBindingResult;
|
||||
end;
|
||||
|
||||
function NewDataBindingResult: IXMLDataBindingResult;
|
||||
begin
|
||||
Result := NewXMLDocument.GetDocBinding('DataBindingResult', TXMLDataBindingResult, TargetNamespace) as IXMLDataBindingResult;
|
||||
end;
|
||||
|
||||
{ TXMLDataBindingResult }
|
||||
|
||||
procedure TXMLDataBindingResult.AfterConstruction;
|
||||
begin
|
||||
RegisterChildNode('Schemas', TXMLSchemas);
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TXMLDataBindingResult.Get_Schemas: IXMLSchemas;
|
||||
begin
|
||||
Result := ChildNodes['Schemas'] as IXMLSchemas;
|
||||
end;
|
||||
|
||||
{ TXMLSchemas }
|
||||
|
||||
procedure TXMLSchemas.AfterConstruction;
|
||||
begin
|
||||
RegisterChildNode('Schema', TXMLSchema);
|
||||
ItemTag := 'Schema';
|
||||
ItemInterface := IXMLSchema;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TXMLSchemas.Get_Schema(Index: Integer): IXMLSchema;
|
||||
begin
|
||||
Result := List[Index] as IXMLSchema;
|
||||
end;
|
||||
|
||||
function TXMLSchemas.Add: IXMLSchema;
|
||||
begin
|
||||
Result := AddItem(-1) as IXMLSchema;
|
||||
end;
|
||||
|
||||
function TXMLSchemas.Insert(const Index: Integer): IXMLSchema;
|
||||
begin
|
||||
Result := AddItem(Index) as IXMLSchema;
|
||||
end;
|
||||
|
||||
{ TXMLSchema }
|
||||
|
||||
procedure TXMLSchema.AfterConstruction;
|
||||
begin
|
||||
RegisterChildNode('Items', TXMLItems);
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TXMLSchema.Get_Name: WideString;
|
||||
begin
|
||||
Result := ChildNodes['Name'].Text;
|
||||
end;
|
||||
|
||||
procedure TXMLSchema.Set_Name(Value: WideString);
|
||||
begin
|
||||
ChildNodes['Name'].NodeValue := Value;
|
||||
end;
|
||||
|
||||
function TXMLSchema.Get_Items: IXMLItems;
|
||||
begin
|
||||
Result := ChildNodes['Items'] as IXMLItems;
|
||||
end;
|
||||
|
||||
{ TXMLItems }
|
||||
|
||||
procedure TXMLItems.AfterConstruction;
|
||||
begin
|
||||
RegisterChildNode('Item', TXMLItem);
|
||||
ItemTag := 'Item';
|
||||
ItemInterface := IXMLItem;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TXMLItems.Get_Item(Index: Integer): IXMLItem;
|
||||
begin
|
||||
Result := List[Index] as IXMLItem;
|
||||
end;
|
||||
|
||||
function TXMLItems.Add: IXMLItem;
|
||||
begin
|
||||
Result := AddItem(-1) as IXMLItem;
|
||||
end;
|
||||
|
||||
function TXMLItems.Insert(const Index: Integer): IXMLItem;
|
||||
begin
|
||||
Result := AddItem(Index) as IXMLItem;
|
||||
end;
|
||||
|
||||
{ TXMLItem }
|
||||
|
||||
procedure TXMLItem.AfterConstruction;
|
||||
begin
|
||||
RegisterChildNode('Interface', TXMLInterface_);
|
||||
RegisterChildNode('Collection', TXMLCollection);
|
||||
RegisterChildNode('Enumeration', TXMLEnumeration);
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TXMLItem.Get_ItemType: WideString;
|
||||
begin
|
||||
Result := ChildNodes['ItemType'].Text;
|
||||
end;
|
||||
|
||||
procedure TXMLItem.Set_ItemType(Value: WideString);
|
||||
begin
|
||||
ChildNodes['ItemType'].NodeValue := Value;
|
||||
end;
|
||||
|
||||
function TXMLItem.Get_Name: WideString;
|
||||
begin
|
||||
Result := ChildNodes['Name'].Text;
|
||||
end;
|
||||
|
||||
procedure TXMLItem.Set_Name(Value: WideString);
|
||||
begin
|
||||
ChildNodes['Name'].NodeValue := Value;
|
||||
end;
|
||||
|
||||
function TXMLItem.Get_Interface_: IXMLInterface_;
|
||||
begin
|
||||
Result := ChildNodes['Interface'] as IXMLInterface_;
|
||||
end;
|
||||
|
||||
function TXMLItem.Get_Collection: IXMLCollection;
|
||||
begin
|
||||
Result := ChildNodes['Collection'] as IXMLCollection;
|
||||
end;
|
||||
|
||||
function TXMLItem.Get_Enumeration: IXMLEnumeration;
|
||||
begin
|
||||
Result := ChildNodes['Enumeration'] as IXMLEnumeration;
|
||||
end;
|
||||
|
||||
{ TXMLInterface_ }
|
||||
|
||||
{ TXMLCollection }
|
||||
|
||||
function TXMLCollection.Get_ItemName: WideString;
|
||||
begin
|
||||
Result := ChildNodes['ItemName'].Text;
|
||||
end;
|
||||
|
||||
procedure TXMLCollection.Set_ItemName(Value: WideString);
|
||||
begin
|
||||
ChildNodes['ItemName'].NodeValue := Value;
|
||||
end;
|
||||
|
||||
{ TXMLEnumeration }
|
||||
|
||||
end.
|
@ -2,36 +2,205 @@ unit ObjectMappingTests;
|
||||
|
||||
interface
|
||||
uses
|
||||
TestFramework;
|
||||
TestFramework,
|
||||
|
||||
DataBindingResultXML,
|
||||
XMLDataBindingGenerator;
|
||||
|
||||
|
||||
type
|
||||
TTestXMLDataBindingGenerator = class(TXMLDataBindingGenerator)
|
||||
protected
|
||||
procedure GenerateDataBinding(); override;
|
||||
end;
|
||||
|
||||
|
||||
TObjectMappingTests = class(TAbstractTest, ITest)
|
||||
private
|
||||
FFileName: String;
|
||||
protected
|
||||
procedure RunTest(testResult: TTestResult); override;
|
||||
|
||||
procedure CompareSchemas(ATestResult: TTestResult; AGenerator: TTestXMLDataBindingGenerator; AResult: IXMLDataBindingResult);
|
||||
procedure CompareItems(ATestResult: TTestResult; AGeneratorSchema: TXMLDataBindingSchema; AResultSchema: IXMLSchema);
|
||||
|
||||
property FileName: String read FFileName;
|
||||
public
|
||||
class function Suite: ITestSuite;
|
||||
constructor Create(const AFileName: String);
|
||||
|
||||
class function Suite(): ITestSuite;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
uses
|
||||
Contnrs,
|
||||
SysUtils,
|
||||
|
||||
X2UtApp;
|
||||
|
||||
|
||||
const
|
||||
ExpectedExtension = '_expected.xml';
|
||||
|
||||
|
||||
{ TObjectMappingTests }
|
||||
class function TObjectMappingTests.Suite: ITestSuite;
|
||||
class function TObjectMappingTests.Suite(): ITestSuite;
|
||||
var
|
||||
basePath: String;
|
||||
fileInfo: TSearchRec;
|
||||
|
||||
begin
|
||||
Result := TTestSuite.Create(Self.ClassName);
|
||||
|
||||
{ Add tests for all .xsd files which have a corresponding .expected file }
|
||||
Result.AddTest(Self.Create('Test'));
|
||||
basePath := App.Path + 'Tests\Data\';
|
||||
|
||||
if FindFirst(basePath + '*.xsd', faAnyFile, fileInfo) = 0 then
|
||||
begin
|
||||
repeat
|
||||
if FileExists(basePath + ChangeFileExt(fileInfo.Name, ExpectedExtension)) then
|
||||
begin
|
||||
Result.AddTest(Self.Create(basePath + fileInfo.Name));
|
||||
end;
|
||||
until FindNext(fileInfo) <> 0;
|
||||
|
||||
SysUtils.FindClose(fileInfo);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
constructor TObjectMappingTests.Create(const AFileName: String);
|
||||
begin
|
||||
inherited Create(ChangeFileExt(ExtractFileName(AFileName), ''));
|
||||
|
||||
FFileName := AFileName;
|
||||
end;
|
||||
|
||||
|
||||
procedure TObjectMappingTests.RunTest(testResult: TTestResult);
|
||||
var
|
||||
generator: TTestXMLDataBindingGenerator;
|
||||
expectedResult: IXMLDataBindingResult;
|
||||
|
||||
begin
|
||||
testResult.AddFailure(Self, nil, 'Oeps!');
|
||||
generator := TTestXMLDataBindingGenerator.Create();
|
||||
try
|
||||
generator.Execute(FileName);
|
||||
|
||||
expectedResult := LoadDataBindingResult(ChangeFileExt(FileName, ExpectedExtension));
|
||||
CompareSchemas(testResult, generator, expectedResult);
|
||||
finally
|
||||
FreeAndNil(generator);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TObjectMappingTests.CompareSchemas(ATestResult: TTestResult; AGenerator: TTestXMLDataBindingGenerator; AResult: IXMLDataBindingResult);
|
||||
var
|
||||
handled: TObjectList;
|
||||
schemaIndex: Integer;
|
||||
resultSchema: IXMLSchema;
|
||||
bindingSchema: TXMLDataBindingSchema;
|
||||
|
||||
begin
|
||||
handled := TObjectList.Create(False);
|
||||
try
|
||||
{ Iterate expected schemas }
|
||||
for schemaIndex := 0 to Pred(AResult.Schemas.Count) do
|
||||
begin
|
||||
resultSchema := AResult.Schemas[schemaIndex];
|
||||
bindingSchema := AGenerator.FindSchema(resultSchema.Name);
|
||||
|
||||
if Assigned(bindingSchema) then
|
||||
begin
|
||||
handled.Add(bindingSchema);
|
||||
CompareItems(ATestResult, bindingSchema, resultSchema);
|
||||
end else
|
||||
ATestResult.AddFailure(Self, nil, Format('Schema "%s" expected', [resultSchema.Name]));
|
||||
end;
|
||||
|
||||
{ Find unexpected schemas }
|
||||
for schemaIndex := 0 to Pred(AGenerator.SchemaCount) do
|
||||
if handled.IndexOf(AGenerator.Schemas[schemaIndex]) = -1 then
|
||||
begin
|
||||
ATestResult.AddFailure(Self, nil, Format('Schema "%s" not expected', [AGenerator.Schemas[schemaIndex].SchemaName]));
|
||||
end;
|
||||
finally
|
||||
FreeAndNil(handled);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TObjectMappingTests.CompareItems(ATestResult: TTestResult; AGeneratorSchema: TXMLDataBindingSchema; AResultSchema: IXMLSchema);
|
||||
|
||||
function FindItem(const AName: String): TXMLDataBindingItem;
|
||||
var
|
||||
itemIndex: Integer;
|
||||
|
||||
begin
|
||||
Result := nil;
|
||||
|
||||
for itemIndex := 0 to Pred(AGeneratorSchema.ItemCount) do
|
||||
if (AGeneratorSchema.Items[itemIndex].Name = AName) and
|
||||
(AGeneratorSchema.Items[itemIndex].ItemType <> itForward) then
|
||||
begin
|
||||
Result := AGeneratorSchema.Items[itemIndex];
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
var
|
||||
handled: TObjectList;
|
||||
itemIndex: Integer;
|
||||
resultItem: IXMLItem;
|
||||
bindingItem: TXMLDataBindingItem;
|
||||
|
||||
begin
|
||||
handled := TObjectList.Create(False);
|
||||
try
|
||||
{ Iterate expected schemas }
|
||||
for itemIndex := 0 to Pred(AResultSchema.Items.Count) do
|
||||
begin
|
||||
resultItem := AResultSchema.Items[itemIndex];
|
||||
bindingItem := FindItem(resultItem.Name);
|
||||
|
||||
if Assigned(bindingItem) then
|
||||
begin
|
||||
handled.Add(bindingItem);
|
||||
// CompareItems(ATestResult, bindingSchema, resultSchema);
|
||||
end else
|
||||
ATestResult.AddFailure(Self, nil, Format('Schema "%s": item "%s" expected',
|
||||
[AGeneratorSchema.SchemaName, resultItem.Name]));
|
||||
end;
|
||||
|
||||
{ Find unexpected schemas }
|
||||
for itemIndex := 0 to Pred(AGeneratorSchema.ItemCount) do
|
||||
begin
|
||||
bindingItem := AGeneratorSchema.Items[itemIndex];
|
||||
|
||||
if bindingItem.ItemType <> itForward then
|
||||
begin
|
||||
if handled.IndexOf(bindingItem) = -1 then
|
||||
begin
|
||||
ATestResult.AddFailure(Self, nil, Format('Schema "%s": item "%s" not expected',
|
||||
[AGeneratorSchema.SchemaName,
|
||||
AGeneratorSchema.Items[itemIndex].Name]));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
FreeAndNil(handled);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ TTestXMLDataBindingGenerator }
|
||||
procedure TTestXMLDataBindingGenerator.GenerateDataBinding();
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterTest(TObjectMappingTests.Suite);
|
||||
|
170
Tests/X2XMLDataBindingTests.bdsproj
Normal file
170
Tests/X2XMLDataBindingTests.bdsproj
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<BorlandProject>
|
||||
<PersonalityInfo>
|
||||
<Option>
|
||||
<Option Name="Personality">Delphi.Personality</Option>
|
||||
<Option Name="ProjectType">VCLApplication</Option>
|
||||
<Option Name="Version">1.0</Option>
|
||||
<Option Name="GUID">{07A9AB1C-8480-4D56-AF06-8D9333971361}</Option>
|
||||
</Option>
|
||||
</PersonalityInfo>
|
||||
<Delphi.Personality>
|
||||
<Source>
|
||||
<Source Name="MainSource">X2XMLDataBindingTests.dpr</Source>
|
||||
</Source>
|
||||
<FileVersion>
|
||||
<FileVersion Name="Version">7.0</FileVersion>
|
||||
</FileVersion>
|
||||
<Compiler>
|
||||
<Compiler Name="A">8</Compiler>
|
||||
<Compiler Name="B">0</Compiler>
|
||||
<Compiler Name="C">0</Compiler>
|
||||
<Compiler Name="D">1</Compiler>
|
||||
<Compiler Name="E">0</Compiler>
|
||||
<Compiler Name="F">0</Compiler>
|
||||
<Compiler Name="G">1</Compiler>
|
||||
<Compiler Name="H">1</Compiler>
|
||||
<Compiler Name="I">1</Compiler>
|
||||
<Compiler Name="J">0</Compiler>
|
||||
<Compiler Name="K">0</Compiler>
|
||||
<Compiler Name="L">1</Compiler>
|
||||
<Compiler Name="M">0</Compiler>
|
||||
<Compiler Name="N">1</Compiler>
|
||||
<Compiler Name="O">0</Compiler>
|
||||
<Compiler Name="P">1</Compiler>
|
||||
<Compiler Name="Q">0</Compiler>
|
||||
<Compiler Name="R">0</Compiler>
|
||||
<Compiler Name="S">0</Compiler>
|
||||
<Compiler Name="T">0</Compiler>
|
||||
<Compiler Name="U">0</Compiler>
|
||||
<Compiler Name="V">1</Compiler>
|
||||
<Compiler Name="W">0</Compiler>
|
||||
<Compiler Name="X">1</Compiler>
|
||||
<Compiler Name="Y">2</Compiler>
|
||||
<Compiler Name="Z">1</Compiler>
|
||||
<Compiler Name="ShowHints">True</Compiler>
|
||||
<Compiler Name="ShowWarnings">True</Compiler>
|
||||
<Compiler Name="UnitAliases">WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;</Compiler>
|
||||
<Compiler Name="NamespacePrefix"></Compiler>
|
||||
<Compiler Name="GenerateDocumentation">False</Compiler>
|
||||
<Compiler Name="DefaultNamespace"></Compiler>
|
||||
<Compiler Name="SymbolDeprecated">True</Compiler>
|
||||
<Compiler Name="SymbolLibrary">True</Compiler>
|
||||
<Compiler Name="SymbolPlatform">True</Compiler>
|
||||
<Compiler Name="SymbolExperimental">True</Compiler>
|
||||
<Compiler Name="UnitLibrary">True</Compiler>
|
||||
<Compiler Name="UnitPlatform">True</Compiler>
|
||||
<Compiler Name="UnitDeprecated">True</Compiler>
|
||||
<Compiler Name="UnitExperimental">True</Compiler>
|
||||
<Compiler Name="HResultCompat">True</Compiler>
|
||||
<Compiler Name="HidingMember">True</Compiler>
|
||||
<Compiler Name="HiddenVirtual">True</Compiler>
|
||||
<Compiler Name="Garbage">True</Compiler>
|
||||
<Compiler Name="BoundsError">True</Compiler>
|
||||
<Compiler Name="ZeroNilCompat">True</Compiler>
|
||||
<Compiler Name="StringConstTruncated">True</Compiler>
|
||||
<Compiler Name="ForLoopVarVarPar">True</Compiler>
|
||||
<Compiler Name="TypedConstVarPar">True</Compiler>
|
||||
<Compiler Name="AsgToTypedConst">True</Compiler>
|
||||
<Compiler Name="CaseLabelRange">True</Compiler>
|
||||
<Compiler Name="ForVariable">True</Compiler>
|
||||
<Compiler Name="ConstructingAbstract">True</Compiler>
|
||||
<Compiler Name="ComparisonFalse">True</Compiler>
|
||||
<Compiler Name="ComparisonTrue">True</Compiler>
|
||||
<Compiler Name="ComparingSignedUnsigned">True</Compiler>
|
||||
<Compiler Name="CombiningSignedUnsigned">True</Compiler>
|
||||
<Compiler Name="UnsupportedConstruct">True</Compiler>
|
||||
<Compiler Name="FileOpen">True</Compiler>
|
||||
<Compiler Name="FileOpenUnitSrc">True</Compiler>
|
||||
<Compiler Name="BadGlobalSymbol">True</Compiler>
|
||||
<Compiler Name="DuplicateConstructorDestructor">True</Compiler>
|
||||
<Compiler Name="InvalidDirective">True</Compiler>
|
||||
<Compiler Name="PackageNoLink">True</Compiler>
|
||||
<Compiler Name="PackageThreadVar">True</Compiler>
|
||||
<Compiler Name="ImplicitImport">True</Compiler>
|
||||
<Compiler Name="HPPEMITIgnored">True</Compiler>
|
||||
<Compiler Name="NoRetVal">True</Compiler>
|
||||
<Compiler Name="UseBeforeDef">True</Compiler>
|
||||
<Compiler Name="ForLoopVarUndef">True</Compiler>
|
||||
<Compiler Name="UnitNameMismatch">True</Compiler>
|
||||
<Compiler Name="NoCFGFileFound">True</Compiler>
|
||||
<Compiler Name="ImplicitVariants">True</Compiler>
|
||||
<Compiler Name="UnicodeToLocale">True</Compiler>
|
||||
<Compiler Name="LocaleToUnicode">True</Compiler>
|
||||
<Compiler Name="ImagebaseMultiple">True</Compiler>
|
||||
<Compiler Name="SuspiciousTypecast">True</Compiler>
|
||||
<Compiler Name="PrivatePropAccessor">True</Compiler>
|
||||
<Compiler Name="UnsafeType">False</Compiler>
|
||||
<Compiler Name="UnsafeCode">False</Compiler>
|
||||
<Compiler Name="UnsafeCast">False</Compiler>
|
||||
<Compiler Name="OptionTruncated">True</Compiler>
|
||||
<Compiler Name="WideCharReduced">True</Compiler>
|
||||
<Compiler Name="DuplicatesIgnored">True</Compiler>
|
||||
<Compiler Name="UnitInitSeq">True</Compiler>
|
||||
<Compiler Name="LocalPInvoke">True</Compiler>
|
||||
<Compiler Name="MessageDirective">True</Compiler>
|
||||
<Compiler Name="CodePage"></Compiler>
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Linker Name="MapFile">3</Linker>
|
||||
<Linker Name="OutputObjs">0</Linker>
|
||||
<Linker Name="GenerateHpps">False</Linker>
|
||||
<Linker Name="ConsoleApp">1</Linker>
|
||||
<Linker Name="DebugInfo">False</Linker>
|
||||
<Linker Name="RemoteSymbols">False</Linker>
|
||||
<Linker Name="GenerateDRC">False</Linker>
|
||||
<Linker Name="MinStackSize">16384</Linker>
|
||||
<Linker Name="MaxStackSize">1048576</Linker>
|
||||
<Linker Name="ImageBase">4194304</Linker>
|
||||
<Linker Name="ExeDescription"></Linker>
|
||||
</Linker>
|
||||
<Directories>
|
||||
<Directories Name="OutputDir">..\</Directories>
|
||||
<Directories Name="UnitOutputDir">..\Lib</Directories>
|
||||
<Directories Name="PackageDLLOutputDir"></Directories>
|
||||
<Directories Name="PackageDCPOutputDir"></Directories>
|
||||
<Directories Name="SearchPath"></Directories>
|
||||
<Directories Name="Packages">vcl;rtl;vclx;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;vcldb;dsnapcon;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;CLXIB;ibxpress;VCLIB;teeui;teedb;tee;dss;vclactnband;vclshlctrls;dclOfficeXP;Indy70;cxLibraryVCLD7;dxBarD7;dxComnD7;dxBarDBNavD7;dxBarExtDBItemsD7;dxBarExtItemsD7;dxDockingD7;dxsbD7;cxEditorsVCLD7;dxThemeD7;cxDataD7;cxExtEditorsVCLD7;cxPageControlVCLD7;cxGridVCLD7;cxSchedulerVCLD7;cxTreeListVCLD7;cxVerticalGridVCLD7;cxSpreadSheetVCLD7;dxNavBarD7;cxWebD7;cxWebPascalScriptD7;cxWebSnapD7;cxWebTeeChartD7;dxMasterViewD7;dxmdsD7;dxdbtrD7;dxtrmdD7;dxorgcD7;dxdborD7;dxFlowChartD7;dxLayoutControlD7;dxLayoutControlcxEditAdaptersD7;dxPSCoreD7;dxPSTeeChartD7;dxPsPrVwAdvD7;dxPSLnksD7;dxPSdxOCLnkD7;dxPSdxMVLnkD7;dxPSdxLCLnkD7;dxPSdxFCLnkD7;dxPSdxDBTVLnkD7;dxPSdxDBOCLnkD7;dxPSDBTeeChartD7;dxPScxCommonD7;dxPScxTLLnkD7;dxPScxSSLnkD7;dxPScxPCProdD7;dxPScxGridLnkD7;dxPScxExtCommonD7;dxPScxVGridLnkD7;fo_d7;xtx_d7;Rave50CLX;Rave50VCL;pngimaged7;dxGDIPlusD7;UnRegDxPNG;unageneral_d7</Directories>
|
||||
<Directories Name="Conditionals"></Directories>
|
||||
<Directories Name="DebugSourceDirs"></Directories>
|
||||
<Directories Name="UsePackages">False</Directories>
|
||||
</Directories>
|
||||
<Parameters>
|
||||
<Parameters Name="RunParams"></Parameters>
|
||||
<Parameters Name="HostApplication"></Parameters>
|
||||
<Parameters Name="Launcher"></Parameters>
|
||||
<Parameters Name="UseLauncher">False</Parameters>
|
||||
<Parameters Name="DebugCWD"></Parameters>
|
||||
<Parameters Name="Debug Symbols Search Path"></Parameters>
|
||||
<Parameters Name="LoadAllSymbols">True</Parameters>
|
||||
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
|
||||
</Parameters>
|
||||
<VersionInfo>
|
||||
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
|
||||
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
||||
<VersionInfo Name="MajorVer">0</VersionInfo>
|
||||
<VersionInfo Name="MinorVer">0</VersionInfo>
|
||||
<VersionInfo Name="Release">0</VersionInfo>
|
||||
<VersionInfo Name="Build">0</VersionInfo>
|
||||
<VersionInfo Name="Debug">False</VersionInfo>
|
||||
<VersionInfo Name="PreRelease">False</VersionInfo>
|
||||
<VersionInfo Name="Special">False</VersionInfo>
|
||||
<VersionInfo Name="Private">False</VersionInfo>
|
||||
<VersionInfo Name="DLL">False</VersionInfo>
|
||||
<VersionInfo Name="Locale">1043</VersionInfo>
|
||||
<VersionInfo Name="CodePage">1252</VersionInfo>
|
||||
</VersionInfo>
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileVersion">0.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductVersion"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
|
||||
</VersionInfoKeys>
|
||||
</Delphi.Personality>
|
||||
</BorlandProject>
|
@ -33,9 +33,9 @@
|
||||
-$M16384,1048576
|
||||
-K$00400000
|
||||
-E"..\"
|
||||
-N"..\Lib"
|
||||
-LE"c:\program files\borland\delphi7\Projects\Bpl"
|
||||
-LN"c:\program files\borland\delphi7\Projects\Bpl"
|
||||
-N0"..\Lib"
|
||||
-LE"C:\Documents and Settings\PsychoMark\My Documents\Borland Studio Projects\Bpl"
|
||||
-LN"C:\Documents and Settings\PsychoMark\My Documents\Borland Studio Projects\Bpl"
|
||||
-w-UNSAFE_TYPE
|
||||
-w-UNSAFE_CODE
|
||||
-w-UNSAFE_CAST
|
||||
|
@ -1,10 +1,15 @@
|
||||
program X2XMLDataBindingTests;
|
||||
|
||||
uses
|
||||
ActiveX,
|
||||
GUITestRunner,
|
||||
ObjectMappingTests in 'Source\ObjectMappingTests.pas';
|
||||
ObjectMappingTests in 'Source\ObjectMappingTests.pas',
|
||||
DataBindingResultXML in 'Source\DataBindingResultXML.pas',
|
||||
XMLDataBindingGenerator in '..\Units\XMLDataBindingGenerator.pas',
|
||||
XMLDataBindingHelpers in '..\Units\XMLDataBindingHelpers.pas';
|
||||
|
||||
begin
|
||||
CoInitialize(nil);
|
||||
RunRegisteredTests;
|
||||
end.
|
||||
|
||||
|
144
Tests/X2XMLDataBindingTests.mes
Normal file
144
Tests/X2XMLDataBindingTests.mes
Normal file
@ -0,0 +1,144 @@
|
||||
[GeneralSettings]
|
||||
HandleExceptions=0
|
||||
AppendMapFileToBinary=1
|
||||
NoOwnMadExceptSettings=0
|
||||
CheckFileCrc=1
|
||||
CheckForFrozenMainThread=0
|
||||
FreezeTimeout=60000
|
||||
AutomaticallySaveBugReport=0
|
||||
AutoSaveBugReportIfNotSent=1
|
||||
AutomaticallyMailBugReport=0
|
||||
AutoMailProgressBox=0
|
||||
CopyBugReportToClipboard=0
|
||||
SuspendAllRunningThreads=0
|
||||
ShowPleaseWaitBox=1
|
||||
PleaseWaitIcon=plwait1
|
||||
AutomaticallyContinueApplication=0
|
||||
AutomaticallyRestartApplication=0
|
||||
AutomaticallyCloseApplication=0
|
||||
MailAddress=
|
||||
SendInBackground=1
|
||||
Send32Icon=send321
|
||||
MailAsSmtpServer=0
|
||||
MailAsSmtpClient=0
|
||||
UploadViaHttp=0
|
||||
MailViaMapi=1
|
||||
MailViaMailto=1
|
||||
SmtpServer=
|
||||
SmtpPort=25
|
||||
SmtpAccount=
|
||||
SmtpPassword=
|
||||
HttpServer=
|
||||
HttpPort=80
|
||||
HttpAccount=
|
||||
HttpPassword=
|
||||
BugReportFile=bugreport.txt
|
||||
AttachBugReport=0
|
||||
AttachBugReportFile=1
|
||||
DeleteBugReportFile=1
|
||||
BugReportSendAs=bugreport.txt
|
||||
BugReportZip=
|
||||
ScreenShotDepth=0
|
||||
ScreenShotAppOnly=0
|
||||
ScreenShotSendAs=screenshot.png
|
||||
ScreenShotZip=
|
||||
AdditionalAttachments=
|
||||
AppendBugReports=1
|
||||
BugReportFileSize=100000
|
||||
DontSaveDuplicateExceptions=1
|
||||
DontSaveDuplicateFreezings=1
|
||||
DuplicateExceptionDefinition=1
|
||||
DuplicateFreezeDefinition=2
|
||||
ShowExceptionBox=1
|
||||
OkBtnText=&OK
|
||||
DetailsBtnText=&Details
|
||||
PleaseWaitTitle=Information
|
||||
PleaseWaitText=Please wait a moment...
|
||||
MailSubject=bug report
|
||||
MailBody=please find the bug report attached
|
||||
SendBoxTitle=Sending bug report...
|
||||
PrepareAttachMsg=Preparing attachments...
|
||||
MxLookupMsg=Searching for mail server...
|
||||
ConnectMsg=Connecting to server...
|
||||
AuthMsg=Authentication...
|
||||
SendMailMsg=Sending mail...
|
||||
FieldsMsg=Setting fields...
|
||||
SendAttachMsg=Sending attachments...
|
||||
SendFinalizeMsg=Finalizing...
|
||||
MailFailureMsg=Sorry, sending the bug report didn't work.
|
||||
VersionVariable=
|
||||
[ExceptionBox]
|
||||
ShowButtonMailBugReport=1
|
||||
ShowButtonSaveBugReport=0
|
||||
ShowButtonPrintBugReport=0
|
||||
ShowButtonShowBugReport=1
|
||||
ShowButtonContinueApplication=1
|
||||
ShowButtonRestartApplication=1
|
||||
ShowButtonCloseApplication=1
|
||||
IconButtonSendBugReport=send1
|
||||
IconButtonSaveBugReport=save1
|
||||
IconButtonPrintBugReport=print1
|
||||
IconButtonShowBugReport=show1
|
||||
IconButtonContinueApplication=continue1
|
||||
IconButtonCantContinueApplication=cantContinue1
|
||||
IconButtonRestartApplication=restart1
|
||||
IconButtonCloseApplication=close1
|
||||
FocusedButton=0
|
||||
SendAssistant=SendAssistant
|
||||
SaveAssistant=SaveAssistant
|
||||
PrintAssistant=PrintAssistant
|
||||
AutomaticallyShowBugReport=0
|
||||
NoOwnerDrawButtons=0
|
||||
BigExceptionIcon=big1
|
||||
TitleBar=%25appname%25
|
||||
ExceptionMessage=An error occurred in the application.
|
||||
FrozenMessage=The application seems to be frozen.
|
||||
BitFaultMsg=The file "%25modname%25" seems to be corrupt!
|
||||
MailBugReportText=send bug report
|
||||
SaveBugReportText=save bug report
|
||||
PrintBugReportText=print bug report
|
||||
ShowBugReportText=show bug report
|
||||
ContinueApplicationText=continue application
|
||||
RestartApplicationText=restart application
|
||||
CloseApplicationText=close application
|
||||
[BugReport]
|
||||
ListThreads=1
|
||||
ListModules=1
|
||||
ListHardware=1
|
||||
ShowCpuRegisters=1
|
||||
ShowStackDump=1
|
||||
Disassembly=1
|
||||
HideUglyItems=0
|
||||
ShowRelativeAddrs=1
|
||||
ShowRelativeLines=1
|
||||
FormatDisassembly=0
|
||||
LimitDisassembly=5
|
||||
EnabledPlugins=modules|processes|hardware
|
||||
[Filters]
|
||||
Filter1ExceptionClasses=EDBEditError
|
||||
Filter1DontCreateBugReport=1
|
||||
Filter1DontCreateScreenshot=1
|
||||
Filter1DontSuspendThreads=1
|
||||
Filter1DontCallHandlers=1
|
||||
Filter1ShowBox=3
|
||||
Filter1Assis=
|
||||
Filter2ExceptionClasses=
|
||||
Filter2DontCreateBugReport=0
|
||||
Filter2DontCreateScreenshot=0
|
||||
Filter2DontSuspendThreads=0
|
||||
Filter2DontCallHandlers=0
|
||||
Filter2ShowBox=0
|
||||
Filter2Assis=
|
||||
GeneralDontCreateBugReport=0
|
||||
GeneralDontCreateScreenshot=0
|
||||
GeneralDontSuspendThreads=0
|
||||
GeneralDontCallHandlers=0
|
||||
GeneralShowBox=0
|
||||
GeneralAssis=
|
||||
[Assistants]
|
||||
Assistant1=SendAssistant|Send Assistant|ContactForm|DetailsForm|ScrShotForm
|
||||
Assistant2=SaveAssistant|Save Assistant|ContactForm|DetailsForm
|
||||
Assistant3=PrintAssistant|Print Assistant|ContactForm|DetailsForm
|
||||
Forms1=TPF0%0eTMEContactForm%0bContactForm%07Message%0c%13%00%00%00Contact Information%08MinWidth%04%00%00%00%00%08OnAction%0c%1b%00%00%00madExcept.HandleContactForm%05Timer%04%00%00%00%00%00%09INVButton%0bContinueBtn%07Caption%0c%08%00%00%00Continue%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%07SkipBtn%07Caption%0c%04%00%00%00Skip%07Enabled%08%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%09CancelBtn%07Caption%0c%06%00%00%00Cancel%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%08INVLabel%06Label1%07Caption%0c%0a%00%00%00your name:%07Enabled%09%07Spacing%04%00%00%00%00%00%00%07INVEdit%08NameEdit%07Colored%09%07Enabled%09%05Lines%04%01%00%00%00%08Optional%09%0aOutputName%0c%0c%00%00%00contact name%0aOutputType%07%09nvoHeader%07Spacing%04%00%00%00%00%04Text%0c%00%00%00%00%05Valid%09%00%00%08INVLabel%06Label2%07Caption%0c%0b%00%00%00your email:%07Enabled%09%07Spacing%04%00%00%00%00%00%00%07INVEdit%09EmailEdit%07Colored%09%07Enabled%09%05Lines%04%01%00%00%00%08Optional%08%0aOutputName%0c%0d%00%00%00contact email%0aOutputType%07%09nvoHeader%07Spacing%04%00%00%00%00%04Text%0c%00%00%00%00%05Valid%09%00%00%0bINVCheckBox%08MemCheck%07Caption%0c%0b%00%00%00remember me%07Checked%08%07Enabled%09%0aOutputName%0c%00%00%00%00%07Spacing%04%00%00%00%00%00%00%00
|
||||
Forms2=TPF0%0eTMEDetailsForm%0bDetailsForm%07Message%0c%0d%00%00%00Error Details%08MinWidth%04%00%00%00%00%08OnAction%0c%00%00%00%00%05Timer%04%00%00%00%00%00%09INVButton%0bContinueBtn%07Caption%0c%08%00%00%00Continue%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%07SkipBtn%07Caption%0c%04%00%00%00Skip%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%09CancelBtn%07Caption%0c%06%00%00%00Cancel%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%08INVLabel%06Label1%07Caption%0c'%00%00%00in which situation did the error occur?%07Enabled%09%07Spacing%04%00%00%00%00%00%00%07INVEdit%0bDetailsMemo%07Colored%09%07Enabled%09%05Lines%04%09%00%00%00%08Optional%08%0aOutputName%0c%0d%00%00%00error details%0aOutputType%07%0dnvoOwnSection%07Spacing%04%00%00%00%00%04Text%0c%00%00%00%00%05Valid%09%00%00%00
|
||||
Forms3=TPF0%0eTMEScrShotForm%0bScrShotForm%0dActiveControl%07%0bContinueBtn%07Message%0c%18%00%00%00Screenshot Configuration%08MinWidth%04%00%00%00%00%08OnAction%0c%1e%00%00%00madExcept.HandleScreenshotForm%05Timer%04%fa%00%00%00%00%09INVButton%0bContinueBtn%07Caption%0c%08%00%00%00Continue%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%07SkipBtn%07Caption%0c%04%00%00%00Skip%07Enabled%08%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%09CancelBtn%07Caption%0c%06%00%00%00Cancel%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%0bINVCheckBox%0bAttachCheck%07Caption%0c%25%00%00%00attach a screenshot to the bug report%07Checked%09%07Enabled%09%0aOutputName%0c%00%00%00%00%07Spacing%04%00%00%00%00%00%00%08INVImage%0aScrShotImg%06Border%09%09Clickable%09%07Enabled%09%04File%0c%00%00%00%00%06Height%04%00%00%00%00%07Spacing%04%00%00%00%00%05Width%04%00%00%00%00%00%00%08INVLabel%06Label1%07Caption%0c%15%00%00%00(click to edit image)%07Enabled%09%07Spacing%04%00%00%00%00%00%00%00
|
76
Tests/XSD/DataBindingResult.xsd
Normal file
76
Tests/XSD/DataBindingResult.xsd
Normal file
@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- edited with XMLSpy v2007 sp1 (http://www.altova.com) by M. van Renswoude (X²Software) -->
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
<xs:element name="DataBindingResult">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Defines the expected intermediate result of a Data Binding</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="Schemas">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="Schema" type="Schema" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:complexType name="Schema">
|
||||
<xs:sequence>
|
||||
<xs:element name="Name" type="xs:string"/>
|
||||
<xs:element name="Items">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="Item" type="Item" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="Item">
|
||||
<xs:sequence>
|
||||
<xs:element ref="ItemType"/>
|
||||
<xs:element name="Name" type="xs:string"/>
|
||||
<xs:choice>
|
||||
<xs:element name="Interface">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element ref="InterfaceType"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="Collection">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="ItemName" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="Enumeration">
|
||||
<xs:complexType>
|
||||
<xs:sequence/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="ItemType">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:NMTOKENS">
|
||||
<xs:enumeration value="Interface"/>
|
||||
<xs:enumeration value="Collection"/>
|
||||
<xs:enumeration value="Enumeration"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="InterfaceType">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:NMTOKEN">
|
||||
<xs:enumeration value="Interface"/>
|
||||
<xs:enumeration value="ComplexType"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
@ -442,7 +442,7 @@ begin
|
||||
'Load%0:sFromStream(AStream: TStream)',
|
||||
' doc := NewXMLDocument;'#13#10 +
|
||||
' doc.LoadFromStream(AStream);'#13#10 +
|
||||
' Result := GetOfferte(doc);',
|
||||
' Result := Get%0:s(doc);',
|
||||
' doc: IXMLDocument;');
|
||||
|
||||
WriteFunction(interfaceItem.TranslatedName,
|
||||
@ -687,6 +687,7 @@ begin
|
||||
itemProperty := AItem.Properties[propertyIndex];
|
||||
dataTypeName := '';
|
||||
writeTextProp := False;
|
||||
writeOptional := True;
|
||||
|
||||
{ Get data type }
|
||||
case itemProperty.PropertyType of
|
||||
@ -704,6 +705,10 @@ begin
|
||||
end else
|
||||
dataTypeName := PrefixInterface;
|
||||
|
||||
{ Collections have a Count property, no need to write a
|
||||
HasX property as well. }
|
||||
writeOptional := (propertyItem.ItemType <> itCollection);
|
||||
|
||||
dataTypeName := dataTypeName + propertyItem.TranslatedName;
|
||||
end;
|
||||
end;
|
||||
@ -712,6 +717,7 @@ begin
|
||||
|
||||
if Length(dataTypeName) > 0 then
|
||||
begin
|
||||
if writeOptional then
|
||||
writeOptional := itemProperty.IsOptional and
|
||||
(member in [dxmPropertyGet, dxmPropertyDeclaration]);
|
||||
|
||||
|
@ -125,7 +125,7 @@
|
||||
<Directories Name="PackageDCPOutputDir"></Directories>
|
||||
<Directories Name="SearchPath"></Directories>
|
||||
<Directories Name="Packages"></Directories>
|
||||
<Directories Name="Conditionals">madExcept</Directories>
|
||||
<Directories Name="Conditionals"></Directories>
|
||||
<Directories Name="DebugSourceDirs"></Directories>
|
||||
<Directories Name="UsePackages">False</Directories>
|
||||
</Directories>
|
||||
|
@ -34,7 +34,6 @@
|
||||
-K$00400000
|
||||
-LE"C:\Documents and Settings\PsychoMark\My Documents\Borland Studio Projects\Bpl"
|
||||
-LN"C:\Documents and Settings\PsychoMark\My Documents\Borland Studio Projects\Bpl"
|
||||
-DmadExcept
|
||||
-w-UNSAFE_TYPE
|
||||
-w-UNSAFE_CODE
|
||||
-w-UNSAFE_CAST
|
||||
|
@ -3,11 +3,6 @@ program X2XMLDataBinding;
|
||||
{$WARN SYMBOL_PLATFORM OFF}
|
||||
|
||||
uses
|
||||
madExcept,
|
||||
madLinkDisAsm,
|
||||
madListHardware,
|
||||
madListProcesses,
|
||||
madListModules,
|
||||
Forms,
|
||||
MainFrm in 'Forms\MainFrm.pas' {MainForm},
|
||||
XMLDataBindingGenerator in 'Units\XMLDataBindingGenerator.pas',
|
||||
|
144
X2XMLDataBinding.mes
Normal file
144
X2XMLDataBinding.mes
Normal file
@ -0,0 +1,144 @@
|
||||
[GeneralSettings]
|
||||
HandleExceptions=0
|
||||
AppendMapFileToBinary=1
|
||||
NoOwnMadExceptSettings=0
|
||||
CheckFileCrc=1
|
||||
CheckForFrozenMainThread=0
|
||||
FreezeTimeout=60000
|
||||
AutomaticallySaveBugReport=0
|
||||
AutoSaveBugReportIfNotSent=1
|
||||
AutomaticallyMailBugReport=0
|
||||
AutoMailProgressBox=0
|
||||
CopyBugReportToClipboard=0
|
||||
SuspendAllRunningThreads=0
|
||||
ShowPleaseWaitBox=1
|
||||
PleaseWaitIcon=plwait1
|
||||
AutomaticallyContinueApplication=0
|
||||
AutomaticallyRestartApplication=0
|
||||
AutomaticallyCloseApplication=0
|
||||
MailAddress=
|
||||
SendInBackground=1
|
||||
Send32Icon=send321
|
||||
MailAsSmtpServer=0
|
||||
MailAsSmtpClient=0
|
||||
UploadViaHttp=0
|
||||
MailViaMapi=1
|
||||
MailViaMailto=1
|
||||
SmtpServer=
|
||||
SmtpPort=25
|
||||
SmtpAccount=
|
||||
SmtpPassword=
|
||||
HttpServer=
|
||||
HttpPort=80
|
||||
HttpAccount=
|
||||
HttpPassword=
|
||||
BugReportFile=bugreport.txt
|
||||
AttachBugReport=0
|
||||
AttachBugReportFile=1
|
||||
DeleteBugReportFile=1
|
||||
BugReportSendAs=bugreport.txt
|
||||
BugReportZip=
|
||||
ScreenShotDepth=0
|
||||
ScreenShotAppOnly=0
|
||||
ScreenShotSendAs=screenshot.png
|
||||
ScreenShotZip=
|
||||
AdditionalAttachments=
|
||||
AppendBugReports=1
|
||||
BugReportFileSize=100000
|
||||
DontSaveDuplicateExceptions=1
|
||||
DontSaveDuplicateFreezings=1
|
||||
DuplicateExceptionDefinition=1
|
||||
DuplicateFreezeDefinition=2
|
||||
ShowExceptionBox=1
|
||||
OkBtnText=&OK
|
||||
DetailsBtnText=&Details
|
||||
PleaseWaitTitle=Information
|
||||
PleaseWaitText=Please wait a moment...
|
||||
MailSubject=bug report
|
||||
MailBody=please find the bug report attached
|
||||
SendBoxTitle=Sending bug report...
|
||||
PrepareAttachMsg=Preparing attachments...
|
||||
MxLookupMsg=Searching for mail server...
|
||||
ConnectMsg=Connecting to server...
|
||||
AuthMsg=Authentication...
|
||||
SendMailMsg=Sending mail...
|
||||
FieldsMsg=Setting fields...
|
||||
SendAttachMsg=Sending attachments...
|
||||
SendFinalizeMsg=Finalizing...
|
||||
MailFailureMsg=Sorry, sending the bug report didn't work.
|
||||
VersionVariable=
|
||||
[ExceptionBox]
|
||||
ShowButtonMailBugReport=1
|
||||
ShowButtonSaveBugReport=0
|
||||
ShowButtonPrintBugReport=0
|
||||
ShowButtonShowBugReport=1
|
||||
ShowButtonContinueApplication=1
|
||||
ShowButtonRestartApplication=1
|
||||
ShowButtonCloseApplication=1
|
||||
IconButtonSendBugReport=send1
|
||||
IconButtonSaveBugReport=save1
|
||||
IconButtonPrintBugReport=print1
|
||||
IconButtonShowBugReport=show1
|
||||
IconButtonContinueApplication=continue1
|
||||
IconButtonCantContinueApplication=cantContinue1
|
||||
IconButtonRestartApplication=restart1
|
||||
IconButtonCloseApplication=close1
|
||||
FocusedButton=0
|
||||
SendAssistant=SendAssistant
|
||||
SaveAssistant=SaveAssistant
|
||||
PrintAssistant=PrintAssistant
|
||||
AutomaticallyShowBugReport=0
|
||||
NoOwnerDrawButtons=0
|
||||
BigExceptionIcon=big1
|
||||
TitleBar=%25appname%25
|
||||
ExceptionMessage=An error occurred in the application.
|
||||
FrozenMessage=The application seems to be frozen.
|
||||
BitFaultMsg=The file "%25modname%25" seems to be corrupt!
|
||||
MailBugReportText=send bug report
|
||||
SaveBugReportText=save bug report
|
||||
PrintBugReportText=print bug report
|
||||
ShowBugReportText=show bug report
|
||||
ContinueApplicationText=continue application
|
||||
RestartApplicationText=restart application
|
||||
CloseApplicationText=close application
|
||||
[BugReport]
|
||||
ListThreads=1
|
||||
ListModules=1
|
||||
ListHardware=1
|
||||
ShowCpuRegisters=1
|
||||
ShowStackDump=1
|
||||
Disassembly=1
|
||||
HideUglyItems=0
|
||||
ShowRelativeAddrs=1
|
||||
ShowRelativeLines=1
|
||||
FormatDisassembly=0
|
||||
LimitDisassembly=5
|
||||
EnabledPlugins=modules|processes|hardware
|
||||
[Filters]
|
||||
Filter1ExceptionClasses=EDBEditError
|
||||
Filter1DontCreateBugReport=1
|
||||
Filter1DontCreateScreenshot=1
|
||||
Filter1DontSuspendThreads=1
|
||||
Filter1DontCallHandlers=1
|
||||
Filter1ShowBox=3
|
||||
Filter1Assis=
|
||||
Filter2ExceptionClasses=
|
||||
Filter2DontCreateBugReport=0
|
||||
Filter2DontCreateScreenshot=0
|
||||
Filter2DontSuspendThreads=0
|
||||
Filter2DontCallHandlers=0
|
||||
Filter2ShowBox=0
|
||||
Filter2Assis=
|
||||
GeneralDontCreateBugReport=0
|
||||
GeneralDontCreateScreenshot=0
|
||||
GeneralDontSuspendThreads=0
|
||||
GeneralDontCallHandlers=0
|
||||
GeneralShowBox=0
|
||||
GeneralAssis=
|
||||
[Assistants]
|
||||
Assistant1=SendAssistant|Send Assistant|ContactForm|DetailsForm|ScrShotForm
|
||||
Assistant2=SaveAssistant|Save Assistant|ContactForm|DetailsForm
|
||||
Assistant3=PrintAssistant|Print Assistant|ContactForm|DetailsForm
|
||||
Forms1=TPF0%0eTMEContactForm%0bContactForm%07Message%0c%13%00%00%00Contact Information%08MinWidth%04%00%00%00%00%08OnAction%0c%1b%00%00%00madExcept.HandleContactForm%05Timer%04%00%00%00%00%00%09INVButton%0bContinueBtn%07Caption%0c%08%00%00%00Continue%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%07SkipBtn%07Caption%0c%04%00%00%00Skip%07Enabled%08%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%09CancelBtn%07Caption%0c%06%00%00%00Cancel%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%08INVLabel%06Label1%07Caption%0c%0a%00%00%00your name:%07Enabled%09%07Spacing%04%00%00%00%00%00%00%07INVEdit%08NameEdit%07Colored%09%07Enabled%09%05Lines%04%01%00%00%00%08Optional%09%0aOutputName%0c%0c%00%00%00contact name%0aOutputType%07%09nvoHeader%07Spacing%04%00%00%00%00%04Text%0c%00%00%00%00%05Valid%09%00%00%08INVLabel%06Label2%07Caption%0c%0b%00%00%00your email:%07Enabled%09%07Spacing%04%00%00%00%00%00%00%07INVEdit%09EmailEdit%07Colored%09%07Enabled%09%05Lines%04%01%00%00%00%08Optional%08%0aOutputName%0c%0d%00%00%00contact email%0aOutputType%07%09nvoHeader%07Spacing%04%00%00%00%00%04Text%0c%00%00%00%00%05Valid%09%00%00%0bINVCheckBox%08MemCheck%07Caption%0c%0b%00%00%00remember me%07Checked%08%07Enabled%09%0aOutputName%0c%00%00%00%00%07Spacing%04%00%00%00%00%00%00%00
|
||||
Forms2=TPF0%0eTMEDetailsForm%0bDetailsForm%07Message%0c%0d%00%00%00Error Details%08MinWidth%04%00%00%00%00%08OnAction%0c%00%00%00%00%05Timer%04%00%00%00%00%00%09INVButton%0bContinueBtn%07Caption%0c%08%00%00%00Continue%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%07SkipBtn%07Caption%0c%04%00%00%00Skip%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%09CancelBtn%07Caption%0c%06%00%00%00Cancel%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%08INVLabel%06Label1%07Caption%0c'%00%00%00in which situation did the error occur?%07Enabled%09%07Spacing%04%00%00%00%00%00%00%07INVEdit%0bDetailsMemo%07Colored%09%07Enabled%09%05Lines%04%09%00%00%00%08Optional%08%0aOutputName%0c%0d%00%00%00error details%0aOutputType%07%0dnvoOwnSection%07Spacing%04%00%00%00%00%04Text%0c%00%00%00%00%05Valid%09%00%00%00
|
||||
Forms3=TPF0%0eTMEScrShotForm%0bScrShotForm%0dActiveControl%07%0bContinueBtn%07Message%0c%18%00%00%00Screenshot Configuration%08MinWidth%04%00%00%00%00%08OnAction%0c%1e%00%00%00madExcept.HandleScreenshotForm%05Timer%04%fa%00%00%00%00%09INVButton%0bContinueBtn%07Caption%0c%08%00%00%00Continue%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%07SkipBtn%07Caption%0c%04%00%00%00Skip%07Enabled%08%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%09CancelBtn%07Caption%0c%06%00%00%00Cancel%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%0bINVCheckBox%0bAttachCheck%07Caption%0c%25%00%00%00attach a screenshot to the bug report%07Checked%09%07Enabled%09%0aOutputName%0c%00%00%00%00%07Spacing%04%00%00%00%00%00%00%08INVImage%0aScrShotImg%06Border%09%09Clickable%09%07Enabled%09%04File%0c%00%00%00%00%06Height%04%00%00%00%00%07Spacing%04%00%00%00%00%05Width%04%00%00%00%00%00%00%08INVLabel%06Label1%07Caption%0c%15%00%00%00(click to edit image)%07Enabled%09%07Spacing%04%00%00%00%00%00%00%00
|
Loading…
Reference in New Issue
Block a user