Skip to content

Commit

Permalink
Delphi 10.2 Tokyo support
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Parrett committed Mar 24, 2017
1 parent b628f60 commit 3e1983d
Show file tree
Hide file tree
Showing 24 changed files with 2,881 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*.drc
*.rc
*.res
*.dres

# Output Folders #
###################
Expand Down
11 changes: 10 additions & 1 deletion DUNitX.Loggers.GUIX.pas
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@ interface
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
System.Actions, FMX.ActnList, FMX.Layouts, FMX.TreeView, FMX.Edit,
DUnitX.TestFramework, DUnitX.Extensibility, DUnitX.InternalInterfaces, FMX.ListView.Types, FMX.ListView.Appearances,
FMX.ListView, FMX.ListBox, Generics.Collections, FMX.Memo, FMX.ScrollBox, FMX.Controls.Presentation, System.IniFiles;
FMX.ListView, FMX.ListBox, System.Generics.Collections, FMX.Memo, FMX.ScrollBox, FMX.Controls.Presentation, System.IniFiles,
FMX.ListView.Adapters.Base;

{$HPPEMIT '#if defined(USEPACKAGES)'}
{$HPPEMIT '# pragma comment(lib, "Fmx.bpi")'}
{$HPPEMIT '# pragma comment(lib, "DUnitXFMXRuntime.bpi")'}
{$HPPEMIT '#else'}
{$HPPEMIT '# pragma comment(lib, "Fmx")'}
{$HPPEMIT '# pragma comment(lib, "DUnitXFMXRuntime")'}
{$HPPEMIT '#endif'}

type
TGUIXTestRunner = class(TForm, ITestLogger)
Expand Down
3 changes: 2 additions & 1 deletion DUnitX.Assert.pas
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,18 @@ implementation

uses
DUnitX.ResStrs,
Generics.Defaults,
{$IFDEF SUPPORTS_REGEX}
System.RegularExpressions,
{$ENDIF}
{$IFDEF USE_NS}
System.Generics.Defaults,
System.Math,
System.Rtti,
System.StrUtils,
System.TypInfo,
System.Variants;
{$ELSE}
Generics.Defaults,
Math,
Rtti,
StrUtils,
Expand Down
17 changes: 9 additions & 8 deletions DUnitX.AutoDetect.Console.pas
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,25 @@
/// </remarks>
/// <seealso cref="DUnitX.Windows.Console" />
/// <seealso cref="DUnitX.MacOS.Console" />
/// <seealso_ cref="DUnitX.Linux.Console" />
/// <seealso cref="DUnitX.Loggers.Console" />

unit DUnitX.AutoDetect.Console;

interface
uses
{$IFDEF MSWINDOWS}
{$IF Defined(MSWINDOWS)}
DUnitX.Windows.Console;
{$ENDIF MSWINDOWS}
{$IFDEF MACOS}
{$ELSEIF Defined(MACOS) or Defined(OSX32)}
// Simplification as MacOS console supports Ansi, and other terminals
// on platforms other than windows typically support some form of
// ANSI colors.
DUnitX.MacOS.Console;
{$ENDIF MACOS}
{$IFDEF LINUX}
DUnitX.Linux.Console;
{$ENDIF LINUX}
DUnitX.MacOS.Console;
{$ELSEIF Defined(LINUX) or Defined(ANDROID)}
DUnitX.Linux.Console;
{$ELSE}
{$MESSAGE Error 'Unknown Platform for Console Writer'}
{$ENDIF}

implementation

Expand Down
3 changes: 2 additions & 1 deletion DUnitX.Filters.pas
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ interface
uses
{$IFDEF USE_NS}
System.Classes,
System.Generics.Collections,
{$ELSE}
Classes,
{$ENDIF}
Generics.Collections,
{$ENDIF}
DUnitX.Extensibility;

type
Expand Down
3 changes: 2 additions & 1 deletion DUnitX.FixtureProviderPlugin.pas
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ interface
uses
{$IFDEF USE_NS}
System.Rtti,
System.Generics.Collections,
{$ELSE}
Rtti,
{$ENDIF}
Generics.Collections,
{$ENDIF}
DUnitX.Extensibility;

