Ignore:
Timestamp:
Feb 15, 2022, 5:09:10 PM (2 years ago)
Author:
chronos
Message:
  • Fixed: Fully disable automatic max. line width detection.
  • Added: More tests.
  • Added: Show number of passing and failing tests in test window.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormTest.pas

    r104 r116  
    1818    ActionList1: TActionList;
    1919    ButtonRun: TButton;
     20    LabelResult: TLabel;
    2021    ListViewTestCases: TListView;
    2122    MenuItem1: TMenuItem;
     
    5152  UCore, UFormTestCase, UContact;
    5253
     54resourcestring
     55  SPassed = 'Passed';
     56  SFailed = 'Failed';
     57
    5358{ TFormTest }
    5459
     
    7883var
    7984  Selected: Boolean;
     85  Passed: Integer;
     86  Failed: Integer;
     87  I: Integer;
    8088begin
    8189  Selected := Assigned(ListViewTestCases.Selected);
    8290  ARun.Enabled := Selected;
    8391  AShow.Enabled := Selected;
     92
     93  Passed := 0;
     94  Failed := 0;
     95  for I := 0 to TestCases.Count - 1 do begin
     96    case TestCases[I].Result of
     97      trPassed: Inc(Passed);
     98      trFailed: Inc(Failed);
     99    end;
     100  end;
     101  LabelResult.Caption := SPassed + ' ' + IntToStr(Passed) + ', ' +
     102    SFailed + ' ' + IntToStr(Failed);
    84103end;
    85104
     
    101120      Input := VCardBegin + LineEnding +
    102121        VCardVersion + LineEnding +
    103         'NOTE:This is some long test which is really multi-lined each line is on d' + LineEnding +
    104         ' ifferent line so it is on multiple lines.' + 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 +
    105124        VCardEnd + LineEnding;
    106125      Output := Input;
     
    123142      Input := VCardBegin + LineEnding +
    124143        VCardVersion + LineEnding +
    125         'FN;ENCODING=QUOTED-PRINTABLE:Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD=' + LineEnding +
    126         'Jm=C3=A9no=20P=C5=99=C3=ADjmen=C3=AD' + LineEnding +
    127         VCardEnd + LineEnding;
    128       Output := Input;
    129     end;
    130     //AddNew('Encoding base64', TTestCaseLoadSave);
    131     //AddNew('Encoding quoted-printable', TTestCaseLoadSave);
     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 begin
     150      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 begin
     157      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 begin
     164      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 begin
     171      Input := VCardBegin + LineEnding +
     172        VCardVersion + LineEnding +
     173        'FN;ENCODING=BASE64:U29tZSB2ZXJ5IGxvbmcgc3RyaW5nIFNvbWUgdmVyeSBsb25nIHN0cmlu' + LineEnding +
     174        ' ZyBTb21lIHZlcnkgbG9uZyBzdHJpbmcgU29tZSB2ZXJ5IGxvbmcgc3RyaW5n' + LineEnding +
     175        VCardEnd + LineEnding;
     176      Output := Input;
     177    end;
    132178    //AddNew('Image format', TTestCaseLoadSave);
    133179    with TTestCaseLoadSave(AddNew('Empty', TTestCaseLoadSave)) do begin
     
    153199      Output := '';
    154200    end;
    155     with TTestCaseCheckProperty(AddNew('Propery FN', TTestCaseCheckProperty)) do begin
     201    with TTestCaseCheckProperty(AddNew('Property FN', TTestCaseCheckProperty)) do begin
    156202      Index := cfFullName;
    157203      Value := 'Name Surname';
     
    185231        VCardEnd + LineEnding;
    186232    end;
     233    with TTestCaseCheckProperty(AddNew('Base64 special symbols', TTestCaseCheckProperty)) do begin
     234      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;
    187241  end;
    188242end;
     
    200254    TestCases[I].Run;
    201255  ReloadList;
     256  UpdateInterface;
    202257end;
    203258
     
    219274    TTestCase(ListViewTestCases.Selected.Data).Run;
    220275    ReloadList;
     276    UpdateInterface;
    221277  end;
    222278end;
Note: See TracChangeset for help on using the changeset viewer.