Changeset 126 for trunk/Forms/UFormTest.pas
- Timestamp:
- Apr 6, 2022, 11:36:27 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormTest.pas
r116 r126 34 34 Selected: Boolean); 35 35 private 36 FTestCases: TTestCases; 36 37 procedure ReloadList; 38 procedure SetTestCases(AValue: TTestCases); 37 39 procedure UpdateInterface; 38 procedure InitTestCases;39 40 public 40 TestCases: TTestCases;41 property TestCases: TTestCases read FTestCases write SetTestCases; 41 42 end; 42 43 … … 50 51 51 52 uses 52 UCore, UFormTestCase, UContact; 53 54 resourcestring 55 SPassed = 'Passed'; 56 SFailed = 'Failed'; 53 UCore, UFormTestCase, UContact, UTestCases; 57 54 58 55 { TFormTest } … … 80 77 end; 81 78 79 procedure TFormTest.SetTestCases(AValue: TTestCases); 80 begin 81 if FTestCases = AValue then Exit; 82 FTestCases := AValue; 83 ReloadList; 84 UpdateInterface; 85 end; 86 82 87 procedure TFormTest.UpdateInterface; 83 88 var … … 101 106 LabelResult.Caption := SPassed + ' ' + IntToStr(Passed) + ', ' + 102 107 SFailed + ' ' + IntToStr(Failed); 103 end;104 105 procedure TFormTest.InitTestCases;106 const107 VCardVersion = 'VERSION:2.1';108 begin109 TestCases := TTestCases.Create;110 with TestCases do begin111 with TTestCaseLoadSave(AddNew('Load and save', TTestCaseLoadSave)) do begin112 Input := VCardBegin + LineEnding +113 VCardVersion + LineEnding +114 'N:Surname;Name' + LineEnding +115 'FN:Name Surname' + LineEnding +116 VCardEnd + LineEnding;117 Output := Input;118 end;119 with TTestCaseLoadSave(AddNew('Long text', TTestCaseLoadSave)) do begin120 Input := VCardBegin + LineEnding +121 VCardVersion + LineEnding +122 'NOTE:This is some long test which is really multi-lined each line is on dif' + LineEnding +123 ' ferent line so it is on multiple lines.' + LineEnding +124 VCardEnd + LineEnding;125 Output := Input;126 end;127 with TTestCaseLoadSave(AddNew('Multi-line', TTestCaseLoadSave)) do begin128 Input := VCardBegin + LineEnding +129 VCardVersion + LineEnding +130 'NOTE:First line\nsecond line\nempty line\n\nlast line' + LineEnding +131 VCardEnd + LineEnding;132 Output := Input;133 end;134 with TTestCaseLoadSave(AddNew('Quoted-printable load-save', TTestCaseLoadSave)) do begin135 Input := VCardBegin + LineEnding +136 VCardVersion + LineEnding +137 'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD' + LineEnding +138 VCardEnd + LineEnding;139 Output := Input;140 end;141 with TTestCaseLoadSave(AddNew('Quoted-printable load-save multi-line', TTestCaseLoadSave)) do begin142 Input := VCardBegin + LineEnding +143 VCardVersion + LineEnding +144 'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=ADJm=C3=A9n=' + LineEnding +145 'o=20P=C5=99=C3=ADjmen=C3=AD' + LineEnding +146 VCardEnd + LineEnding;147 Output := Input;148 end;149 with TTestCaseLoadSave(AddNew('Base64 load-save (encoding=base64)', TTestCaseLoadSave)) do begin150 Input := VCardBegin + LineEnding +151 VCardVersion + LineEnding +152 'FN;ENCODING=BASE64:VGVzdCBzdHJpbmc=' + LineEnding +153 VCardEnd + LineEnding;154 Output := Input;155 end;156 with TTestCaseLoadSave(AddNew('Base64 load-save (base64)', TTestCaseLoadSave)) do begin157 Input := VCardBegin + LineEnding +158 VCardVersion + LineEnding +159 'FN;BASE64:VGVzdCBzdHJpbmc=' + LineEnding +160 VCardEnd + LineEnding;161 Output := Input;162 end;163 with TTestCaseLoadSave(AddNew('Base64 load-save (encoding=b)', TTestCaseLoadSave)) do begin164 Input := VCardBegin + LineEnding +165 VCardVersion + LineEnding +166 'FN;ENCODING=B:VGVzdCBzdHJpbmc=' + LineEnding +167 VCardEnd + LineEnding;168 Output := Input;169 end;170 with TTestCaseLoadSave(AddNew('Base64 load-save multi-line', TTestCaseLoadSave)) do begin171 Input := VCardBegin + LineEnding +172 VCardVersion + LineEnding +173 'FN;ENCODING=BASE64:U29tZSB2ZXJ5IGxvbmcgc3RyaW5nIFNvbWUgdmVyeSBsb25nIHN0cmlu' + LineEnding +174 ' ZyBTb21lIHZlcnkgbG9uZyBzdHJpbmcgU29tZSB2ZXJ5IGxvbmcgc3RyaW5n' + LineEnding +175 VCardEnd + LineEnding;176 Output := Input;177 end;178 //AddNew('Image format', TTestCaseLoadSave);179 with TTestCaseLoadSave(AddNew('Empty', TTestCaseLoadSave)) do begin180 Input := '';181 Output := '';182 end;183 with TTestCaseLoadSave(AddNew('Begin only', TTestCaseLoadSave)) do begin184 Input := VCardBegin;185 Output := '';186 end;187 with TTestCaseLoadSave(AddNew('Missing end', TTestCaseLoadSave)) do begin188 Input := VCardBegin + LineEnding +189 VCardVersion + LineEnding +190 'N:Surname;Name' + LineEnding +191 'FN:Name Surname' + LineEnding;192 Output := '';193 end;194 with TTestCaseLoadSave(AddNew('Missing start', TTestCaseLoadSave)) do begin195 Input := VCardVersion + LineEnding +196 'N:Surname;Name' + LineEnding +197 'FN:Name Surname' + LineEnding +198 VCardEnd + LineEnding;199 Output := '';200 end;201 with TTestCaseCheckProperty(AddNew('Property FN', TTestCaseCheckProperty)) do begin202 Index := cfFullName;203 Value := 'Name Surname';204 Input := VCardBegin + LineEnding +205 VCardVersion + LineEnding +206 'FN:' + Value + LineEnding +207 VCardEnd + LineEnding;208 end;209 with TTestCaseCheckProperty(AddNew('Escaped new lines in text', TTestCaseCheckProperty)) do begin210 Index := cfNote;211 Value := 'Line' + #13#10 + 'Line';212 Input := VCardBegin + LineEnding +213 VCardVersion + LineEnding +214 'NOTE:Line\nLine' + LineEnding +215 VCardEnd + LineEnding;216 end;217 with TTestCaseCheckProperty(AddNew('Compound value', TTestCaseCheckProperty)) do begin218 Index := cfFirstName;219 Value := 'FirstName';220 Input := VCardBegin + LineEnding +221 VCardVersion + LineEnding +222 'N:Surname;FirstName;;;' + LineEnding +223 VCardEnd + LineEnding;224 end;225 with TTestCaseCheckProperty(AddNew('Quoted-printable special symbols', TTestCaseCheckProperty)) do begin226 Index := cfFullName;227 Value := 'Jméno Příjmení';228 Input := VCardBegin + LineEnding +229 VCardVersion + LineEnding +230 'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD' + LineEnding +231 VCardEnd + LineEnding;232 end;233 with TTestCaseCheckProperty(AddNew('Base64 special symbols', TTestCaseCheckProperty)) do begin234 Index := cfFullName;235 Value := 'Jméno Příjmení';236 Input := VCardBegin + LineEnding +237 VCardVersion + LineEnding +238 'FN;ENCODING=BASE64:Sm3DqW5vIFDFmcOtam1lbsOt' + LineEnding +239 VCardEnd + LineEnding;240 end;241 end;242 108 end; 243 109 … … 282 148 Core.Translator.TranslateComponentRecursive(Self); 283 149 Core.ThemeManager1.UseTheme(Self); 284 285 InitTestCases;286 150 end; 287 151 288 152 procedure TFormTest.FormDestroy(Sender: TObject); 289 153 begin 290 FreeAndNil(TestCases);291 154 end; 292 155
Note:
See TracChangeset
for help on using the changeset viewer.