File: testgdbmicontrol.pas

package info (click to toggle)
lazarus 1.6.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 172,444 kB
  • ctags: 124,173
  • sloc: pascal: 1,528,777; xml: 260,232; sh: 3,008; java: 603; makefile: 512; perl: 297; sql: 222; ansic: 137
file content (122 lines) | stat: -rw-r--r-- 2,712 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
unit TestGDBMIControl;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
  CheckLst, testregistry, fpcunit, GuiTestRunner;

type

  { TTestControlForm }

TTestControlForm = class(TForm)
    WriteLogsOnErr: TCheckBox;
    CheckListBox1: TCheckListBox;
    chkGDB: TCheckListBox;
    CheckWriteLogs: TCheckBox;
    chkFPC: TCheckListBox;
    EdOnlyWatch: TEdit;
    EditLogDir: TEdit;
    Label1: TLabel;
    Panel1: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    Panel4: TPanel;
    procedure CheckWriteLogsChange(Sender: TObject);
procedure EditLogDirChange(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure WriteLogsOnErrChange(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end; 

var
  TestControlForm: TTestControlForm;

procedure RegisterTestSelectors(ANames: array of string);

implementation
uses TestBase;

var
  TestSelectors: TStringList = nil;

procedure RegisterTestSelectors(ANames: array of string);
var
  i: Integer;
begin
  if TestSelectors = nil then TestSelectors := TStringList.Create;
  for i := low(ANames) to high(ANames) do
    TestSelectors.Add(ANames[i]);
end;

{$R *.lfm}

{ TTestControlForm }

procedure TTestControlForm.FormShow(Sender: TObject);
var
  i, j: Integer;
  d: TDebuggerList;
  c: TCompilerList;
  s: String;
  f: Boolean;
begin
  OnShow := nil;
  Top := TestRunner.Top;
  Left := TestRunner.Left + TestRunner.Width;

  if DirectoryExistsUTF8(ConfDir+'logs') then
    EditLogDir.Text := ConfDir+'logs'+DirectorySeparator
  else if DirectoryExistsUTF8(ConfDir+'log') then
    EditLogDir.Text := ConfDir+'log'+DirectorySeparator
  else
    EditLogDir.Text := ConfDir;

  for i := 0 to TestSelectors.Count - 1 do begin
    s := TestSelectors[i];
    f := (s<>'') and (s[1] = '-');
    if f then delete(s,1,1);
    j := CheckListBox1.Items.Add(s);
    CheckListBox1.Checked[j] := not f;
  end;

  d := GetDebuggers;
  for i := 0 to d.Count - 1 do begin
    j := chkGDB.Items.Add(d.Name[i]);
    chkGDB.Checked[j] := True;
  end;
  c := GetCompilers;
  for i := 0 to c.Count - 1 do begin
    j := chkFPC.Items.Add(c.Name[i]);
    chkFPC.Checked[j] := True;
  end;

  WriteLog := CheckWriteLogs.Checked;
  WriteLogOnErr := WriteLogsOnErr.Checked;
end;

procedure TTestControlForm.WriteLogsOnErrChange(Sender: TObject);
begin
  WriteLogOnErr := WriteLogsOnErr.Checked;
end;

procedure TTestControlForm.EditLogDirChange(Sender: TObject);
begin
  Logdir := EditLogDir.Text;
end;

procedure TTestControlForm.CheckWriteLogsChange(Sender: TObject);
begin
  WriteLog := CheckWriteLogs.Checked;
end;

finalization
  TestSelectors.Free;
end.