Changeset 92 for trunk/Forms


Ignore:
Timestamp:
Feb 3, 2022, 10:08:07 PM (3 years ago)
Author:
chronos
Message:
  • Added: Detect used max line length. Default max line length should be 75 characters.
  • Added: Escape new lines in text strings.
  • Modified: Extended tests.
  • Fixed: Wrong max line length was used for UTF-8 strings during save.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormTest.pas

    r91 r92  
    4848
    4949uses
    50   UCore, UFormTestCase;
     50  UCore, UFormTestCase, UContact;
    5151
    5252{ TFormTest }
     
    119119  with TestCases do begin
    120120    with TTestCaseLoadSave(AddNew('Load and save', TTestCaseLoadSave)) do begin
    121       Input := 'BEGIN:VCARD' + LineEnding +
     121      Input := VCardBegin + LineEnding +
    122122        'VERSION:2.1' + LineEnding +
    123123        'N:Surname;Name' + LineEnding +
    124124        'FN:Name Surname' + LineEnding +
    125         'END:VCARD' + LineEnding;
     125        VCardEnd + LineEnding;
     126      Output := Input;
     127    end;
     128    with TTestCaseLoadSave(AddNew('Long text', TTestCaseLoadSave)) do begin
     129      Input := VCardBegin + LineEnding +
     130        'VERSION:2.1' + LineEnding +
     131        'NOTE:This is some long test which is really multi-lined each line is on d' + LineEnding +
     132        ' ifferent line so it is on multiple lines.' + LineEnding +
     133        VCardEnd + LineEnding;
    126134      Output := Input;
    127135    end;
    128136    with TTestCaseLoadSave(AddNew('Multi-line', TTestCaseLoadSave)) do begin
    129       Input := 'BEGIN:VCARD' + LineEnding +
     137      Input := VCardBegin + LineEnding +
    130138        'VERSION:2.1' + LineEnding +
    131         'NOTE:This is some long test which is really multi-lined\neach line\nis on' + LineEnding +
    132         ' different\nline so it is on multiple\nlines.'  + LineEnding +
    133         'END:VCARD' + LineEnding;
     139        'NOTE:First line\nsecond line\nempty line\n\nlast line' + LineEnding +
     140        VCardEnd + LineEnding;
    134141      Output := Input;
    135142    end;
     
    142149    end;
    143150    with TTestCaseLoadSave(AddNew('Begin only', TTestCaseLoadSave)) do begin
    144       Input := 'BEGIN:VCARD';
     151      Input := VCardBegin;
    145152      Output := '';
    146153    end;
    147154    with TTestCaseLoadSave(AddNew('Missing end', TTestCaseLoadSave)) do begin
    148       Input := 'BEGIN:VCARD' + LineEnding +
     155      Input := VCardBegin + LineEnding +
    149156        'VERSION:2.1' + LineEnding +
    150157        'N:Surname;Name' + LineEnding +
    151158        'FN:Name Surname' + LineEnding;
     159      Output := '';
     160    end;
     161    with TTestCaseLoadSave(AddNew('Missing start', TTestCaseLoadSave)) do begin
     162      Input := 'VERSION:2.1' + LineEnding +
     163        'N:Surname;Name' + LineEnding +
     164        'FN:Name Surname' + LineEnding +
     165        VCardEnd + LineEnding;
    152166      Output := '';
    153167    end;
Note: See TracChangeset for help on using the changeset viewer.