diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2012-11-22 13:44:48 +0000 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2012-11-22 13:44:48 +0000 |
commit | b724071c324075b0f2aa4504f31d4653bbca2bef (patch) | |
tree | 68e84d16db499c2615cae1fb9b3d2237792d3468 /prototypes/miglayout | |
parent | e8e88b91fdcb45eac3869a09afaae2a3d29704b0 (diff) | |
download | fpGUI-b724071c324075b0f2aa4504f31d4653bbca2bef.tar.xz |
Converted miglayout unit test project to the FPTest (DUnit2) testing framework.
Diffstat (limited to 'prototypes/miglayout')
-rw-r--r-- | prototypes/miglayout/unittests/constraintparser_tests.pas | 69 | ||||
-rw-r--r-- | prototypes/miglayout/unittests/fpcunit_miglayout.lpi | 31 | ||||
-rw-r--r-- | prototypes/miglayout/unittests/fpcunit_miglayout.lpr | 23 |
3 files changed, 61 insertions, 62 deletions
diff --git a/prototypes/miglayout/unittests/constraintparser_tests.pas b/prototypes/miglayout/unittests/constraintparser_tests.pas index e4746d28..3351dc21 100644 --- a/prototypes/miglayout/unittests/constraintparser_tests.pas +++ b/prototypes/miglayout/unittests/constraintparser_tests.pas @@ -5,7 +5,7 @@ unit constraintparser_tests; interface uses - Classes, SysUtils, fpcunit, testregistry, gui_mig_constraintparser, + Classes, SysUtils, TestFramework, gui_mig_constraintparser, gui_mig_lc; type @@ -30,23 +30,23 @@ var lc: TLC; begin lc := cp.ParseLayoutConstraint('ltr'); - AssertNotNull('Failed on 1', lc); - AssertTrue('Failed on 2', lc.LeftToRight); + CheckNotNull(lc, 'Failed on 1'); + CheckTrue(lc.LeftToRight_prop, 'Failed on 2'); FreeAndNil(lc); lc := cp.ParseLayoutConstraint(' ltr '); - AssertNotNull('Failed on 3', lc); - AssertTrue('Failed on 4', lc.LeftToRight); + CheckNotNull(lc, 'Failed on 3'); + CheckTrue(lc.LeftToRight_prop, 'Failed on 4'); FreeAndNil(lc); lc := cp.ParseLayoutConstraint('rtl'); - AssertNotNull('Failed on 5', lc); - AssertFalse('Failed on 6', lc.LeftToRight); + CheckNotNull(lc, 'Failed on 5'); + CheckFalse(lc.LeftToRight_prop, 'Failed on 6'); FreeAndNil(lc); lc := cp.ParseLayoutConstraint(' rtl '); - AssertNotNull('Failed on 7', lc); - AssertFalse('Failed on 8', lc.LeftToRight); + CheckNotNull(lc, 'Failed on 7'); + CheckFalse(lc.LeftToRight_prop, 'Failed on 8'); FreeAndNil(lc); end; @@ -55,23 +55,23 @@ var lc: TLC; begin lc := cp.ParseLayoutConstraint('lefttoright'); - AssertNotNull('Failed on 1', lc); - AssertTrue('Failed on 2', lc.LeftToRight); + CheckNotNull(lc, 'Failed on 1'); + CheckTrue(lc.LeftToRight_prop, 'Failed on 2'); FreeAndNil(lc); lc := cp.ParseLayoutConstraint(' lefttoright '); - AssertNotNull('Failed on 3', lc); - AssertTrue('Failed on 4', lc.LeftToRight); + CheckNotNull(lc, 'Failed on 3'); + CheckTrue(lc.LeftToRight_prop, 'Failed on 4'); FreeAndNil(lc); lc := cp.ParseLayoutConstraint('righttoleft'); - AssertNotNull('Failed on 5', lc); - AssertFalse('Failed on 6', lc.LeftToRight); + CheckNotNull(lc, 'Failed on 5'); + CheckFalse(lc.LeftToRight_prop, 'Failed on 6'); FreeAndNil(lc); lc := cp.ParseLayoutConstraint(' righttoleft '); - AssertNotNull('Failed on 7', lc); - AssertFalse('Failed on 8', lc.LeftToRight); + CheckNotNull(lc, 'Failed on 7'); + CheckFalse(lc.LeftToRight_prop, 'Failed on 8'); FreeAndNil(lc); end; @@ -80,23 +80,23 @@ var lc: TLC; begin lc := cp.ParseLayoutConstraint('ttb'); - AssertNotNull('Failed on 1', lc); - AssertTrue('Failed on 2', lc.TopToBottom); + CheckNotNull(lc, 'Failed on 1'); + CheckTrue(lc.TopToBottom_prop, 'Failed on 2'); FreeAndNil(lc); lc := cp.ParseLayoutConstraint(' ttb '); - AssertNotNull('Failed on 3', lc); - AssertTrue('Failed on 4', lc.TopToBottom); + CheckNotNull(lc, 'Failed on 3'); + CheckTrue(lc.TopToBottom_prop, 'Failed on 4'); FreeAndNil(lc); lc := cp.ParseLayoutConstraint('btt'); - AssertNotNull('Failed on 5', lc); - AssertFalse('Failed on 6', lc.TopToBottom); + CheckNotNull(lc, 'Failed on 5'); + CheckFalse(lc.TopToBottom_prop, 'Failed on 6'); FreeAndNil(lc); lc := cp.ParseLayoutConstraint(' btt '); - AssertNotNull('Failed on 7', lc); - AssertFalse('Failed on 8', lc.TopToBottom); + CheckNotNull(lc, 'Failed on 7'); + CheckFalse(lc.TopToBottom_prop, 'Failed on 8'); FreeAndNil(lc); end; @@ -105,23 +105,23 @@ var lc: TLC; begin lc := cp.ParseLayoutConstraint('toptobottom'); - AssertNotNull('Failed on 1', lc); - AssertTrue('Failed on 2', lc.TopToBottom); + CheckNotNull(lc, 'Failed on 1'); + CheckTrue(lc.TopToBottom_prop, 'Failed on 2'); FreeAndNil(lc); lc := cp.ParseLayoutConstraint(' toptobottom '); - AssertNotNull('Failed on 3', lc); - AssertTrue('Failed on 4', lc.TopToBottom); + CheckNotNull(lc, 'Failed on 3'); + CheckTrue(lc.TopToBottom_prop, 'Failed on 4'); FreeAndNil(lc); lc := cp.ParseLayoutConstraint('bottomtotop'); - AssertNotNull('Failed on 5', lc); - AssertFalse('Failed on 6', lc.TopToBottom); + CheckNotNull(lc, 'Failed on 5'); + CheckFalse(lc.TopToBottom_prop, 'Failed on 6'); FreeAndNil(lc); lc := cp.ParseLayoutConstraint(' bottomtotop '); - AssertNotNull('Failed on 7', lc); - AssertFalse('Failed on 8', lc.TopToBottom); + CheckNotNull(lc, 'Failed on 7'); + CheckFalse(lc.TopToBottom_prop, 'Failed on 8'); FreeAndNil(lc); end; @@ -135,8 +135,9 @@ begin cp.Free; end; + initialization + RegisterTest(TTestConstraintParser.Suite); - RegisterTest(TTestConstraintParser); end. diff --git a/prototypes/miglayout/unittests/fpcunit_miglayout.lpi b/prototypes/miglayout/unittests/fpcunit_miglayout.lpi index c036fb5a..940690fb 100644 --- a/prototypes/miglayout/unittests/fpcunit_miglayout.lpi +++ b/prototypes/miglayout/unittests/fpcunit_miglayout.lpi @@ -1,8 +1,7 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <PathDelim Value="/"/> - <Version Value="7"/> + <Version Value="9"/> <General> <Flags> <SaveOnlyProjectUnits Value="True"/> @@ -10,11 +9,13 @@ </Flags> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <TargetFileExt Value=""/> </General> <VersionInfo> - <ProjectVersion Value=""/> + <StringTable ProductVersion=""/> </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="default" Default="True"/> + </BuildModes> <PublishOptions> <Version Value="2"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> @@ -26,13 +27,10 @@ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> </local> </RunParams> - <RequiredPackages Count="2"> + <RequiredPackages Count="1"> <Item1> - <PackageName Value="FPCUnitConsoleRunner"/> + <PackageName Value="fptest_fpgui"/> </Item1> - <Item2> - <PackageName Value="FCL"/> - </Item2> </RequiredPackages> <Units Count="3"> <Unit0> @@ -53,13 +51,20 @@ </Units> </ProjectOptions> <CompilerOptions> - <Version Value="8"/> + <Version Value="9"/> <SearchPaths> - <OtherUnitFiles Value="../"/> + <OtherUnitFiles Value=".."/> </SearchPaths> + <Parsing> + <SyntaxOptions> + <UseAnsiStrings Value="False"/> + </SyntaxOptions> + </Parsing> <Other> - <CustomOptions Value="-FUunits -"/> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CustomOptions Value="-FUunits"/> <CompilerPath Value="$(CompPath)"/> </Other> </CompilerOptions> diff --git a/prototypes/miglayout/unittests/fpcunit_miglayout.lpr b/prototypes/miglayout/unittests/fpcunit_miglayout.lpr index 486c9cdf..c42944a2 100644 --- a/prototypes/miglayout/unittests/fpcunit_miglayout.lpr +++ b/prototypes/miglayout/unittests/fpcunit_miglayout.lpr @@ -3,23 +3,16 @@ program fpcunit_miglayout; {$mode objfpc}{$H+} uses - Classes, consoletestrunner, constraintparser_tests, gui_mig_constraintparser; + Classes, + GUITestRunner, + constraintparser_tests, + gui_mig_constraintparser; -type - { TLazTestRunner } - - TMyTestRunner = class(TTestRunner) - protected - // override the protected methods of TTestRunner to customize its behavior - end; - -var - Application: TMyTestRunner; begin - Application := TMyTestRunner.Create(nil); - Application.Initialize; - Application.Run; - Application.Free; + // Register all tests +// sample_tests.RegisterTests; + + RunRegisteredTests; end. |