- Timestamp:
- Apr 6, 2022, 11:36:27 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r120 r126 1 1 object FormMain: TFormMain 2 2 Left = 553 3 Height = 8293 Height = 796 4 4 Top = 401 5 Width = 1 2275 Width = 1178 6 6 Caption = 'vCard Studio' 7 ClientHeight = 7 948 ClientWidth = 1 2279 DesignTimePPI = 1 507 ClientHeight = 762 8 ClientWidth = 1178 9 DesignTimePPI = 144 10 10 Menu = MainMenu1 11 11 OnClose = FormClose … … 18 18 object CoolBar1: TCoolBar 19 19 Left = 0 20 Height = 4 420 Height = 43 21 21 Top = 0 22 Width = 1 22722 Width = 1178 23 23 AutoSize = True 24 24 Bands = < … … 39 39 AnchorSideTop.Control = CoolBar1 40 40 Left = 24 41 Height = 3 441 Height = 33 42 42 Top = 5 43 Width = 1 6443 Width = 159 44 44 Align = alNone 45 45 AutoSize = True … … 60 60 end 61 61 object ToolButton2: TToolButton 62 Left = 3 762 Left = 36 63 63 Top = 0 64 64 Action = Core.AFileOpen … … 67 67 end 68 68 object ToolButton3: TToolButton 69 Left = 9269 Left = 89 70 70 Top = 0 71 71 Action = Core.AFileSave 72 72 end 73 73 object ToolButton4: TToolButton 74 Left = 12 874 Left = 124 75 75 Top = 0 76 76 Action = Core.AFileClose … … 81 81 AnchorSideTop.Control = CoolBar1 82 82 Left = 188 83 Height = 3 483 Height = 33 84 84 Top = 5 85 Width = 14 585 Width = 141 86 86 Align = alNone 87 87 AutoSize = True … … 97 97 Transparent = True 98 98 object ToolButton5: TToolButton 99 Left = 10 999 Left = 106 100 100 Top = 0 101 101 Action = Core.ASettings 102 102 end 103 103 object ToolButton6: TToolButton 104 Left = 3 7104 Left = 36 105 105 Top = 0 106 106 Action = Core.AFindDuplicate … … 112 112 end 113 113 object ToolButton8: TToolButton 114 Left = 7 3114 Left = 71 115 115 Top = 0 116 116 Action = Core.AFileCompare … … 120 120 object MainMenu1: TMainMenu 121 121 Images = Core.ImageList1 122 Left = 200123 Top = 12 5122 Left = 192 123 Top = 120 124 124 object MenuItemFile: TMenuItem 125 125 Caption = 'File' … … 186 186 Caption = '-' 187 187 end 188 object MenuItem13: TMenuItem 189 Action = Core.ARemoveExactDuplicates 190 end 188 191 object MenuItem5: TMenuItem 189 192 Action = Core.AGenerate … … 207 210 end 208 211 object PopupMenuOpenRecent: TPopupMenu 209 Left = 4 38210 Top = 12 5212 Left = 420 213 Top = 120 211 214 end 212 215 end -
trunk/Forms/UFormMain.pas
r120 r126 20 20 MenuItem11: TMenuItem; 21 21 MenuItem12: TMenuItem; 22 MenuItem13: TMenuItem; 22 23 MenuItem3: TMenuItem; 23 24 MenuItem4: TMenuItem; -
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 -
trunk/Languages/vCardStudio.cs.po
r123 r126 81 81 msgstr "Nástroj pro správu souborů vCard" 82 82 83 #: tcore.aremoveexactduplicates.caption 84 msgid "Remove exact duplicates" 85 msgstr "Odstranit přesné duplikáty" 86 83 87 #: tcore.asettings.caption 84 88 msgctxt "tcore.asettings.caption" … … 1569 1573 1570 1574 #: uformtest.sfailed 1575 msgctxt "uformtest.sfailed" 1571 1576 msgid "Failed" 1572 1577 msgstr "Selhalo" 1573 1578 1574 1579 #: uformtest.spassed 1580 msgctxt "uformtest.spassed" 1575 1581 msgid "Passed" 1576 1582 msgstr "Prošlo" … … 1579 1585 msgid "Decode error" 1580 1586 msgstr "Chyba dekódování" 1587 1588 #: utest.sexpected 1589 msgid "Expected:" 1590 msgstr "Očekáváno:" 1591 1592 #: utest.sfailed 1593 msgctxt "utest.sfailed" 1594 msgid "Failed" 1595 msgstr "Selhalo" 1596 1597 #: utest.snone 1598 msgid "None" 1599 msgstr "Žádný" 1600 1601 #: utest.soutput 1602 msgid "Output:" 1603 msgstr "Výstup:" 1604 1605 #: utest.spassed 1606 msgctxt "utest.spassed" 1607 msgid "Passed" 1608 msgstr "Prošlo" -
trunk/Languages/vCardStudio.pot
r123 r126 71 71 msgstr "" 72 72 73 #: tcore.aremoveexactduplicates.caption 74 msgid "Remove exact duplicates" 75 msgstr "" 76 73 77 #: tcore.asettings.caption 74 78 msgctxt "tcore.asettings.caption" … … 1541 1545 1542 1546 #: uformtest.sfailed 1547 msgctxt "uformtest.sfailed" 1543 1548 msgid "Failed" 1544 1549 msgstr "" 1545 1550 1546 1551 #: uformtest.spassed 1552 msgctxt "uformtest.spassed" 1547 1553 msgid "Passed" 1548 1554 msgstr "" … … 1552 1558 msgstr "" 1553 1559 1560 #: utest.sexpected 1561 msgid "Expected:" 1562 msgstr "" 1563 1564 #: utest.sfailed 1565 msgctxt "utest.sfailed" 1566 msgid "Failed" 1567 msgstr "" 1568 1569 #: utest.snone 1570 msgid "None" 1571 msgstr "" 1572 1573 #: utest.soutput 1574 msgid "Output:" 1575 msgstr "" 1576 1577 #: utest.spassed 1578 msgctxt "utest.spassed" 1579 msgid "Passed" 1580 msgstr "" 1581 -
trunk/Languages/vCardStudio.sv.po
r123 r126 82 82 msgstr "vCard filhanteringsverktyg" 83 83 84 #: tcore.aremoveexactduplicates.caption 85 msgid "Remove exact duplicates" 86 msgstr "" 87 84 88 #: tcore.asettings.caption 85 89 msgctxt "tcore.asettings.caption" … … 1579 1583 1580 1584 #: uformtest.sfailed 1585 msgctxt "uformtest.sfailed" 1581 1586 msgid "Failed" 1582 1587 msgstr "" 1583 1588 1584 1589 #: uformtest.spassed 1590 msgctxt "uformtest.spassed" 1585 1591 msgid "Passed" 1586 1592 msgstr "" … … 1590 1596 msgstr "Avkodningsfel" 1591 1597 1598 #: utest.sexpected 1599 msgid "Expected:" 1600 msgstr "" 1601 1602 #: utest.sfailed 1603 msgctxt "utest.sfailed" 1604 msgid "Failed" 1605 msgstr "" 1606 1607 #: utest.snone 1608 msgid "None" 1609 msgstr "" 1610 1611 #: utest.soutput 1612 msgid "Output:" 1613 msgstr "" 1614 1615 #: utest.spassed 1616 msgctxt "utest.spassed" 1617 msgid "Passed" 1618 msgstr "" 1619 -
trunk/UContact.pas
r120 r126 136 136 NoGroups: TStringArray): Boolean; 137 137 procedure Assign(Source: TContactProperty); 138 function CompareTo(ContactProperty: TContactProperty): Boolean; 138 139 constructor Create; 139 140 destructor Destroy; override; … … 179 180 procedure Assign(Source: TContact); 180 181 function UpdateFrom(Source: TContact): Boolean; 182 function CompareTo(Contact: TContact): Boolean; 181 183 constructor Create; 182 184 destructor Destroy; override; … … 208 210 procedure Merge(Contact: TContact; FieldIndex: TContactFieldIndex); 209 211 function ToString: ansistring; override; 212 procedure RemoveExactDuplicates; 210 213 end; 211 214 … … 1049 1052 end; 1050 1053 1054 function TContactProperty.CompareTo(ContactProperty: TContactProperty): Boolean; 1055 var 1056 I: Integer; 1057 begin 1058 Result := (Name = ContactProperty.Name) and (Value = ContactProperty.Value) and 1059 (Attributes.Count = ContactProperty.Attributes.Count); 1060 if Result then begin 1061 for I := 0 to Attributes.Count - 1 do 1062 if not (Attributes[I] = ContactProperty.Attributes[I]) then begin 1063 Result := False; 1064 Break; 1065 end; 1066 end; 1067 end; 1068 1051 1069 constructor TContactProperty.Create; 1052 1070 begin … … 1080 1098 1081 1099 procedure TContacts.AddContacts(Contacts: TContacts); 1082 var 1083 I: Integer; 1084 NewContact: TContact; 1085 begin 1086 for I := 0 to Contacts.Count - 1 do begin 1087 NewContact := TContact.Create; 1088 NewContact.Assign(Contacts[I]); 1089 NewContact.ContactsFile := ContactsFile; 1090 Add(NewContact); 1091 end; 1100 begin 1101 InsertContacts(Count, Contacts); 1092 1102 end; 1093 1103 … … 1104 1114 Inc(Index); 1105 1115 end; 1116 end; 1117 1118 procedure TContacts.RemoveExactDuplicates; 1119 var 1120 I: Integer; 1121 J: Integer; 1122 begin 1123 for I := 0 to Count - 1 do 1124 for J := Count - 1 downto I + 1 do 1125 if Items[I].CompareTo(Items[J]) then begin 1126 Remove(Items[J]); 1127 end; 1106 1128 end; 1107 1129 … … 1554 1576 end; 1555 1577 1578 function TContact.CompareTo(Contact: TContact): Boolean; 1579 var 1580 I: Integer; 1581 begin 1582 Result := Properties.Count = Contact.Properties.Count; 1583 if Result then begin 1584 for I := 0 to Properties.Count - 1 do 1585 if not Properties[I].CompareTo(Contact.Properties[I]) then begin 1586 Result := False; 1587 Break; 1588 end; 1589 end; 1590 end; 1591 1556 1592 constructor TContact.Create; 1557 1593 begin -
trunk/UCore.lfm
r123 r126 3 3 OnDestroy = DataModuleDestroy 4 4 OldCreateOrder = False 5 Height = 5 516 HorizontalOffset = 6 977 VerticalOffset = 6 328 Width = 7 569 PPI = 1 505 Height = 529 6 HorizontalOffset = 669 7 VerticalOffset = 607 8 Width = 726 9 PPI = 144 10 10 object ImageList1: TImageList 11 Left = 1 2012 Top = 20 811 Left = 115 12 Top = 200 13 13 Bitmap = { 14 14 4C7A1300000010000000100000008B1500000000000078DADD9B075854C7DAC7 … … 190 190 object ActionList1: TActionList 191 191 Images = ImageList1 192 Left = 400193 Top = 20 8192 Left = 384 193 Top = 200 194 194 object AExit: TAction 195 195 Caption = 'Exit' … … 293 293 OnExecute = AFileCompareExecute 294 294 end 295 object ARemoveExactDuplicates: TAction 296 Caption = 'Remove exact duplicates' 297 OnExecute = ARemoveExactDuplicatesExecute 298 end 295 299 end 296 300 object LastOpenedList1: TLastOpenedList 297 301 MaxCount = 10 298 302 OnChange = LastOpenedList1Change 299 Left = 400300 Top = 300303 Left = 384 304 Top = 288 301 305 end 302 306 object OpenDialog1: TOpenDialog 303 307 Title = 'Open existing file' 304 Left = 400305 Top = 3 80308 Left = 384 309 Top = 365 306 310 end 307 311 object SaveDialog1: TSaveDialog 308 312 Title = 'Save file as' 309 Left = 1 20310 Top = 3 80313 Left = 115 314 Top = 365 311 315 end 312 316 object ApplicationInfo1: TApplicationInfo … … 321 325 AppName = 'vCard Studio' 322 326 Description = 'vCard files management tool' 323 ReleaseDate = 446 36327 ReleaseDate = 44687 324 328 RegistryKey = '\Software\Chronosoft\vCard Studio' 325 329 RegistryRoot = rrKeyCurrentUser … … 8521 8525 0000000000000000000000000000000000000000000000000000 8522 8526 } 8523 Left = 1 208524 Top = 3008527 Left = 115 8528 Top = 288 8525 8529 end 8526 8530 object PersistentForm1: TPersistentForm 8527 8531 MinVisiblePart = 50 8528 8532 EntireVisible = False 8529 Left = 4008530 Top = 1 308533 Left = 384 8534 Top = 125 8531 8535 end 8532 8536 object Translator: TTranslator 8533 8537 POFilesFolder = 'Languages' 8534 Left = 120 8535 Top = 50 8538 OnTranslate = TranslatorTranslate 8539 Left = 115 8540 Top = 48 8536 8541 end 8537 8542 object ScaleDPI1: TScaleDPI 8538 8543 AutoDetect = False 8539 Left = 4008540 Top = 508544 Left = 384 8545 Top = 48 8541 8546 end 8542 8547 object ThemeManager1: TThemeManager 8543 Left = 1 208544 Top = 1 308548 Left = 115 8549 Top = 125 8545 8550 end 8546 8551 object AboutDialog1: TAboutDialog … … 8548 8553 ThemeManager = ThemeManager1 8549 8554 ApplicationInfo = ApplicationInfo1 8550 Left = 6008551 Top = 508555 Left = 576 8556 Top = 48 8552 8557 end 8553 8558 object SelectDirectoryDialog1: TSelectDirectoryDialog 8554 8559 Title = 'Select directory' 8555 Left = 6028556 Top = 3 928560 Left = 578 8561 Top = 376 8557 8562 end 8558 8563 end -
trunk/UCore.lrj
r120 r126 18 18 {"hash":131740677,"name":"tcore.aviewsource.caption","sourcebytes":[86,105,101,119,32,115,111,117,114,99,101],"value":"View source"}, 19 19 {"hash":109897550,"name":"tcore.afilecompare.caption","sourcebytes":[67,111,109,112,97,114,101,46,46,46],"value":"Compare..."}, 20 {"hash":78724163,"name":"tcore.aremoveexactduplicates.caption","sourcebytes":[82,101,109,111,118,101,32,101,120,97,99,116,32,100,117,112,108,105,99,97,116,101,115],"value":"Remove exact duplicates"}, 20 21 {"hash":218146437,"name":"tcore.opendialog1.title","sourcebytes":[79,112,101,110,32,101,120,105,115,116,105,110,103,32,102,105,108,101],"value":"Open existing file"}, 21 22 {"hash":159035875,"name":"tcore.savedialog1.title","sourcebytes":[83,97,118,101,32,102,105,108,101,32,97,115],"value":"Save file as"}, -
trunk/UCore.pas
r123 r126 17 17 AAbout: TAction; 18 18 AboutDialog1: TAboutDialog; 19 ARemoveExactDuplicates: TAction; 19 20 AFileCompare: TAction; 20 21 AViewSource: TAction; … … 60 61 procedure AGenerateExecute(Sender: TObject); 61 62 procedure AHomePageExecute(Sender: TObject); 63 procedure ARemoveExactDuplicatesExecute(Sender: TObject); 62 64 procedure ASettingsExecute(Sender: TObject); 63 65 procedure ATestExecute(Sender: TObject); … … 66 68 procedure DataModuleDestroy(Sender: TObject); 67 69 procedure LastOpenedList1Change(Sender: TObject); 70 procedure TranslatorTranslate(Sender: TObject); 68 71 private 69 72 InitializeStarted: Boolean; … … 113 116 114 117 uses 115 UFormMain, UFormSettings, UContact, UFormContacts, UFormFindDuplicity, 116 UFormGenerate, UFormError, UFormFind, UFormTest, UFormSource, UFormCompare; 118 UFormMain, UFormSettings, UContact, UFormContacts, UFormFindDuplicity, UTest, 119 UFormGenerate, UFormError, UFormFind, UFormTest, UFormSource, UFormCompare, 120 UTestCases; 117 121 118 122 resourcestring … … 294 298 end; 295 299 300 procedure TCore.ARemoveExactDuplicatesExecute(Sender: TObject); 301 begin 302 TContactsFile(DataFile).Contacts.RemoveExactDuplicates; 303 UpdateFile; 304 end; 305 296 306 procedure TCore.ASettingsExecute(Sender: TObject); 297 307 begin … … 313 323 with TFormTest.Create(nil) do 314 324 try 315 ShowModal; 325 TestCases := InitTestCases; 326 try 327 ShowModal; 328 finally 329 TestCases.Free; 330 end; 316 331 finally 317 332 Free; … … 428 443 LastOpenedList1.LoadToMenuItem(FormMain.MenuItemFileOpenRecent, AFileOpenRecentExecute); 429 444 LastOpenedList1.LoadToMenuItem(FormMain.PopupMenuOpenRecent.Items, AFileOpenRecentExecute); 445 end; 446 447 procedure TCore.TranslatorTranslate(Sender: TObject); 448 begin 449 UTest.Translate; 430 450 end; 431 451 -
trunk/UTest.pas
r94 r126 32 32 end; 33 33 34 TTestCaseActionKind = (akNone, akRemoveExactDuplicates); 35 34 36 { TTestCaseLoadSave } 35 37 … … 37 39 Input: string; 38 40 Output: string; 41 Action: TTestCaseActionKind; 39 42 procedure Run; override; 40 43 end; … … 50 53 end; 51 54 55 resourcestring 56 SNone = 'None'; 57 SPassed = 'Passed'; 58 SFailed = 'Failed'; 59 52 60 const 53 ResultText: array[TTestResult] of string = ('None', 'Passed', 'Failed'); 61 ResultText: array[TTestResult] of string = (SNone, SPassed, SFailed); 62 63 procedure Translate; 54 64 55 65 56 66 implementation 67 68 resourcestring 69 SExpected = 'Expected:'; 70 SOutput = 'Output:'; 71 72 procedure Translate; 73 begin 74 ResultText[trNone] := SNone; 75 ResultText[trPassed] := SPassed; 76 ResultText[trFailed] := SFailed; 77 end; 57 78 58 79 { TTestCaseCheckProperty } … … 73 94 Evaluate(PropertyValue = Value); 74 95 end else Fail; 75 Log := 'Expected:'+ LineEnding +96 Log := SExpected + LineEnding + 76 97 '"' + Value + '"' + LineEnding + LineEnding + 77 'Output:'+ LineEnding +98 SOutput + LineEnding + 78 99 '"' + PropertyValue + '"'; 79 100 finally … … 97 118 Lines.Text := Input; 98 119 LoadFromStrings(Lines); 120 121 if Action = akRemoveExactDuplicates then 122 Contacts.RemoveExactDuplicates; 123 99 124 Lines.Text := ''; 100 125 SaveToStrings(Lines); 101 126 Evaluate(Lines.Text = Output); 102 Log := 'Expected:'+ LineEnding +127 Log := SExpected + LineEnding + 103 128 '"' + Output + '"' + LineEnding + LineEnding + 104 'Output:'+ LineEnding +129 SOutput + LineEnding + 105 130 '"' + Lines.Text + '"'; 106 131 finally -
trunk/vCardStudio.lpi
r123 r126 119 119 </Item6> 120 120 </RequiredPackages> 121 <Units Count="2 5">121 <Units Count="26"> 122 122 <Unit0> 123 123 <Filename Value="vCardStudio.lpr"/> … … 271 271 <IsPartOfProject Value="True"/> 272 272 </Unit24> 273 <Unit25> 274 <Filename Value="UTestCases.pas"/> 275 <IsPartOfProject Value="True"/> 276 </Unit25> 273 277 </Units> 274 278 </ProjectOptions> -
trunk/vCardStudio.lpr
r120 r126 8 8 {$ENDIF} 9 9 Interfaces, // this includes the LCL widgetset 10 Forms, UFormMain, UCore, Diff, Common, SysUtils, UFormCompare ;10 Forms, UFormMain, UCore, Diff, Common, SysUtils, UFormCompare, UTestCases; 11 11 12 12 {$R *.res}
Note:
See TracChangeset
for help on using the changeset viewer.