Changeset 146 for trunk


Ignore:
Timestamp:
Aug 30, 2022, 7:56:17 PM (2 years ago)
Author:
chronos
Message:
  • Modified: General test part moved into Common package.
Location:
trunk
Files:
3 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormTest.lfm

    r127 r146  
    1010  OnClose = FormClose
    1111  OnCreate = FormCreate
    12   OnDestroy = FormDestroy
    1312  OnShow = FormShow
    14   LCLVersion = '2.2.0.4'
     13  LCLVersion = '2.2.2.0'
    1514  object ListViewTestCases: TListView
    1615    Left = 19
     
    5554    Anchors = [akLeft, akBottom]
    5655    Caption = '   '
     56    ParentColor = False
    5757  end
    5858  object ActionList1: TActionList
  • trunk/Forms/UFormTest.pas

    r129 r146  
    55uses
    66  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls,
    7   ActnList, Menus, UTest;
     7  ActnList, Menus, UTest, UTestCase;
    88
    99type
     
    2626    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    2727    procedure FormCreate(Sender: TObject);
    28     procedure FormDestroy(Sender: TObject);
    2928    procedure FormShow(Sender: TObject);
    3029    procedure ListViewTestCasesData(Sender: TObject; Item: TListItem);
     
    5958    Item.Caption := Name;
    6059    Item.Data := TestCases[Item.Index];
    61     Item.SubItems.Add(ResultText[Result]);
     60    Item.SubItems.Add(ResultText[TestResult]);
    6261  end;
    6362end;
     
    9796  Failed := 0;
    9897  for I := 0 to TestCases.Count - 1 do begin
    99     case TestCases[I].Result of
     98    case TestCases[I].TestResult of
    10099      trPassed: Inc(Passed);
    101100      trFailed: Inc(Failed);
     
    148147end;
    149148
    150 procedure TFormTest.FormDestroy(Sender: TObject);
    151 begin
    152 end;
    153 
    154149procedure TFormTest.FormShow(Sender: TObject);
    155150begin
  • trunk/Languages/vCardStudio.cs.po

    r142 r146  
    12601260msgstr "Očekáváno:"
    12611261
    1262 #: utest.sfailed
    1263 msgctxt "utest.sfailed"
    1264 msgid "Failed"
    1265 msgstr "Selhalo"
    1266 
    1267 #: utest.snone
    1268 msgid "None"
    1269 msgstr "Žádný"
    1270 
    12711262#: utest.soutput
    12721263msgid "Output:"
    12731264msgstr "Výstup:"
    1274 
    1275 #: utest.spassed
    1276 msgctxt "utest.spassed"
    1277 msgid "Passed"
    1278 msgstr "Prošlo"
    12791265
    12801266#: uvcardfile.svcardfile
     
    12821268msgid "vCard file"
    12831269msgstr "Soubor vCard"
     1270
  • trunk/Languages/vCardStudio.pot

    r138 r146  
    12331233msgstr ""
    12341234
    1235 #: utest.sfailed
    1236 msgctxt "utest.sfailed"
    1237 msgid "Failed"
    1238 msgstr ""
    1239 
    1240 #: utest.snone
    1241 msgid "None"
    1242 msgstr ""
    1243 
    12441235#: utest.soutput
    12451236msgid "Output:"
    1246 msgstr ""
    1247 
    1248 #: utest.spassed
    1249 msgctxt "utest.spassed"
    1250 msgid "Passed"
    12511237msgstr ""
    12521238
  • trunk/Languages/vCardStudio.sv.po

    r138 r146  
    12721272msgstr ""
    12731273
    1274 #: utest.sfailed
    1275 msgctxt "utest.sfailed"
    1276 msgid "Failed"
    1277 msgstr ""
    1278 
    1279 #: utest.snone
    1280 msgid "None"
    1281 msgstr ""
    1282 
    12831274#: utest.soutput
    12841275msgid "Output:"
    1285 msgstr ""
    1286 
    1287 #: utest.spassed
    1288 msgctxt "utest.spassed"
    1289 msgid "Passed"
    12901276msgstr ""
    12911277
  • trunk/Packages/Common/Common.lpk

    r135 r146  
    4242    <License Value="Copy left."/>
    4343    <Version Minor="10"/>
    44     <Files Count="30">
     44    <Files Count="31">
    4545      <Item1>
    4646        <Filename Value="StopWatch.pas"/>
     
    175175        <UnitName Value="UDataFile"/>
    176176      </Item30>
     177      <Item31>
     178        <Filename Value="UTestCase.pas"/>
     179        <UnitName Value="UTestCase"/>
     180      </Item31>
    177181    </Files>
    178182    <CompatibilityMode Value="True"/>
  • trunk/UCore.pas

    r135 r146  
    115115
    116116uses
    117   UFormMain, UFormSettings, UFormContacts, UFormFindDuplicity, UTest,
     117  UFormMain, UFormSettings, UFormContacts, UFormFindDuplicity, UTestCase,
    118118  UFormGenerate, UFormError, UFormFind, UFormTest, UFormSource, UFormCompare,
    119119  UTestCases, UVCardFile;
     
    453453procedure TCore.TranslatorTranslate(Sender: TObject);
    454454begin
    455   UTest.Translate;
     455  UTestCase.Translate;
    456456end;
    457457
  • trunk/UTest.pas

    r138 r146  
    44
    55uses
    6   Classes, SysUtils, Generics.Collections, UVCard;
     6  Classes, SysUtils, Generics.Collections, UVCard, UTestCase;
    77
    88type
    9   TTestResult = (trNone, trPassed, trFailed);
    10 
    11   { TTestCase }
    12 
    13   TTestCase = class
    14   public
    15     Name: string;
    16     Result: TTestResult;
    17     Log: string;
    18     procedure Run; virtual;
    19     procedure Evaluate(Passed: Boolean);
    20     procedure Pass;
    21     procedure Fail;
    22   end;
    23 
    24   TTestCaseClass = class of TTestCase;
    25 
    26   { TTestCases }
    27 
    28   TTestCases = class(TObjectList<TTestCase>)
    29     function AddNew(Name: string; TestClass: TTestCaseClass): TTestCase;
    30   end;
    319
    3210  TTestCaseActionKind = (akNone, akRemoveExactDuplicates);
     
    5129  end;
    5230
    53 resourcestring
    54   SNone = 'None';
    55   SPassed = 'Passed';
    56   SFailed = 'Failed';
    57 
    58 const
    59   ResultText: array[TTestResult] of string = (SNone, SPassed, SFailed);
    60 
    61 procedure Translate;
    62 
    6331
    6432implementation
     
    7038  SExpected = 'Expected:';
    7139  SOutput = 'Output:';
    72 
    73 procedure Translate;
    74 begin
    75   ResultText[trNone] := SNone;
    76   ResultText[trPassed] := SPassed;
    77   ResultText[trFailed] := SFailed;
    78 end;
    7940
    8041{ TTestCaseCheckProperty }
     
    13899end;
    139100
    140 { TTestCase }
    141 
    142 procedure TTestCase.Run;
    143 begin
    144 end;
    145 
    146 procedure TTestCase.Evaluate(Passed: Boolean);
    147 begin
    148   if Passed then Result := trPassed
    149     else Result := trFailed;
    150 end;
    151 
    152 procedure TTestCase.Pass;
    153 begin
    154   Result := trPassed;
    155 end;
    156 
    157 procedure TTestCase.Fail;
    158 begin
    159   Result := trFailed;
    160 end;
    161 
    162 { TTestCases }
    163 
    164 function TTestCases.AddNew(Name: string; TestClass: TTestCaseClass): TTestCase;
    165 begin
    166   Result := TestClass.Create;
    167   Result.Name := Name;
    168   Add(Result);
    169 end;
    170 
    171101end.
    172102
  • trunk/UTestCases.pas

    r135 r146  
    44
    55uses
    6   Classes, SysUtils, UTest;
     6  Classes, SysUtils, UTest, UTestCase;
    77
    88function InitTestCases: TTestCases;
  • trunk/vCardStudio.lpi

    r138 r146  
    271271        <IsPartOfProject Value="True"/>
    272272        <ComponentName Value="FormColumns"/>
     273        <HasResources Value="True"/>
    273274        <ResourceBaseClass Value="Form"/>
    274275      </Unit23>
Note: See TracChangeset for help on using the changeset viewer.