Changeset 152 for trunk/TestCases.pas


Ignore:
Timestamp:
Jun 6, 2023, 5:05:18 PM (18 months ago)
Author:
chronos
Message:
  • Added: VCardProcessor class for processing contacts available from VCard package.
  • Added: Normalize menu action for normalization of contact property values.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/TestCases.pas

    r151 r152  
    3939      Input := BeginEnd(
    4040        '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);
     41        ' ferent line so it is on multiple lines.' + VCardLineEnding +
     42        VCardLineEnding);
    4243      Output := Input;
    4344    end;
     
    5556      Input := BeginEnd(
    5657        '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);
     58        'o=20P=C5=99=C3=ADjmen=C3=AD' + VCardLineEnding +
     59        VCardLineEnding);
    5860      Output := Input;
    5961    end;
     
    7678      Input := BeginEnd(
    7779        'FN;ENCODING=BASE64:U29tZSB2ZXJ5IGxvbmcgc3RyaW5nIFNvbWUgdmVyeSBsb25nIHN0cmlu' + VCardLineEnding +
    78         ' ZyBTb21lIHZlcnkgbG9uZyBzdHJpbmcgU29tZSB2ZXJ5IGxvbmcgc3RyaW5n' + VCardLineEnding);
     80        ' ZyBTb21lIHZlcnkgbG9uZyBzdHJpbmcgU29tZSB2ZXJ5IGxvbmcgc3RyaW5n' + VCardLineEnding +
     81        VCardLineEnding);
    7982      Output := Input;
    8083    end;
     
    182185    end;
    183186
     187    with TTestCaseVCardProcessor(AddNew('VCardProcessor - Remove exact duplicates', TTestCaseVCardProcessor)) do begin
     188      Processor.RemoveExactDuplicates := True;
     189      Input := BeginEnd(
     190        'N:Surname;Name' + VCardLineEnding +
     191        'FN:Name Surname' + VCardLineEnding) +
     192        BeginEnd(
     193        'N:Surname2;Name2' + VCardLineEnding +
     194        'FN:Name2 Surname2' + VCardLineEnding) +
     195        BeginEnd(
     196        'N:Surname;Name' + VCardLineEnding +
     197        'FN:Name Surname' + VCardLineEnding) +
     198        BeginEnd(
     199        'N:Surname;Name' + VCardLineEnding +
     200        'FN:Name Surname' + VCardLineEnding +
     201        'NOTE:Note' + VCardLineEnding) +
     202        BeginEnd(
     203        'N:Surname;Name' + VCardLineEnding +
     204        'FN:Name Surname' + VCardLineEnding);
     205      Output := BeginEnd(
     206        'N:Surname;Name' + VCardLineEnding +
     207        'FN:Name Surname' + VCardLineEnding) +
     208        BeginEnd(
     209        'N:Surname2;Name2' + VCardLineEnding +
     210        'FN:Name2 Surname2' + VCardLineEnding) +
     211        BeginEnd(
     212        'N:Surname;Name' + VCardLineEnding +
     213        'FN:Name Surname' + VCardLineEnding +
     214        'NOTE:Note' + VCardLineEnding);
     215    end;
     216    with TTestCaseVCardProcessor(AddNew('VCardProcessor - Remove phone spaces', TTestCaseVCardProcessor)) do begin
     217      Processor.RemovePhoneSpaces := True;
     218      Input := BeginEnd('TEL: 123 456 789 ' + VCardLineEnding) +
     219        BeginEnd('TEL;CELL:919 191 919' + VCardLineEnding);
     220      Output := BeginEnd('TEL:123456789' + VCardLineEnding) +
     221        BeginEnd('TEL;CELL:919191919' + VCardLineEnding);
     222    end;
     223    with TTestCaseVCardProcessor(AddNew('VCardProcessor - Remove photos', TTestCaseVCardProcessor)) do begin
     224      Processor.RemovePhotos := True;
     225      Input := BeginEnd('N:Surname;Name' + VCardLineEnding +
     226        'FN:Name Surname' + VCardLineEnding +
     227        'PHOTO:dadsa' + VCardLineEnding) +
     228        BeginEnd('N:Surname;Name' + VCardLineEnding +
     229        'FN:Name Surname' + VCardLineEnding +
     230        'PHOTO:dadsa' + VCardLineEnding +
     231        'PHOTO:adsadadsa' + VCardLineEnding);
     232      Output := BeginEnd('N:Surname;Name' + VCardLineEnding +
     233        'FN:Name Surname' + VCardLineEnding) +
     234        BeginEnd('N:Surname;Name' + VCardLineEnding +
     235        'FN:Name Surname' + VCardLineEnding);
     236    end;
     237    with TTestCaseVCardProcessor(AddNew('VCardProcessor - Order', TTestCaseVCardProcessor)) do begin
     238      Processor.Order := True;
     239      Input := BeginEnd('N:Surname2;Name2' + VCardLineEnding +
     240        'FN:Name2 Surname2' + VCardLineEnding) +
     241        BeginEnd('N:Surname1;Name1' + VCardLineEnding +
     242        'FN:Name1 Surname1' + VCardLineEnding) +
     243        BeginEnd('N:Surname3;Name3' + VCardLineEnding +
     244        'FN:Name3 Surname3' + VCardLineEnding);
     245      Output := BeginEnd('FN:Name1 Surname1' + VCardLineEnding +
     246        'N:Surname1;Name1' + VCardLineEnding) +
     247        BeginEnd('FN:Name2 Surname2' + VCardLineEnding +
     248        'N:Surname2;Name2'+ VCardLineEnding) +
     249        BeginEnd('FN:Name3 Surname3' + VCardLineEnding +
     250        'N:Surname3;Name3' + VCardLineEnding);
     251    end;
     252    with TTestCaseVCardProcessor(AddNew('VCardProcessor - Add phone country code', TTestCaseVCardProcessor)) do begin
     253      Processor.AddDefaultPhoneCountryPrefix := True;
     254      Processor.DefaultPhoneCountryCode := '+470';
     255      Processor.NonPrefixedPhoneLength := 9;
     256      Input := BeginEnd('TEL: 123 456 789 ' + VCardLineEnding) +
     257        BeginEnd('TEL;CELL:919 191 919' + VCardLineEnding) +
     258        BeginEnd('TEL;CELL:+421 919 191 919' + VCardLineEnding) +
     259        BeginEnd('TEL;CELL:*#1234' + VCardLineEnding);
     260      Output := BeginEnd('TEL:+470 123 456 789 ' + VCardLineEnding) +
     261        BeginEnd('TEL;CELL:+470919 191 919' + VCardLineEnding) +
     262        BeginEnd('TEL;CELL:+421 919 191 919' + VCardLineEnding) +
     263        BeginEnd('TEL;CELL:*#1234' + VCardLineEnding);
     264    end;
     265    with TTestCaseVCardProcessor(AddNew('VCardProcessor - Convert international call prefix to country code', TTestCaseVCardProcessor)) do begin
     266      Processor.ConvertInternationalCallPrefixToCountryCode := True;
     267      Processor.DefaultInternationalCallPrefix := '00420';
     268      Processor.DefaultPhoneCountryCode := '+470';
     269      Input := BeginEnd('TEL:00420123456789' + VCardLineEnding) +
     270        BeginEnd('TEL;CELL:00420 919 191 919 ' + VCardLineEnding) +
     271        BeginEnd('TEL;CELL:00421919191919' + VCardLineEnding);
     272      Output := BeginEnd('TEL:+470123456789' + VCardLineEnding) +
     273        BeginEnd('TEL;CELL:+470 919 191 919 ' + VCardLineEnding) +
     274        BeginEnd('TEL;CELL:00421919191919' + VCardLineEnding);
     275    end;
     276
    184277    with TTestCaseLoadSave(AddNew('Merge same cell phone', TTestCaseLoadSave)) do begin
    185278      Input := VCardBegin + MacLineEnding +
Note: See TracChangeset for help on using the changeset viewer.