- Timestamp:
- Jun 23, 2022, 10:22:43 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Common.lpk
r134 r135 41 41 Source: https://svn.zdechov.net/PascalClassLibrary/Common/"/> 42 42 <License Value="Copy left."/> 43 <Version Minor=" 9"/>43 <Version Minor="10"/> 44 44 <Files Count="30"> 45 45 <Item1> -
trunk/Packages/Common/StopWatch.pas
r127 r135 5 5 6 6 uses 7 {$IFDEF W indows}Windows,{$ENDIF}7 {$IFDEF WINDOWS}Windows,{$ENDIF} 8 8 SysUtils, DateUtils; 9 9 … … 41 41 fIsRunning := False; 42 42 43 {$IFDEF W indows}43 {$IFDEF WINDOWS} 44 44 fIsHighResolution := QueryPerformanceFrequency(fFrequency) ; 45 45 {$ELSE} -
trunk/Packages/VCard/UVCard.pas
r133 r135 253 253 VCardEncoding = 'ENCODING'; 254 254 VCardCharset = 'CHARSET'; 255 VCardLineEnding = #13#10; 255 256 256 257 procedure Register; … … 1765 1766 begin 1766 1767 with Output do begin 1768 LineBreak := VCardLineEnding; 1767 1769 Add(VCardBegin); 1768 1770 for I := 0 to Properties.Count - 1 do -
trunk/UCore.pas
r134 r135 625 625 {$IFOPT D+} 626 626 ATest.Enabled := True; 627 AFileCompare.Enabled := True; 627 628 {$ENDIF} 628 629 {$IFOPT D-} 629 630 ATest.Enabled := False; 631 AFileCompare.Enabled := False; 630 632 {$ENDIF} 631 633 ATest.Visible := ATest.Enabled; 634 AFileCompare.Visible := AFileCompare.Enabled; 632 635 end; 633 636 -
trunk/UTestCases.pas
r129 r135 16 16 const 17 17 VCardVersion = 'VERSION:2.1'; 18 UnixLineEnding = #10; 19 MacLineEnding = #13; 18 20 19 21 function BeginEnd(Text: string; WithVersion: Boolean = True): string; 20 22 begin 21 Result := VCardBegin + LineEnding;22 if WithVersion then Result := Result + VCardVersion + LineEnding;23 Result := Result + Text + VCardEnd + LineEnding;23 Result := VCardBegin + VCardLineEnding; 24 if WithVersion then Result := Result + VCardVersion + VCardLineEnding; 25 Result := Result + Text + VCardEnd + VCardLineEnding; 24 26 end; 25 27 … … 30 32 with TTestCaseLoadSave(AddNew('Load and save', TTestCaseLoadSave)) do begin 31 33 Input := BeginEnd( 32 'N:Surname;Name' + LineEnding +33 'FN:Name Surname' + LineEnding);34 'N:Surname;Name' + VCardLineEnding + 35 'FN:Name Surname' + VCardLineEnding); 34 36 Output := Input; 35 37 end; 36 38 with TTestCaseLoadSave(AddNew('Long text', TTestCaseLoadSave)) do begin 37 39 Input := BeginEnd( 38 'NOTE:This is some long test which is really multi-lined each line is on dif' + LineEnding +39 ' ferent line so it is on multiple lines.' + LineEnding);40 'NOTE:This is some long test which is really multi-lined each line is on dif' + VCardLineEnding + 41 ' ferent line so it is on multiple lines.' + VCardLineEnding); 40 42 Output := Input; 41 43 end; 42 44 with TTestCaseLoadSave(AddNew('Multi-line', TTestCaseLoadSave)) do begin 43 45 Input := BeginEnd( 44 'NOTE:First line\nsecond line\nempty line\n\nlast line' + LineEnding);46 'NOTE:First line\nsecond line\nempty line\n\nlast line' + VCardLineEnding); 45 47 Output := Input; 46 48 end; 47 49 with TTestCaseLoadSave(AddNew('Quoted-printable load-save', TTestCaseLoadSave)) do begin 48 50 Input := BeginEnd( 49 'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD' + LineEnding);51 'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD' + VCardLineEnding); 50 52 Output := Input; 51 53 end; 52 54 with TTestCaseLoadSave(AddNew('Quoted-printable load-save multi-line', TTestCaseLoadSave)) do begin 53 55 Input := BeginEnd( 54 'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=ADJm=C3=A9n=' + LineEnding +55 'o=20P=C5=99=C3=ADjmen=C3=AD' + LineEnding);56 'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=ADJm=C3=A9n=' + VCardLineEnding + 57 'o=20P=C5=99=C3=ADjmen=C3=AD' + VCardLineEnding); 56 58 Output := Input; 57 59 end; 58 60 with TTestCaseLoadSave(AddNew('Base64 load-save (encoding=base64)', TTestCaseLoadSave)) do begin 59 61 Input := BeginEnd( 60 'FN;ENCODING=BASE64:VGVzdCBzdHJpbmc=' + LineEnding);62 'FN;ENCODING=BASE64:VGVzdCBzdHJpbmc=' + VCardLineEnding); 61 63 Output := Input; 62 64 end; 63 65 with TTestCaseLoadSave(AddNew('Base64 load-save (base64)', TTestCaseLoadSave)) do begin 64 66 Input := BeginEnd( 65 'FN;BASE64:VGVzdCBzdHJpbmc=' + LineEnding);67 'FN;BASE64:VGVzdCBzdHJpbmc=' + VCardLineEnding); 66 68 Output := Input; 67 69 end; 68 70 with TTestCaseLoadSave(AddNew('Base64 load-save (encoding=b)', TTestCaseLoadSave)) do begin 69 71 Input := BeginEnd( 70 'FN;ENCODING=B:VGVzdCBzdHJpbmc=' + LineEnding);72 'FN;ENCODING=B:VGVzdCBzdHJpbmc=' + VCardLineEnding); 71 73 Output := Input; 72 74 end; 73 75 with TTestCaseLoadSave(AddNew('Base64 load-save multi-line', TTestCaseLoadSave)) do begin 74 76 Input := BeginEnd( 75 'FN;ENCODING=BASE64:U29tZSB2ZXJ5IGxvbmcgc3RyaW5nIFNvbWUgdmVyeSBsb25nIHN0cmlu' + LineEnding +76 ' ZyBTb21lIHZlcnkgbG9uZyBzdHJpbmcgU29tZSB2ZXJ5IGxvbmcgc3RyaW5n' + LineEnding);77 'FN;ENCODING=BASE64:U29tZSB2ZXJ5IGxvbmcgc3RyaW5nIFNvbWUgdmVyeSBsb25nIHN0cmlu' + VCardLineEnding + 78 ' ZyBTb21lIHZlcnkgbG9uZyBzdHJpbmcgU29tZSB2ZXJ5IGxvbmcgc3RyaW5n' + VCardLineEnding); 77 79 Output := Input; 78 80 end; … … 87 89 end; 88 90 with TTestCaseLoadSave(AddNew('Missing end', TTestCaseLoadSave)) do begin 89 Input := VCardBegin + LineEnding +90 VCardVersion + LineEnding +91 'N:Surname;Name' + LineEnding +92 'FN:Name Surname' + LineEnding;91 Input := VCardBegin + VCardLineEnding + 92 VCardVersion + VCardLineEnding + 93 'N:Surname;Name' + VCardLineEnding + 94 'FN:Name Surname' + VCardLineEnding; 93 95 Output := ''; 94 96 end; 95 97 with TTestCaseLoadSave(AddNew('Missing start', TTestCaseLoadSave)) do begin 96 Input := VCardVersion + LineEnding +97 'N:Surname;Name' + LineEnding +98 'FN:Name Surname' + LineEnding +99 VCardEnd + LineEnding;98 Input := VCardVersion + VCardLineEnding + 99 'N:Surname;Name' + VCardLineEnding + 100 'FN:Name Surname' + VCardLineEnding + 101 VCardEnd + VCardLineEnding; 100 102 Output := ''; 101 103 end; … … 103 105 Index := cfFullName; 104 106 Value := 'Name Surname'; 105 Input := BeginEnd('FN:' + Value + LineEnding);107 Input := BeginEnd('FN:' + Value + VCardLineEnding); 106 108 end; 107 109 with TTestCaseCheckProperty(AddNew('Escaped new lines in text', TTestCaseCheckProperty)) do begin 108 110 Index := cfNote; 109 111 Value := 'Line' + #13#10 + 'Line'; 110 Input := BeginEnd('NOTE:Line\nLine' + LineEnding);112 Input := BeginEnd('NOTE:Line\nLine' + VCardLineEnding); 111 113 end; 112 114 with TTestCaseCheckProperty(AddNew('Compound value', TTestCaseCheckProperty)) do begin 113 115 Index := cfFirstName; 114 116 Value := 'FirstName'; 115 Input := BeginEnd('N:Surname;FirstName;;;' + LineEnding);117 Input := BeginEnd('N:Surname;FirstName;;;' + VCardLineEnding); 116 118 end; 117 119 with TTestCaseCheckProperty(AddNew('Quoted-printable special symbols', TTestCaseCheckProperty)) do begin … … 119 121 Value := 'Jméno Příjmení'; 120 122 Input := BeginEnd( 121 'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD' + LineEnding);123 'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD' + VCardLineEnding); 122 124 end; 123 125 with TTestCaseCheckProperty(AddNew('Base64 special symbols', TTestCaseCheckProperty)) do begin 124 126 Index := cfFullName; 125 127 Value := 'Jméno Příjmení'; 126 Input := BeginEnd('FN;ENCODING=BASE64:Sm3DqW5vIFDFmcOtam1lbsOt' + LineEnding);128 Input := BeginEnd('FN;ENCODING=BASE64:Sm3DqW5vIFDFmcOtam1lbsOt' + VCardLineEnding); 127 129 end; 128 130 with TTestCaseLoadSave(AddNew('Remove exact duplicates', TTestCaseLoadSave)) do begin 129 131 Input := BeginEnd( 130 'N:Surname;Name' + LineEnding +131 'FN:Name Surname' + LineEnding) +132 'N:Surname;Name' + VCardLineEnding + 133 'FN:Name Surname' + VCardLineEnding) + 132 134 BeginEnd( 133 'N:Surname2;Name2' + LineEnding +134 'FN:Name2 Surname2' + LineEnding) +135 'N:Surname2;Name2' + VCardLineEnding + 136 'FN:Name2 Surname2' + VCardLineEnding) + 135 137 BeginEnd( 136 'N:Surname;Name' + LineEnding +137 'FN:Name Surname' + LineEnding) +138 'N:Surname;Name' + VCardLineEnding + 139 'FN:Name Surname' + VCardLineEnding) + 138 140 BeginEnd( 139 'N:Surname;Name' + LineEnding +140 'FN:Name Surname' + LineEnding +141 'NOTE:Note' + LineEnding) +141 'N:Surname;Name' + VCardLineEnding + 142 'FN:Name Surname' + VCardLineEnding + 143 'NOTE:Note' + VCardLineEnding) + 142 144 BeginEnd( 143 'N:Surname;Name' + LineEnding +144 'FN:Name Surname' + LineEnding);145 'N:Surname;Name' + VCardLineEnding + 146 'FN:Name Surname' + VCardLineEnding); 145 147 Action := akRemoveExactDuplicates; 146 148 Output := BeginEnd( 147 'N:Surname;Name' + LineEnding +148 'FN:Name Surname' + LineEnding) +149 'N:Surname;Name' + VCardLineEnding + 150 'FN:Name Surname' + VCardLineEnding) + 149 151 BeginEnd( 150 'N:Surname2;Name2' + LineEnding +151 'FN:Name2 Surname2' + LineEnding) +152 'N:Surname2;Name2' + VCardLineEnding + 153 'FN:Name2 Surname2' + VCardLineEnding) + 152 154 BeginEnd( 153 'N:Surname;Name' + LineEnding + 154 'FN:Name Surname' + LineEnding + 155 'NOTE:Note' + LineEnding); 155 'N:Surname;Name' + VCardLineEnding + 156 'FN:Name Surname' + VCardLineEnding + 157 'NOTE:Note' + VCardLineEnding); 158 end; 159 with TTestCaseLoadSave(AddNew('Normalize Unix line endings', TTestCaseLoadSave)) do begin 160 Input := VCardBegin + UnixLineEnding + 161 VCardVersion + UnixLineEnding + 162 'N:Surname;Name' + UnixLineEnding + 163 'FN:Name Surname' + UnixLineEnding + 164 VCardEnd + UnixLineEnding; 165 Output := VCardBegin + VCardLineEnding + 166 VCardVersion + VCardLineEnding + 167 'N:Surname;Name' + VCardLineEnding + 168 'FN:Name Surname' + VCardLineEnding + 169 VCardEnd + VCardLineEnding; 170 end; 171 with TTestCaseLoadSave(AddNew('Normalize Mac line endings', TTestCaseLoadSave)) do begin 172 Input := VCardBegin + MacLineEnding + 173 VCardVersion + MacLineEnding + 174 'N:Surname;Name' + MacLineEnding + 175 'FN:Name Surname' + MacLineEnding + 176 VCardEnd + MacLineEnding; 177 Output := VCardBegin + VCardLineEnding + 178 VCardVersion + VCardLineEnding + 179 'N:Surname;Name' + VCardLineEnding + 180 'FN:Name Surname' + VCardLineEnding + 181 VCardEnd + VCardLineEnding; 156 182 end; 157 183 end;
Note:
See TracChangeset
for help on using the changeset viewer.