-
Notifications
You must be signed in to change notification settings - Fork 0
/
boardtestunit.pas
81 lines (63 loc) · 1.82 KB
/
boardtestunit.pas
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
UNIT boardTestUnit;
{$mode objfpc}{$H+}
INTERFACE
USES
sysutils, Forms, Controls, Menus, Dialogs, challenges, visualGates,
testFrameUI, Classes;
TYPE
{ TBoardTestForm }
TBoardTestForm = class(TForm)
MainMenu1: TMainMenu;
miExportToClipboard: TMenuItem;
miExportToCsv: TMenuItem;
miExport: TMenuItem;
SaveDialog1: TSaveDialog;
TestCreationFrame1: TTestCreationFrame;
PROCEDURE FormCreate(Sender: TObject);
PROCEDURE FormShow(Sender: TObject);
PROCEDURE miExportToClipboardClick(Sender: TObject);
PROCEDURE miExportToCsvClick(Sender: TObject);
private
tester: T_testCreator;
public
PROCEDURE showForBoard(CONST board:P_visualBoard);
end;
FUNCTION BoardTestForm: TBoardTestForm;
IMPLEMENTATION
USES visuals;
VAR myBoardTestForm: TBoardTestForm=nil;
FUNCTION BoardTestForm: TBoardTestForm;
begin
if myBoardTestForm=nil then myBoardTestForm:=TBoardTestForm.create(nil);
result:=myBoardTestForm;
end;
{$R *.lfm}
{ TBoardTestForm }
PROCEDURE TBoardTestForm.miExportToCsvClick(Sender: TObject);
begin
if SaveDialog1.execute then TestCreationFrame1.exportTable(SaveDialog1.fileName);
end;
PROCEDURE TBoardTestForm.miExportToClipboardClick(Sender: TObject);
begin
TestCreationFrame1.CopyToClipboard;
end;
PROCEDURE TBoardTestForm.FormShow(Sender: TObject);
begin
applyColorScheme(self);
end;
PROCEDURE TBoardTestForm.FormCreate(Sender: TObject);
begin
TestCreationFrame1.initOnCreate;
end;
PROCEDURE TBoardTestForm.showForBoard(CONST board: P_visualBoard);
begin
tester.createForAnalysis(board);
TestCreationFrame1.setTestGenerator(@tester,maxLongint);
ShowModal;
TestCreationFrame1.detachTestGenerator;
tester.destroy;
end;
{ TBoardTestForm }
FINALIZATION
if myBoardTestForm<>nil then FreeAndNil(myBoardTestForm);
end.