diff --git a/.gitattributes b/.gitattributes index 996c1663f4..c1ed50f759 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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/database.ini.txt 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_gui.lpi svneol=native#text/plain packages/fcl-db/tests/dbtestframework_gui.lpr svneol=native#text/plain diff --git a/packages/fcl-db/tests/dbguitestrunner.pas b/packages/fcl-db/tests/dbguitestrunner.pas new file mode 100644 index 0000000000..cc80b15ac9 --- /dev/null +++ b/packages/fcl-db/tests/dbguitestrunner.pas @@ -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. + diff --git a/packages/fcl-db/tests/dbtestframework_gui.lpi b/packages/fcl-db/tests/dbtestframework_gui.lpi index 0c932eba99..7576d7e19f 100644 --- a/packages/fcl-db/tests/dbtestframework_gui.lpi +++ b/packages/fcl-db/tests/dbtestframework_gui.lpi @@ -1,10 +1,14 @@ - + + + + + <ResourceType Value="res"/> <UseXPManifest Value="True"/> </General> @@ -76,12 +80,17 @@ <PackageName Value="FCL"/> </Item4> </RequiredPackages> - <Units Count="1"> + <Units Count="2"> <Unit0> <Filename Value="dbtestframework_gui.lpr"/> <IsPartOfProject Value="True"/> <UnitName Value="dbtestframework_gui"/> </Unit0> + <Unit1> + <Filename Value="dbguitestrunner.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="DBGuiTestRunner"/> + </Unit1> </Units> </ProjectOptions> <CompilerOptions> diff --git a/packages/fcl-db/tests/dbtestframework_gui.lpr b/packages/fcl-db/tests/dbtestframework_gui.lpr index d901d7fe88..99b86a5e5a 100644 --- a/packages/fcl-db/tests/dbtestframework_gui.lpr +++ b/packages/fcl-db/tests/dbtestframework_gui.lpr @@ -14,10 +14,11 @@ program dbtestframework_gui; uses Interfaces, Forms, // GUI: - GuiTestRunner, inieditor, + StdCtrls {to extend GuiTestRunner}, + DBGuiTestRunner, inieditor, // Generic DB test framework units ToolsUnit, - // Connectors for different database-types + // Connectors for different database types sqldbtoolsunit, dbftoolsunit, bufdatasettoolsunit, @@ -37,29 +38,10 @@ uses {$R *.res} -var - DBSelectForm: TFormIniEditor; - TestRunForm: TGUITestRunner; begin + Application.Title:='DBTestFramework'; Application.Initialize; - 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; - // 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; + Application.CreateForm(TDBGuiTestRunnerForm, DBGuiTestRunnerForm); + Application.Run; end. diff --git a/packages/fcl-db/tests/inieditor.lfm b/packages/fcl-db/tests/inieditor.lfm index 8437c995f0..222c51a28d 100644 --- a/packages/fcl-db/tests/inieditor.lfm +++ b/packages/fcl-db/tests/inieditor.lfm @@ -454,12 +454,14 @@ object FormIniEditor: TFormIniEditor Lines.Strings = ( '' ) + SelectedColor.FrameEdges = sfeAround SelectedColor.BackPriority = 50 SelectedColor.ForePriority = 50 SelectedColor.FramePriority = 50 SelectedColor.BoldPriority = 50 SelectedColor.ItalicPriority = 50 SelectedColor.UnderlinePriority = 50 + SelectedColor.StrikeOutPriority = 50 OnStatusChange = SynMemoStatusChange inline SynLeftGutterPartList1: TSynGutterPartList object SynGutterMarks1: TSynGutterMarks @@ -471,6 +473,7 @@ object FormIniEditor: TFormIniEditor MouseActions = <> MarkupInfo.Background = clBtnFace MarkupInfo.Foreground = clNone + MarkupInfo.FrameEdges = sfeAround DigitCount = 2 ShowOnlyLineNumbersMultiplesOf = 1 ZeroStart = False @@ -485,11 +488,15 @@ object FormIniEditor: TFormIniEditor object SynGutterSeparator1: TSynGutterSeparator Width = 2 MouseActions = <> + MarkupInfo.Background = clWhite + MarkupInfo.Foreground = clGray + MarkupInfo.FrameEdges = sfeAround end object SynGutterCodeFolding1: TSynGutterCodeFolding MouseActions = <> MarkupInfo.Background = clNone MarkupInfo.Foreground = clGray + MarkupInfo.FrameEdges = sfeAround MouseActionsExpanded = <> MouseActionsCollapsed = <> end @@ -497,7 +504,7 @@ object FormIniEditor: TFormIniEditor end object FileNameEdit: TFileNameEdit Left = 56 - Height = 23 + Height = 21 Top = 24 Width = 368 OnAcceptFileName = FileNameEditAcceptFileName @@ -510,28 +517,28 @@ object FormIniEditor: TFormIniEditor end object INIFileLabel: TLabel Left = 8 - Height = 15 + Height = 13 Top = 24 - Width = 34 + Width = 32 Caption = 'INI file' ParentColor = False end object ProfileSelect: TComboBox Left = 56 - Height = 23 + Height = 21 Hint = 'Choose the profile you want to enable' Top = 61 Width = 164 - ItemHeight = 15 + ItemHeight = 13 OnSelect = ProfileSelectSelect Sorted = True TabOrder = 1 end object ProfileLabel: TLabel Left = 8 - Height = 15 + Height = 13 Top = 64 - Width = 34 + Width = 30 Caption = 'Profile' ParentColor = False end @@ -556,6 +563,17 @@ object FormIniEditor: TFormIniEditor OnClick = CancelButtonClick TabOrder = 3 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 DefaultFilter = 'INI Files (*.ini)|*.ini' Enabled = False diff --git a/packages/fcl-db/tests/inieditor.pas b/packages/fcl-db/tests/inieditor.pas index 60a365c975..9e1a387f2e 100644 --- a/packages/fcl-db/tests/inieditor.pas +++ b/packages/fcl-db/tests/inieditor.pas @@ -15,6 +15,7 @@ type TFormIniEditor = class(TForm) GUITimer: TIdleTimer; + Label1: TLabel; OKButton: TButton; CancelButton: TButton; ProfileSelect: TComboBox; diff --git a/packages/fcl-db/tests/sqldbtoolsunit.pas b/packages/fcl-db/tests/sqldbtoolsunit.pas index 687c8b6b36..ff0ce307b0 100644 --- a/packages/fcl-db/tests/sqldbtoolsunit.pas +++ b/packages/fcl-db/tests/sqldbtoolsunit.pas @@ -12,7 +12,7 @@ uses ,pqconnection ,odbcconn {$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 {$ENDIF WIN64} ,sqlite3conn