12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073 |
- Unit tccompstreaming;
- interface
- Uses
- SysUtils,Classes,tcstreaming;
- Type
- TTestComponentStream = Class(TTestStreaming)
- Published
- Procedure TestTEmptyComponent;
- Procedure TestTIntegerComponent;
- Procedure TestTIntegerComponent2;
- Procedure TestTIntegerComponent3;
- Procedure TestTIntegerComponent4;
- Procedure TestTIntegerComponent5;
- Procedure TestTInt64Component;
- Procedure TestTInt64Component2;
- Procedure TestTInt64Component3;
- Procedure TestTInt64Component4;
- Procedure TestTInt64Component5;
- Procedure TestTInt64Component6;
- Procedure TestTStringComponent;
- Procedure TestTStringComponent2;
- Procedure TestTWideStringComponent;
- Procedure TestTWideStringComponent2;
- Procedure TestTSingleComponent;
- Procedure TestTDoubleComponent;
- Procedure TestTExtendedComponent;
- Procedure TestTCompComponent;
- Procedure TestTCurrencyComponent;
- Procedure TestTDateTimeComponent;
- Procedure TestTDateTimeComponent2;
- Procedure TestTDateTimeComponent3;
- Procedure TestTEnumComponent;
- Procedure TestTEnumComponent2;
- Procedure TestTEnumComponent3;
- Procedure TestTEnumComponent4;
- Procedure TestTSetComponent;
- Procedure TestTSetComponent2;
- Procedure TestTSetComponent3;
- Procedure TestTSetComponent4;
- Procedure TestTMultipleComponent;
- Procedure TestTPersistentComponent;
- Procedure TestTCollectionComponent;
- Procedure TestTCollectionComponent2;
- Procedure TestTCollectionComponent3;
- Procedure TestTCollectionComponent4;
- Procedure TestTOwnedComponent;
- Procedure TestTStreamedOwnedComponent;
- Procedure TestTMethodComponent;
- Procedure TestTMethodComponent2;
- end;
- Implementation
- uses testcomps;
- Procedure TTestComponentStream.TestTEmptyComponent;
- Var
- C : TComponent;
- begin
- C:=TEmptyComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TEmptyComponent');
- ExpectBareString('TestTEmptyComponent');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTIntegerComponent;
- Var
- C : TComponent;
- begin
- C:=TIntegerComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TIntegerComponent');
- ExpectBareString('TestTIntegerComponent');
- ExpectBareString('IntProp');
- ExpectInteger(3);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTIntegerComponent2;
- Var
- C : TComponent;
- begin
- C:=TIntegerComponent2.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TIntegerComponent2');
- ExpectBareString('TestTIntegerComponent2');
- ExpectBareString('IntProp');
- ExpectInteger(1024);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTIntegerComponent3;
- Var
- C : TComponent;
- begin
- C:=TIntegerComponent3.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TIntegerComponent3');
- ExpectBareString('TestTIntegerComponent3');
- ExpectBareString('IntProp');
- ExpectInteger(262144);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTIntegerComponent4;
- Var
- C : TComponent;
- begin
- C:=TIntegerComponent4.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TIntegerComponent4');
- ExpectBareString('TestTIntegerComponent4');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTIntegerComponent5;
- Var
- C : TComponent;
- begin
- C:=TIntegerComponent5.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TIntegerComponent5');
- ExpectBareString('TestTIntegerComponent5');
- ExpectBareString('IntProp');
- ExpectInteger(5);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTInt64Component;
- Var
- C : TComponent;
- begin
- C:=TInt64Component.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TInt64Component');
- ExpectBareString('TestTInt64Component');
- ExpectBareString('Int64Prop');
- ExpectInteger(4);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTInt64Component2;
- Var
- C : TComponent;
- begin
- C:=TInt64Component2.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TInt64Component2');
- ExpectBareString('TestTInt64Component2');
- ExpectBareString('Int64Prop');
- ExpectInteger(1024);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTInt64Component3;
- Var
- C : TComponent;
- begin
- C:=TInt64Component3.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TInt64Component3');
- ExpectBareString('TestTInt64Component3');
- ExpectBareString('Int64Prop');
- ExpectInteger(262144);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTInt64Component4;
- Var
- C : TComponent;
- begin
- C:=TInt64Component4.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TInt64Component4');
- ExpectBareString('TestTInt64Component4');
- ExpectBareString('Int64Prop');
- ExpectInt64(2147745791);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTInt64Component5;
- Var
- C : TComponent;
- begin
- C:=TInt64Component5.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TInt64Component5');
- ExpectBareString('TestTInt64Component5');
- ExpectBareString('Int64Prop');
- ExpectInteger(7);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTInt64Component6;
- Var
- C : TComponent;
- begin
- C:=TInt64Component6.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TInt64Component6');
- ExpectBareString('TestTInt64Component6');
- ExpectBareString('Int64Prop');
- ExpectInteger(8);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTStringComponent;
- Var
- C : TComponent;
- begin
- C:=TStringComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TStringComponent');
- ExpectBareString('TestTStringComponent');
- ExpectBareString('StringProp');
- ExpectString('A string');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTStringComponent2;
- Var
- C : TComponent;
- begin
- C:=TStringComponent2.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TStringComponent2');
- ExpectBareString('TestTStringComponent2');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTWideStringComponent;
- Var
- C : TComponent;
- begin
- C:=TWideStringComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TWideStringComponent');
- ExpectBareString('TestTWideStringComponent');
- ExpectBareString('WideStringProp');
- ExpectString('Some WideString');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTWideStringComponent2;
- Var
- C : TComponent;
- begin
- C:=TWideStringComponent2.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TWideStringComponent2');
- ExpectBareString('TestTWideStringComponent2');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTSingleComponent;
- Var
- C : TComponent;
- begin
- C:=TSingleComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TSingleComponent');
- ExpectBareString('TestTSingleComponent');
- ExpectBareString('SingleProp');
- ExpectExtended(1.23);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTDoubleComponent;
- Var
- C : TComponent;
- begin
- C:=TDoubleComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TDoubleComponent');
- ExpectBareString('TestTDoubleComponent');
- ExpectBareString('DoubleProp');
- ExpectExtended(2.34);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTExtendedComponent;
- Var
- C : TComponent;
- begin
- C:=TExtendedComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TExtendedComponent');
- ExpectBareString('TestTExtendedComponent');
- ExpectBareString('ExtendedProp');
- ExpectExtended(3.45);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTCompComponent;
- Var
- C : TComponent;
- begin
- C:=TCompComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TCompComponent');
- ExpectBareString('TestTCompComponent');
- ExpectBareString('ExtendedProp');
- ExpectExtended(5.00);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTCurrencyComponent;
- Var
- C : TComponent;
- begin
- C:=TCurrencyComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TCurrencyComponent');
- ExpectBareString('TestTCurrencyComponent');
- ExpectBareString('CurrencyProp');
- ExpectExtended(5.67);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTDateTimeComponent;
- Var
- C : TComponent;
- begin
- C:=TDateTimeComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TDateTimeComponent');
- ExpectBareString('TestTDateTimeComponent');
- ExpectBareString('DateTimeProp');
- ExpectExtended(35278.00);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTDateTimeComponent2;
- Var
- C : TComponent;
- begin
- C:=TDateTimeComponent2.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TDateTimeComponent2');
- ExpectBareString('TestTDateTimeComponent2');
- ExpectBareString('DateTimeProp');
- ExpectExtended(0.97);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTDateTimeComponent3;
- Var
- C : TComponent;
- begin
- C:=TDateTimeComponent3.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TDateTimeComponent3');
- ExpectBareString('TestTDateTimeComponent3');
- ExpectBareString('DateTimeProp');
- ExpectExtended(35278.97);
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTEnumComponent;
- Var
- C : TComponent;
- begin
- C:=TEnumComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TEnumComponent');
- ExpectBareString('TestTEnumComponent');
- ExpectBareString('Dice');
- ExpectIdent('four');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTEnumComponent2;
- Var
- C : TComponent;
- begin
- C:=TEnumComponent2.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TEnumComponent2');
- ExpectBareString('TestTEnumComponent2');
- ExpectBareString('Dice');
- ExpectIdent('one');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTEnumComponent3;
- Var
- C : TComponent;
- begin
- C:=TEnumComponent3.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TEnumComponent3');
- ExpectBareString('TestTEnumComponent3');
- ExpectBareString('Dice');
- ExpectIdent('three');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTEnumComponent4;
- Var
- C : TComponent;
- begin
- C:=TEnumComponent4.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TEnumComponent4');
- ExpectBareString('TestTEnumComponent4');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTSetComponent;
- Var
- C : TComponent;
- begin
- C:=TSetComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TSetComponent');
- ExpectBareString('TestTSetComponent');
- ExpectBareString('Throw');
- ExpectValue(vaSet);
- ExpectBareString('two');
- ExpectBareString('five');
- ExpectBareString('');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTSetComponent2;
- Var
- C : TComponent;
- begin
- C:=TSetComponent2.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TSetComponent2');
- ExpectBareString('TestTSetComponent2');
- ExpectBareString('Throw');
- ExpectValue(vaSet);
- ExpectBareString('');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTSetComponent3;
- Var
- C : TComponent;
- begin
- C:=TSetComponent3.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TSetComponent3');
- ExpectBareString('TestTSetComponent3');
- ExpectBareString('Throw');
- ExpectValue(vaSet);
- ExpectBareString('one');
- ExpectBareString('four');
- ExpectBareString('');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTSetComponent4;
- Var
- C : TComponent;
- begin
- C:=TSetComponent4.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TSetComponent4');
- ExpectBareString('TestTSetComponent4');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTMultipleComponent;
- Var
- C : TComponent;
- begin
- C:=TMultipleComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TMultipleComponent');
- ExpectBareString('TestTMultipleComponent');
- ExpectBareString('IntProp');
- ExpectInteger(1);
- ExpectBareString('StringProp');
- ExpectString('A String');
- ExpectBareString('CurrencyProp');
- ExpectExtended(2.30);
- ExpectBareString('Dice');
- ExpectIdent('two');
- ExpectBareString('Throw');
- ExpectValue(vaSet);
- ExpectBareString('three');
- ExpectBareString('four');
- ExpectBareString('');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTPersistentComponent;
- Var
- C : TComponent;
- begin
- C:=TPersistentComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TPersistentComponent');
- ExpectBareString('TestTPersistentComponent');
- ExpectBareString('Persist.AInteger');
- ExpectInteger(3);
- ExpectBareString('Persist.AString');
- ExpectString('A persistent string');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTCollectionComponent;
- Var
- C : TComponent;
- begin
- C:=TCollectionComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TCollectionComponent');
- ExpectBareString('TestTCollectionComponent');
- ExpectBareString('Coll');
- ExpectValue(vaCollection);
- ExpectEndOfList;
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTCollectionComponent2;
- Var
- C : TComponent;
- begin
- C:=TCollectionComponent2.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TCollectionComponent2');
- ExpectBareString('TestTCollectionComponent2');
- ExpectBareString('Coll');
- ExpectValue(vaCollection);
- ExpectValue(vaList);
- ExpectBareString('StrProp');
- ExpectString('First');
- ExpectEndOfList;
- ExpectValue(vaList);
- ExpectBareString('StrProp');
- ExpectString('Second');
- ExpectEndOfList;
- ExpectValue(vaList);
- ExpectBareString('StrProp');
- ExpectString('Third');
- ExpectEndOfList;
- ExpectEndOfList;
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTCollectionComponent3;
- Var
- C : TComponent;
- begin
- C:=TCollectionComponent3.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TCollectionComponent3');
- ExpectBareString('TestTCollectionComponent3');
- ExpectBareString('Coll');
- ExpectValue(vaCollection);
- ExpectValue(vaList);
- ExpectBareString('StrProp');
- ExpectString('First');
- ExpectEndOfList;
- ExpectValue(vaList);
- ExpectEndOfList;
- ExpectValue(vaList);
- ExpectBareString('StrProp');
- ExpectString('Third');
- ExpectEndOfList;
- ExpectEndOfList;
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTCollectionComponent4;
- Var
- C : TComponent;
- begin
- C:=TCollectionComponent4.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TCollectionComponent4');
- ExpectBareString('TestTCollectionComponent4');
- ExpectBareString('Coll');
- ExpectValue(vaCollection);
- ExpectValue(vaList);
- ExpectBareString('StrProp');
- ExpectString('Something');
- ExpectEndOfList;
- ExpectEndOfList;
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTOwnedComponent;
- Var
- C : TComponent;
- begin
- C:=TOwnedComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TOwnedComponent');
- ExpectBareString('TestTOwnedComponent');
- ExpectBareString('CompProp');
- ExpectIdent('SubComponent');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTStreamedOwnedComponent;
- Var
- C : TComponent;
- begin
- C:=TStreamedOwnedComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TStreamedOwnedComponent');
- ExpectBareString('TestTStreamedOwnedComponent');
- ExpectEndOfList;
- ExpectFlags([],0);
- ExpectBareString('TIntegerComponent');
- ExpectBareString('Sub');
- ExpectBareString('IntProp');
- ExpectInteger(3);
- ExpectEndOfList;
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTMethodComponent;
- Var
- C : TComponent;
- begin
- C:=TMethodComponent.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TMethodComponent');
- ExpectBareString('TestTMethodComponent');
- ExpectBareString('MethodProp');
- ExpectIdent('MyMethod');
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- Procedure TTestComponentStream.TestTMethodComponent2;
- Var
- C : TComponent;
- begin
- C:=TMethodComponent2.Create(Nil);
- Try
- SaveToStream(C);
- ExpectSignature;
- ExpectFlags([],0);
- ExpectBareString('TMethodComponent2');
- ExpectBareString('TestTMethodComponent2');
- ExpectEndOfList;
- ExpectFlags([],0);
- ExpectBareString('TMethodComponent');
- ExpectBareString('AComponent');
- ExpectBareString('MethodProp');
- ExpectIdent('MyMethod2');
- ExpectEndOfList;
- ExpectEndOfList;
- ExpectEndOfList;
- Finally
- C.Free;
- end;
- end;
- end.
|