summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-07-09 13:02:17 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-07-09 13:02:17 +0000
commit9dab72d590cb35e939b7a663b9365edcf4fd2618 (patch)
treea0918de0fa1d5cb6b9df55fe793454a04369014e /extras
parenta91fce032d78cfa00d26fb27351280a2a33d27fa (diff)
downloadfpGUI-9dab72d590cb35e939b7a663b9365edcf4fd2618.tar.xz
* Updated the fpgui_ide.lpk to use the new fpgui_toolkit.lpk package.
* Added a new contributed package from Michael van Canneyt. This allows you to create FPCUnit projects with the fpGUI as front-end. * Renamed the FPCUnit GUI Test Runner unit from guitestrunner.pas to fpg_guitestrunner.pas to prevent conflicts in the Lazarus IDE.
Diffstat (limited to 'extras')
-rw-r--r--extras/lazarus_ide/fpguilazideintf.pas4
-rw-r--r--extras/lazarus_ide/idefpguitestrunner.lpk46
-rw-r--r--extras/lazarus_ide/idefpguitestrunner.pas21
-rw-r--r--extras/lazarus_ide/readme.txt8
-rw-r--r--extras/lazarus_ide/regfpguitestrunner.pas132
5 files changed, 208 insertions, 3 deletions
diff --git a/extras/lazarus_ide/fpguilazideintf.pas b/extras/lazarus_ide/fpguilazideintf.pas
index 427fce81..7eb422d3 100644
--- a/extras/lazarus_ide/fpguilazideintf.pas
+++ b/extras/lazarus_ide/fpguilazideintf.pas
@@ -99,7 +99,7 @@ begin
// create program source
le := LineEnding;
- NewSource := 'program fpGUIProject1;'+le
+ NewSource := 'program Project1;'+le
+le
+'{$mode objfpc}{$H+}'+le
+le
@@ -158,7 +158,7 @@ begin
AProject.MainFile.SetSourceText(NewSource);
// add
- AProject.AddPackageDependency('fpgui_package');
+ AProject.AddPackageDependency('fpgui_toolkit');
// compiler options
AProject.LazCompilerOptions.UseLineInfoUnit := True;
diff --git a/extras/lazarus_ide/idefpguitestrunner.lpk b/extras/lazarus_ide/idefpguitestrunner.lpk
new file mode 100644
index 00000000..48f28f03
--- /dev/null
+++ b/extras/lazarus_ide/idefpguitestrunner.lpk
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <Package Version="3">
+ <Name Value="idefpguitestrunner"/>
+ <CompilerOptions>
+ <Version Value="5"/>
+ <SearchPaths>
+ <OtherUnitFiles Value="../../examples/apps/fpcunit/"/>
+ <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
+ </SearchPaths>
+ <CodeGeneration>
+ <Generate Value="Faster"/>
+ </CodeGeneration>
+ <Other>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+ <Files Count="1">
+ <Item1>
+ <Filename Value="regfpguitestrunner.pas"/>
+ <HasRegisterProc Value="True"/>
+ <UnitName Value="regfpguitestrunner"/>
+ </Item1>
+ </Files>
+ <Type Value="RunAndDesignTime"/>
+ <RequiredPkgs Count="3">
+ <Item1>
+ <PackageName Value="fpcunitide"/>
+ </Item1>
+ <Item2>
+ <PackageName Value="IDEIntf"/>
+ </Item2>
+ <Item3>
+ <PackageName Value="FCL"/>
+ <MinVersion Major="1" Valid="True"/>
+ </Item3>
+ </RequiredPkgs>
+ <UsageOptions>
+ <UnitPath Value="$(PkgOutDir)"/>
+ </UsageOptions>
+ <PublishOptions>
+ <Version Value="2"/>
+ <IgnoreBinaries Value="False"/>
+ </PublishOptions>
+ </Package>
+</CONFIG>
diff --git a/extras/lazarus_ide/idefpguitestrunner.pas b/extras/lazarus_ide/idefpguitestrunner.pas
new file mode 100644
index 00000000..15a26a34
--- /dev/null
+++ b/extras/lazarus_ide/idefpguitestrunner.pas
@@ -0,0 +1,21 @@
+{ This file was automatically created by Lazarus. Do not edit!
+This source is only used to compile and install the package.
+ }
+
+unit idefpguitestrunner;
+
+interface
+
+uses
+ regfpguitestrunner, LazarusPackageIntf;
+
+implementation
+
+procedure Register;
+begin
+ RegisterUnit('regfpguitestrunner', @regfpguitestrunner.Register);
+end;
+
+initialization
+ RegisterPackage('idefpguitestrunner', @Register);
+end.
diff --git a/extras/lazarus_ide/readme.txt b/extras/lazarus_ide/readme.txt
index 0e7a2385..3edd615b 100644
--- a/extras/lazarus_ide/readme.txt
+++ b/extras/lazarus_ide/readme.txt
@@ -1,8 +1,14 @@
- This packages add a new project type in the Lazarus IDE.
+fpgui_ide.lpk
+ This package adds a new project type in the Lazarus IDE.
So you can then create a fpGUI based project by
going: 'File | New' and selecting 'fpGUI Application'.
+idefpguitestrunner.lpk
+ This package adds a new project type in the Lazarus IDE.
+ So you can new create FPCUnit test projects using the
+ fpGUI toolkit as front-end.
+
Regards,
Graeme.
diff --git a/extras/lazarus_ide/regfpguitestrunner.pas b/extras/lazarus_ide/regfpguitestrunner.pas
new file mode 100644
index 00000000..16ff1254
--- /dev/null
+++ b/extras/lazarus_ide/regfpguitestrunner.pas
@@ -0,0 +1,132 @@
+unit regfpguitestrunner;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils,LazIDEIntf, ProjectIntf, Controls, Forms;
+
+Type
+
+ { TfpGUITestRunnerProjectDescriptor }
+ TfpGUITestRunnerProjectDescriptor = class(TProjectDescriptor)
+ public
+ constructor Create; override;
+ function GetLocalizedName: string; override;
+ function GetLocalizedDescription: string; override;
+ function InitProject(AProject: TLazProject) : TModalResult; override;
+ function CreateStartFiles(AProject: TLazProject) : TModalResult; override;
+ published
+ { Published declarations }
+ end;
+
+var
+ fpGUIFTestRunnerProjectDescriptor : TfpGUITestRunnerProjectDescriptor;
+
+procedure Register;
+
+implementation
+{$define uselazideintf}
+{$ifdef uselazideintf}
+uses FPCUnitLazIDEIntf;
+{$endif}
+
+procedure Register;
+
+begin
+ fpGUIFTestRunnerProjectDescriptor:=TfpGUITestRunnerProjectDescriptor.Create;
+ RegisterProjectDescriptor(fpGUIFTestRunnerProjectDescriptor);
+end;
+
+{ TfpGUITestRunnerProjectDescriptor }
+
+constructor TfpGUITestRunnerProjectDescriptor.Create;
+begin
+ inherited Create;
+ Name:='FPCUnit fpGUI Application';
+end;
+
+function TfpGUITestRunnerProjectDescriptor.GetLocalizedName: string;
+begin
+ Result:='FPGUITestRunner';
+end;
+
+function TfpGUITestRunnerProjectDescriptor.GetLocalizedDescription: string;
+begin
+ Result:='FPCUnit test runner application using a fpGUI front-end';
+end;
+
+function TfpGUITestRunnerProjectDescriptor.InitProject(AProject: TLazProject
+ ): TModalResult;
+
+Var
+ L : TStrings;
+ MainFile: TLazProjectFile;
+
+begin
+ inherited InitProject(AProject);
+
+ MainFile:=AProject.CreateProjectFile('fpcunitproject1.lpr');
+ MainFile.IsPartOfProject:=true;
+ AProject.AddFile(MainFile,false);
+ AProject.MainFileID:=0;
+ L:=TStringList.Create;
+ try
+ With L do
+ begin
+ Add('program fpcunitproject1;');
+ Add('');
+ Add('{$mode objfpc}{$H+}');
+ Add('');
+ Add('uses');
+ Add(' {$IFDEF UNIX}{$IFDEF UseCThreads}');
+ Add(' cthreads,');
+ Add(' {$ENDIF}{$ENDIF}');
+ Add(' Classes,');
+ Add(' fpgfx, fpg_guitestrunner;');
+ Add('');
+ Add('procedure MainProc;');
+ Add('');
+ Add('var');
+ Add(' frm: TGUITestRunnerForm;');
+ Add('');
+ Add('begin');
+ Add(' fpgApplication.Initialize;');
+ Add(' frm := TGUITestRunnerForm.Create(nil);');
+ Add(' try');
+ Add(' frm.Show;');
+ Add(' fpgApplication.Run;');
+ Add(' finally');
+ Add(' frm.Free;');
+ Add(' end;');
+ Add('end;');
+ Add('');
+ Add('begin');
+ Add(' MainProc;');
+ Add('end.');
+ end;
+ AProject.MainFile.SetSourceText(L.text);
+ finally
+ L.Free;
+ end;
+ // add dependencies
+ AProject.AddPackageDependency('FCL');
+ AProject.AddPackageDependency('guitestrunner_fpgui');
+ // Don't know if this is needed, actually.
+ // AProject.AddPackageDependency('FPCUnitTestRunner');
+ Result:=mrOK;
+end;
+
+function TfpGUITestRunnerProjectDescriptor.CreateStartFiles(
+ AProject: TLazProject): TModalResult;
+begin
+{$ifdef uselazideintf}
+ LazarusIDE.DoNewEditorFile(FileDescriptorFPCUnitTestCase,'','',
+ [nfIsPartOfProject,nfOpenInEditor,nfCreateDefaultSrc]);
+{$endif}
+ Result:=mrOK;
+end;
+
+end.
+