mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 10:19:17 +02:00
sqldb: tests: clean up forms so database.ini editor is in main form
git-svn-id: trunk@25327 -
This commit is contained in:
parent
62857c565e
commit
e7b833bd1b
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -2189,6 +2189,7 @@ packages/fcl-db/tests/README.txt svneol=native#text/plain
|
|||||||
packages/fcl-db/tests/bufdatasettoolsunit.pas svneol=native#text/plain
|
packages/fcl-db/tests/bufdatasettoolsunit.pas svneol=native#text/plain
|
||||||
packages/fcl-db/tests/database.ini.txt svneol=native#text/plain
|
packages/fcl-db/tests/database.ini.txt svneol=native#text/plain
|
||||||
packages/fcl-db/tests/dbftoolsunit.pas svneol=native#text/plain
|
packages/fcl-db/tests/dbftoolsunit.pas svneol=native#text/plain
|
||||||
|
packages/fcl-db/tests/dbguitestrunner.pas svneol=native#text/plain
|
||||||
packages/fcl-db/tests/dbtestframework.pas svneol=native#text/plain
|
packages/fcl-db/tests/dbtestframework.pas svneol=native#text/plain
|
||||||
packages/fcl-db/tests/dbtestframework_gui.lpi svneol=native#text/plain
|
packages/fcl-db/tests/dbtestframework_gui.lpi svneol=native#text/plain
|
||||||
packages/fcl-db/tests/dbtestframework_gui.lpr svneol=native#text/plain
|
packages/fcl-db/tests/dbtestframework_gui.lpr svneol=native#text/plain
|
||||||
|
68
packages/fcl-db/tests/dbguitestrunner.pas
Normal file
68
packages/fcl-db/tests/dbguitestrunner.pas
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
unit DBGuiTestRunner;
|
||||||
|
// Adds database.ini editing facilities to regular GuiTestRunner form
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils,
|
||||||
|
Interfaces, Forms,
|
||||||
|
StdCtrls,
|
||||||
|
GuiTestRunner, inieditor;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TDBGuiTestRunnerForm }
|
||||||
|
|
||||||
|
TDBGuiTestRunnerForm=class(TGUITestRunner)
|
||||||
|
private
|
||||||
|
DBEditButton: TButton;
|
||||||
|
public
|
||||||
|
procedure DBEditButtonClick(ASender: TObject);
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
DBGuiTestRunnerForm: TDBGuiTestRunnerForm;
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
|
||||||
|
{ TDBGuiTestRunnerForm }
|
||||||
|
|
||||||
|
procedure TDBGuiTestRunnerForm.DBEditButtonClick(ASender: TObject);
|
||||||
|
var
|
||||||
|
DBSelectForm: TFormIniEditor;
|
||||||
|
begin
|
||||||
|
DBSelectForm:=TFormIniEditor.Create(nil);
|
||||||
|
try
|
||||||
|
DBSelectForm.INIFile:='database.ini';
|
||||||
|
DBSelectForm.ProfileSelectSection:='Database';
|
||||||
|
DBSelectForm.ProfileSelectKey:='type';
|
||||||
|
// We can ignore resulting db selection as the file is saved already:
|
||||||
|
DBSelectForm.ShowModal;
|
||||||
|
finally
|
||||||
|
DBSelectForm.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TDBGuiTestRunnerForm.Create(AOwner: TComponent);
|
||||||
|
// Add our database.ini edit button to the existing GUI
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
DBEditButton:=TButton.Create(Self);
|
||||||
|
DBEditButton.Top:=7;
|
||||||
|
DBEditButton.Left:=210;
|
||||||
|
DBEditButton.Height:=32;
|
||||||
|
DBEditButton.Width:=100;
|
||||||
|
DBEditButton.Caption:='Edit database.ini...';
|
||||||
|
DBEditButton.Hint:='Edit database selection settings (effective for next start)';
|
||||||
|
DBEditButton.OnClick:=@DBEditButtonClick;
|
||||||
|
// Set this last; now all properties take effect
|
||||||
|
DBEditButton.Parent:=Self.Panel1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
@ -1,10 +1,14 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="9"/>
|
<Version Value="9"/>
|
||||||
<General>
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<MainUnitHasCreateFormStatements Value="False"/>
|
||||||
|
</Flags>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<MainUnit Value="0"/>
|
<MainUnit Value="0"/>
|
||||||
|
<Title Value="DBTestFramework"/>
|
||||||
<ResourceType Value="res"/>
|
<ResourceType Value="res"/>
|
||||||
<UseXPManifest Value="True"/>
|
<UseXPManifest Value="True"/>
|
||||||
</General>
|
</General>
|
||||||
@ -76,12 +80,17 @@
|
|||||||
<PackageName Value="FCL"/>
|
<PackageName Value="FCL"/>
|
||||||
</Item4>
|
</Item4>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="1">
|
<Units Count="2">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="dbtestframework_gui.lpr"/>
|
<Filename Value="dbtestframework_gui.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="dbtestframework_gui"/>
|
<UnitName Value="dbtestframework_gui"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="dbguitestrunner.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="DBGuiTestRunner"/>
|
||||||
|
</Unit1>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -14,10 +14,11 @@ program dbtestframework_gui;
|
|||||||
uses
|
uses
|
||||||
Interfaces, Forms,
|
Interfaces, Forms,
|
||||||
// GUI:
|
// GUI:
|
||||||
GuiTestRunner, inieditor,
|
StdCtrls {to extend GuiTestRunner},
|
||||||
|
DBGuiTestRunner, inieditor,
|
||||||
// Generic DB test framework units
|
// Generic DB test framework units
|
||||||
ToolsUnit,
|
ToolsUnit,
|
||||||
// Connectors for different database-types
|
// Connectors for different database types
|
||||||
sqldbtoolsunit,
|
sqldbtoolsunit,
|
||||||
dbftoolsunit,
|
dbftoolsunit,
|
||||||
bufdatasettoolsunit,
|
bufdatasettoolsunit,
|
||||||
@ -37,29 +38,10 @@ uses
|
|||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
var
|
|
||||||
DBSelectForm: TFormIniEditor;
|
|
||||||
TestRunForm: TGUITestRunner;
|
|
||||||
begin
|
begin
|
||||||
|
Application.Title:='DBTestFramework';
|
||||||
Application.Initialize;
|
Application.Initialize;
|
||||||
DBSelectForm:=TFormIniEditor.Create(nil);
|
Application.CreateForm(TDBGuiTestRunnerForm, DBGuiTestRunnerForm);
|
||||||
try
|
Application.Run;
|
||||||
DBSelectForm.INIFile:='database.ini';
|
|
||||||
DBSelectForm.ProfileSelectSection:='Database';
|
|
||||||
DBSelectForm.ProfileSelectKey:='type';
|
|
||||||
// We can ignore resulting db selection as the file is saved already:
|
|
||||||
DBSelectForm.ShowModal;
|
|
||||||
finally
|
|
||||||
DBSelectForm.Free;
|
|
||||||
end;
|
|
||||||
// Manually run this form because autocreation could have loaded an old
|
|
||||||
// database.ini file (if the user changed it using DBSelectForm)
|
|
||||||
TestRunForm:=TGUITestRunner.Create(nil);
|
|
||||||
try
|
|
||||||
TestRunForm.Show;
|
|
||||||
Application.Run;
|
|
||||||
finally
|
|
||||||
TestRunForm.Free;
|
|
||||||
end;
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -454,12 +454,14 @@ object FormIniEditor: TFormIniEditor
|
|||||||
Lines.Strings = (
|
Lines.Strings = (
|
||||||
''
|
''
|
||||||
)
|
)
|
||||||
|
SelectedColor.FrameEdges = sfeAround
|
||||||
SelectedColor.BackPriority = 50
|
SelectedColor.BackPriority = 50
|
||||||
SelectedColor.ForePriority = 50
|
SelectedColor.ForePriority = 50
|
||||||
SelectedColor.FramePriority = 50
|
SelectedColor.FramePriority = 50
|
||||||
SelectedColor.BoldPriority = 50
|
SelectedColor.BoldPriority = 50
|
||||||
SelectedColor.ItalicPriority = 50
|
SelectedColor.ItalicPriority = 50
|
||||||
SelectedColor.UnderlinePriority = 50
|
SelectedColor.UnderlinePriority = 50
|
||||||
|
SelectedColor.StrikeOutPriority = 50
|
||||||
OnStatusChange = SynMemoStatusChange
|
OnStatusChange = SynMemoStatusChange
|
||||||
inline SynLeftGutterPartList1: TSynGutterPartList
|
inline SynLeftGutterPartList1: TSynGutterPartList
|
||||||
object SynGutterMarks1: TSynGutterMarks
|
object SynGutterMarks1: TSynGutterMarks
|
||||||
@ -471,6 +473,7 @@ object FormIniEditor: TFormIniEditor
|
|||||||
MouseActions = <>
|
MouseActions = <>
|
||||||
MarkupInfo.Background = clBtnFace
|
MarkupInfo.Background = clBtnFace
|
||||||
MarkupInfo.Foreground = clNone
|
MarkupInfo.Foreground = clNone
|
||||||
|
MarkupInfo.FrameEdges = sfeAround
|
||||||
DigitCount = 2
|
DigitCount = 2
|
||||||
ShowOnlyLineNumbersMultiplesOf = 1
|
ShowOnlyLineNumbersMultiplesOf = 1
|
||||||
ZeroStart = False
|
ZeroStart = False
|
||||||
@ -485,11 +488,15 @@ object FormIniEditor: TFormIniEditor
|
|||||||
object SynGutterSeparator1: TSynGutterSeparator
|
object SynGutterSeparator1: TSynGutterSeparator
|
||||||
Width = 2
|
Width = 2
|
||||||
MouseActions = <>
|
MouseActions = <>
|
||||||
|
MarkupInfo.Background = clWhite
|
||||||
|
MarkupInfo.Foreground = clGray
|
||||||
|
MarkupInfo.FrameEdges = sfeAround
|
||||||
end
|
end
|
||||||
object SynGutterCodeFolding1: TSynGutterCodeFolding
|
object SynGutterCodeFolding1: TSynGutterCodeFolding
|
||||||
MouseActions = <>
|
MouseActions = <>
|
||||||
MarkupInfo.Background = clNone
|
MarkupInfo.Background = clNone
|
||||||
MarkupInfo.Foreground = clGray
|
MarkupInfo.Foreground = clGray
|
||||||
|
MarkupInfo.FrameEdges = sfeAround
|
||||||
MouseActionsExpanded = <>
|
MouseActionsExpanded = <>
|
||||||
MouseActionsCollapsed = <>
|
MouseActionsCollapsed = <>
|
||||||
end
|
end
|
||||||
@ -497,7 +504,7 @@ object FormIniEditor: TFormIniEditor
|
|||||||
end
|
end
|
||||||
object FileNameEdit: TFileNameEdit
|
object FileNameEdit: TFileNameEdit
|
||||||
Left = 56
|
Left = 56
|
||||||
Height = 23
|
Height = 21
|
||||||
Top = 24
|
Top = 24
|
||||||
Width = 368
|
Width = 368
|
||||||
OnAcceptFileName = FileNameEditAcceptFileName
|
OnAcceptFileName = FileNameEditAcceptFileName
|
||||||
@ -510,28 +517,28 @@ object FormIniEditor: TFormIniEditor
|
|||||||
end
|
end
|
||||||
object INIFileLabel: TLabel
|
object INIFileLabel: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 15
|
Height = 13
|
||||||
Top = 24
|
Top = 24
|
||||||
Width = 34
|
Width = 32
|
||||||
Caption = 'INI file'
|
Caption = 'INI file'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object ProfileSelect: TComboBox
|
object ProfileSelect: TComboBox
|
||||||
Left = 56
|
Left = 56
|
||||||
Height = 23
|
Height = 21
|
||||||
Hint = 'Choose the profile you want to enable'
|
Hint = 'Choose the profile you want to enable'
|
||||||
Top = 61
|
Top = 61
|
||||||
Width = 164
|
Width = 164
|
||||||
ItemHeight = 15
|
ItemHeight = 13
|
||||||
OnSelect = ProfileSelectSelect
|
OnSelect = ProfileSelectSelect
|
||||||
Sorted = True
|
Sorted = True
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object ProfileLabel: TLabel
|
object ProfileLabel: TLabel
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 15
|
Height = 13
|
||||||
Top = 64
|
Top = 64
|
||||||
Width = 34
|
Width = 30
|
||||||
Caption = 'Profile'
|
Caption = 'Profile'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
@ -556,6 +563,17 @@ object FormIniEditor: TFormIniEditor
|
|||||||
OnClick = CancelButtonClick
|
OnClick = CancelButtonClick
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
end
|
end
|
||||||
|
object Label1: TLabel
|
||||||
|
Left = 8
|
||||||
|
Height = 13
|
||||||
|
Top = 0
|
||||||
|
Width = 229
|
||||||
|
Caption = 'Changes need a program restart to load!'
|
||||||
|
Font.Color = clRed
|
||||||
|
Font.Style = [fsBold]
|
||||||
|
ParentColor = False
|
||||||
|
ParentFont = False
|
||||||
|
end
|
||||||
object SynIniHighlighter: TSynIniSyn
|
object SynIniHighlighter: TSynIniSyn
|
||||||
DefaultFilter = 'INI Files (*.ini)|*.ini'
|
DefaultFilter = 'INI Files (*.ini)|*.ini'
|
||||||
Enabled = False
|
Enabled = False
|
||||||
|
@ -15,6 +15,7 @@ type
|
|||||||
|
|
||||||
TFormIniEditor = class(TForm)
|
TFormIniEditor = class(TForm)
|
||||||
GUITimer: TIdleTimer;
|
GUITimer: TIdleTimer;
|
||||||
|
Label1: TLabel;
|
||||||
OKButton: TButton;
|
OKButton: TButton;
|
||||||
CancelButton: TButton;
|
CancelButton: TButton;
|
||||||
ProfileSelect: TComboBox;
|
ProfileSelect: TComboBox;
|
||||||
|
@ -12,7 +12,7 @@ uses
|
|||||||
,pqconnection
|
,pqconnection
|
||||||
,odbcconn
|
,odbcconn
|
||||||
{$IFNDEF WIN64}
|
{$IFNDEF WIN64}
|
||||||
{See packages\fcl-db\fpmake.pp: Oracle connector is not built if PostgreSQL connectoris not built}
|
{See packages\fcl-db\fpmake.pp: Oracle connector not built yet on Win64}
|
||||||
,oracleconnection
|
,oracleconnection
|
||||||
{$ENDIF WIN64}
|
{$ENDIF WIN64}
|
||||||
,sqlite3conn
|
,sqlite3conn
|
||||||
|
Loading…
Reference in New Issue
Block a user