Skip to content
This repository was archived by the owner on Dec 8, 2017. It is now read-only.

Commit

Permalink
Delphi Dunit Test
Browse files Browse the repository at this point in the history
  • Loading branch information
afriess committed Aug 31, 2017
1 parent 567f203 commit df51c16
Show file tree
Hide file tree
Showing 4 changed files with 219 additions and 8 deletions.
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,34 @@ lib/
# Some Helper apps
DIPasDoc_Console.exe
/Readme_original.txt

# Delphi compiler-generated binaries (safe to delete)
*.bpl
*.bpi
*.dcp
*.apk
*.drc
*.map
*.dres
*.rsm
*.tds
*.dcu
*.lib
*.ocx

# Delphi autogenerated files (duplicated info)
*.cfg
*.hpp
*Resource.rc

# Delphi local files (user-specific info)
*.local
*.identcache
*.projdata
*.tvsconfig
*.dsk

# Delphi history and backups
__history/
__recovery/
*.~*
30 changes: 30 additions & 0 deletions tests/TestDelphidEXIF.dpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
program TestDelphidEXIF;

uses
TestFramework,
Forms,
GUITestRunner,
TextTestRunner,
tstbasic in 'tstbasic.pas' {/ tstreadexif in 'tstreadexif.pas',},
dEXIF in '..\dEXIF.pas',
dexifwrite in '..\dexifwrite.pas',
dglobal in '..\dglobal.pas',
dIPTC in '..\dIPTC.pas',
dtags in '..\dtags.pas',
dUtils in '..\dUtils.pas',
msData in '..\msData.pas';

// tstreadexif in 'tstreadexif.pas',
// tstselfimage in 'tstselfimage.pas',
// tstthumbnail in 'tstthumbnail.pas',
// tstwritereadexif in 'tstwritereadexif.pas';

{$R *.RES}

begin
Application.Initialize;
GUITestRunner.RunRegisteredTests;

end.


133 changes: 133 additions & 0 deletions tests/TestDelphidEXIF.dproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{C5D5C1B4-593E-4737-B963-8B64C4E7638D}</ProjectGuid>
<ProjectVersion>18.1</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
<MainSource>TestDelphidEXIF.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Console</AppType>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''">
<Base_Android>true</Base_Android>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<SanitizedProjectName>TestDelphidEXIF</SanitizedProjectName>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>3079</VerInfo_Locale>
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
<DCC_E>false</DCC_E>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Android)'!=''">
<Android_LauncherIcon48>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png</Android_LauncherIcon48>
<Android_SplashImage470>$(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png</Android_SplashImage470>
<Android_LauncherIcon144>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png</Android_LauncherIcon144>
<Android_SplashImage426>$(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png</Android_SplashImage426>
<Android_SplashImage640>$(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png</Android_SplashImage640>
<Android_LauncherIcon96>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png</Android_LauncherIcon96>
<Android_LauncherIcon36>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png</Android_LauncherIcon36>
<Android_SplashImage960>$(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png</Android_SplashImage960>
<Android_LauncherIcon72>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png</Android_LauncherIcon72>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_ConsoleTarget>true</DCC_ConsoleTarget>
<DCC_UsePackage>rtl;fmxase;vcl;CustomIPTransport;vclactnband;vcldsnap;IndyCore;IndySystem;vclx;bindcomp;tethering;svnui;appanalytics;dsnap;bindcompvcl;vclimg;vcltouch;VclSmp;vcldb;bindcompfmx;svn;vclie;bindengine;dbrtl;IndyProtocols;fmx;fmxdae;xmlrtl;fmxobj;vclwinx;inet;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_DebugDCUs>true</DCC_DebugDCUs>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<DCC_RemoteDebug>true</DCC_RemoteDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<DCC_RemoteDebug>false</DCC_RemoteDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="tstbasic.pas">
<Form>/ tstreadexif in &apos;tstreadexif.pas&apos;,</Form>
</DCCReference>
<DCCReference Include="..\dEXIF.pas"/>
<DCCReference Include="..\dexifwrite.pas"/>
<DCCReference Include="..\dglobal.pas"/>
<DCCReference Include="..\dIPTC.pas"/>
<DCCReference Include="..\dtags.pas"/>
<DCCReference Include="..\dUtils.pas"/>
<DCCReference Include="..\msData.pas"/>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType>Application</Borland.ProjectType>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">TestDelphidEXIF.dpr</Source>
</Source>
</Delphi.Personality>
<Platforms>
<Platform value="Android">False</Platform>
<Platform value="Win32">True</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
</Project>
33 changes: 25 additions & 8 deletions tests/tstbasic.pas
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
unit tstBasic;
unit tstBasic;

{$mode objfpc}{$H+}
{$ifdef FPC}
{$mode objfpc}{$H+}
{$endif FPC}

interface

uses
Classes, SysUtils, fpcunit, testutils, testregistry, FileUtil;
Classes, SysUtils
{$ifdef FPC}
, fpcunit, testutils, testregistry, FileUtil
{$else}
, TestFrameWork
{$endif}
;

const
// Picture with EXIF Data
Expand Down Expand Up @@ -36,7 +44,13 @@ TTsTBasic_dEXIF= class(TTestCase)
implementation

uses
dGlobal, dUtils, dEXIF;
dGlobal, dUtils, dEXIF
{$ifdef FPC}
{$else}
, Winapi.Windows
{$endif}
;


procedure TTsTBasic_dEXIF.CheckForPicture;
begin
Expand Down Expand Up @@ -103,6 +117,7 @@ procedure TTstBasic_dEXIF.TstGPSFormat;
decs: Integer;
begin
// Format degree-minutes-seconds
{$ifdef FPC}
gf := gf_DMS_Short;
decs := 3;
for ct in TGpsCoordType do begin
Expand All @@ -125,16 +140,19 @@ procedure TTstBasic_dEXIF.TstGPSFormat;
CheckEquals(expstr, currstr, 'GPS mismatch (' + expstr + ')');
end;
end;
{$else}
Fail('not implemented, due an syntax error in Delphi');
{$endif}
end;

procedure TTsTBasic_dEXIF.SetUp;
begin
if not FileExists(co_DUTPicName01) then
if FileExists(co_TestPic01) then
CopyFile(co_TestPic01,co_DUTPicName01);
CopyFile(co_TestPic01,co_DUTPicName01{$ifndef FPC},true{$endif});
if not FileExists(co_DUTPicName02) then
if FileExists(co_TestPic02) then
CopyFile(co_TestPic02,co_DUTPicName02);
CopyFile(co_TestPic02,co_DUTPicName02{$ifndef FPC},true{$endif});
end;

procedure TTsTBasic_dEXIF.TearDown;
Expand All @@ -147,7 +165,6 @@ procedure TTsTBasic_dEXIF.TearDown;


initialization

RegisterTest(TTsTBasic_dEXIF);
{$ifndef FPC}TestFramework.{$endif}RegisterTest(TTsTBasic_dEXIF{$ifndef FPC}.Suite{$endif});
end.

0 comments on commit df51c16

Please sign in to comment.