type
Expand Down
24 changes: 12 additions & 12 deletions DUnitX.Linux.Console.pas
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ interface


type
/// <summary>
/// Internal Class and should not be created directly. Adding this unit to
/// the uses will automatically register this class as a
/// <see_ cref="DUnitX.ConsoleWriter.Base|IDUnitXConsoleWriter">IDUnitXConsoleWriter</see>
/// in the <see_ cref="TDUnitXIoC|TDUnitXIoC">DUnitX IOC Container</see>.
/// </summary>
TDUnitXLinuxConsoleWriter = class(TDUnitXConsoleWriterBase)
/// <summary>
/// Internal Class and should not be created directly. Adding this unit to
/// the uses will automatically register this class as a
/// <see_ cref="DUnitX.ConsoleWriter.Base|IDUnitXConsoleWriter">IDUnitXConsoleWriter</see>
/// in the <see_ cref="TDUnitXIoC|TDUnitXIoC">DUnitX IOC Container</see>.
/// </summary>
TDUnitXLinuxConsoleWriter = class(TDUnitXConsoleWriterBase)
private
protected
procedure InternalWriteLn(const s : String); override;
Expand Down Expand Up @@ -107,7 +107,7 @@ implementation
AT_BG_WHITE = #27 + '[47m';


{ TDUnitXMacOSConsoleWriter }
{ TDUnitXLinuxConsoleWriter }

procedure TDUnitXLinuxConsoleWriter.InternalWrite(const s: string);
begin
Expand Down Expand Up @@ -159,9 +159,9 @@ procedure TDUnitXLinuxConsoleWriter.SetColour(const foreground, background: TCon

end;

{$IFDEF LINUX}
initialization
TDUnitXIoC.DefaultContainer.RegisterType<IDUnitXConsoleWriter,TDUnitXLinuxConsoleWriter>();
{$ENDIF LINUX}
{$IF Defined(LINUX)}
initialization
TDUnitXIoC.DefaultContainer.RegisterType<IDUnitXConsoleWriter, TDUnitXLinuxConsoleWriter>();
{$ENDIF}

end.
4 changes: 2 additions & 2 deletions DUnitX.MacOS.Console.pas
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ procedure TDUnitXMacOSConsoleWriter.SetColour(const foreground, background: TCon

end;

{$IFDEF MACOS}
initialization
{$IF Defined(MACOS) or Defined(OSX32)}
initialization
TDUnitXIoC.DefaultContainer.RegisterType<IDUnitXConsoleWriter,TDUnitXMacOSConsoleWriter>();
{$ENDIF}

Expand Down
2 changes: 1 addition & 1 deletion DUnitX.MemoryLeakMonitor.FastMM4.pas
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function TDUnitXFastMM4MemoryLeakMonitor.GetMemoryAllocated: Int64;

for sb in st.SmallBlockTypeStates do
begin
Result := Result + sb.UseableBlockSize * sb.AllocatedBlockCount;
Result := Result + Int64(sb.UseableBlockSize * sb.AllocatedBlockCount);
end;
end;

Expand Down
2 changes: 1 addition & 1 deletion DUnitX.ResStrs.pas
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ interface
SNoImplementationRegistered = 'No implementation registered for type %s';
SNoInstance = 'The activator delegate failed to return an instance %s';

SNoConsoleWriterClassRegistered = 'No ConsoleWriter Class is registered. You will need to include DUnitX.Windows.Console or DUnitX.MACOS.Console in your application';
SNoConsoleWriterClassRegistered = 'No ConsoleWriter Class is registered. You will need to include DUnitX.Windows.Console, DUnitX.MacOS.Console or DUnitX.Linux.Console in you application';
SExecutingTest = 'Executing Test : ';
SRunningFixtureSetup = 'Running Fixture Setup Method : ';
SRunningSetup = 'Running Setup for : ';
Expand Down
2 changes: 1 addition & 1 deletion DUnitX.TestNameParser.pas
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ implementation
{$IFDEF USE_NS}
System.Classes,
System.SysUtils,
Generics.Collections,
System.Generics.Collections,
{$ELSE}
Classes,
SysUtils,
Expand Down
1 change: 0 additions & 1 deletion DUnitX.Timeout.pas
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ procedure TTimeoutThread.Execute;
stopwatch := TStopWatch.Create;
stopwatch.Reset;
stopwatch.Start;
elapsedTime := 0;

if Terminated then
exit;
Expand Down
6 changes: 4 additions & 2 deletions DUnitX.Windows.Console.pas
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ procedure TDUnitXWindowsConsoleWriter.SetColour(const foreground, background: TC

function TDUnitXWindowsConsoleWriter.GetForegroundColourCode(const cc : TConsoleColour) : Word;
begin
Result := 0;
case cc of
ccDefault : Result := FDefaultForeground;
ccBrightRed : Result := FOREGROUND_RED or FOREGROUND_INTENSITY;
Expand All @@ -139,6 +138,8 @@ function TDUnitXWindowsConsoleWriter.GetForegroundColourCode(const cc : TConsole
ccBlack : Result := 0;
ccBrightWhite : Result := FOREGROUND_BLUE or FOREGROUND_GREEN or FOREGROUND_RED or FOREGROUND_INTENSITY;
ccWhite : Result := FOREGROUND_BLUE or FOREGROUND_GREEN or FOREGROUND_RED;
else
Result := 0;
end;
end;

Expand Down Expand Up @@ -181,7 +182,6 @@ destructor TDUnitXWindowsConsoleWriter.Destroy;

function TDUnitXWindowsConsoleWriter.GetBackgroundColourCode(const cc : TConsoleColour) : Word;
begin
Result := 0;
case cc of
ccDefault : Result := FDefaultBackground;
ccBrightRed : Result := BACKGROUND_RED or BACKGROUND_INTENSITY;
Expand All @@ -200,6 +200,8 @@ function TDUnitXWindowsConsoleWriter.GetBackgroundColourCode(const cc : TConsole
ccBlack : Result := 0;
ccBrightWhite : Result := BACKGROUND_BLUE or BACKGROUND_GREEN or BACKGROUND_RED or BACKGROUND_INTENSITY;
ccWhite : Result := BACKGROUND_BLUE or BACKGROUND_GREEN or BACKGROUND_RED;
else
Result := 0;
end;
end;

Expand Down
31 changes: 31 additions & 0 deletions DUnitX.inc
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
{$DEFINE DELPHI_XE8_UP}
{$DEFINE DELPHIX_SEATTLE_UP}
{$DEFINE DELPHIX_SEATTLE}
{$DEFINE DELPHI_XE10_UP}
{$DEFINE SUPPORTS_REGEX}
{$DEFINE USE_NS}
{$UNDEF DELPHI_2010_DOWN}
Expand All @@ -241,6 +242,36 @@

{$ENDIF VER310}

{$IFDEF VER320} // RAD Studio 10.2 Tokyo
{$DEFINE DELPHI_2010_UP}
{$DEFINE DELPHI_XE_UP}
{$DEFINE DELPHI_XE2_UP}
{$DEFINE DELPHI_XE3_UP}
{$DEFINE DELPHI_XE4_UP}
{$DEFINE DELPHI_XE5_UP}
{$DEFINE DELPHI_XE6_UP}
{$DEFINE DELPHI_XE7}
{$DEFINE DELPHI_XE7_UP}
{$DEFINE DELPHI_XE8_UP}
{$DEFINE DELPHIX_SEATTLE_UP}
{$DEFINE DELPHIX_SEATTLE}
{$DEFINE DELPHI_XE10_UP}
{$DEFINE DELPHI_XE101_UP}
{$DEFINE SUPPORTS_REGEX}
{$DEFINE USE_NS}
{$UNDEF DELPHI_2010_DOWN}
{$UNDEF DELPHI_XE_DOWN}
{$UNDEF DELPHI_XE2_DOWN}
{$UNDEF DELPHI_XE3_DOWN}
{$UNDEF DELPHI_XE4_DOWN}
{$UNDEF DELPHI_XE5_DOWN}
{$UNDEF DELPHI_XE6_DOWN}
{$UNDEF DELPHI_XE7_DOWN}
{$UNDEF DELPHI_XE8_DOWN}
{$UNDEF DELPHI_XE10_DOWN}
{$UNDEF DELPHI_XE101_DOWN}
{$ENDIF VER320}

{$I DUnitX.Stacktrace.inc}
{$I DUnitX.MemoryLeaks.inc}

Expand Down
72 changes: 72 additions & 0 deletions DUnitX_D10Tokyo.groupproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{578B7A11-D6C6-468D-8C4F-BC822BA313A8}</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<Projects Include="Tests\DUnitXTest_D10Tokyo.dproj">
<Dependencies/>
</Projects>
<Projects Include="Examples\DUnitXExamples_D10Tokyo.dproj">
<Dependencies/>
</Projects>
<Projects Include="Expert\DUnitX_IDE_Expert_D10Tokyo.dproj">
<Dependencies/>
</Projects>
<Projects Include="Examples\DUnitXFiremonkeyGUI_D10Tokyo.dproj">
<Dependencies/>
</Projects>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Default.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Default.Personality/>
</BorlandProject>
</ProjectExtensions>
<Target Name="DUnitXTest_D10Tokyo">
<MSBuild Projects="Tests\DUnitXTest_D10Tokyo.dproj"/>
</Target>
<Target Name="DUnitXTest_D10Tokyo:Clean">
<MSBuild Projects="Tests\DUnitXTest_D10Tokyo.dproj" Targets="Clean"/>
</Target>
<Target Name="DUnitXTest_D10Tokyo:Make">
<MSBuild Projects="Tests\DUnitXTest_D10Tokyo.dproj" Targets="Make"/>
</Target>
<Target Name="DUnitXExamples_D10Tokyo">
<MSBuild Projects="Examples\DUnitXExamples_D10Tokyo.dproj"/>
</Target>
<Target Name="DUnitXExamples_D10Tokyo:Clean">
<MSBuild Projects="Examples\DUnitXExamples_D10Tokyo.dproj" Targets="Clean"/>
</Target>
<Target Name="DUnitXExamples_D10Tokyo:Make">
<MSBuild Projects="Examples\DUnitXExamples_D10Tokyo.dproj" Targets="Make"/>
</Target>
<Target Name="DUnitX_IDE_Expert_D10Tokyo">
<MSBuild Projects="Expert\DUnitX_IDE_Expert_D10Tokyo.dproj"/>
</Target>
<Target Name="DUnitX_IDE_Expert_D10Tokyo:Clean">
<MSBuild Projects="Expert\DUnitX_IDE_Expert_D10Tokyo.dproj" Targets="Clean"/>
</Target>
<Target Name="DUnitX_IDE_Expert_D10Tokyo:Make">
<MSBuild Projects="Expert\DUnitX_IDE_Expert_D10Tokyo.dproj" Targets="Make"/>
</Target>
<Target Name="DUnitXFiremonkeyGUI_D10Tokyo">
<MSBuild Projects="Examples\DUnitXFiremonkeyGUI_D10Tokyo.dproj"/>
</Target>
<Target Name="DUnitXFiremonkeyGUI_D10Tokyo:Clean">
<MSBuild Projects="Examples\DUnitXFiremonkeyGUI_D10Tokyo.dproj" Targets="Clean"/>
</Target>
<Target Name="DUnitXFiremonkeyGUI_D10Tokyo:Make">
<MSBuild Projects="Examples\DUnitXFiremonkeyGUI_D10Tokyo.dproj" Targets="Make"/>
</Target>
<Target Name="Build">
<CallTarget Targets="DUnitXTest_D10Tokyo;DUnitXExamples_D10Tokyo;DUnitX_IDE_Expert_D10Tokyo;DUnitXFiremonkeyGUI_D10Tokyo"/>
</Target>
<Target Name="Clean">
<CallTarget Targets="DUnitXTest_D10Tokyo:Clean;DUnitXExamples_D10Tokyo:Clean;DUnitX_IDE_Expert_D10Tokyo:Clean;DUnitXFiremonkeyGUI_D10Tokyo:Clean"/>
</Target>
<Target Name="Make">
<CallTarget Targets="DUnitXTest_D10Tokyo:Make;DUnitXExamples_D10Tokyo:Make;DUnitX_IDE_Expert_D10Tokyo:Make;DUnitXFiremonkeyGUI_D10Tokyo:Make"/>
</Target>
<Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
</Project>
Loading

0 comments on commit 3e1983d

Please sign in to comment.