mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-23 15:59:11 +02:00
SynEdit, TEST: Control LinesInWindow for certain tests
git-svn-id: trunk@57508 -
This commit is contained in:
parent
8461dce8ae
commit
b080094f72
@ -7,7 +7,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, math, fpcunit,
|
||||
Forms, LCLType, LCLProc, Clipbrd, LazUTF8,
|
||||
Forms, LCLType, LCLProc, Clipbrd, Controls, LazUTF8,
|
||||
SynEdit, SynEditTypes, SynEditPointClasses, SynEditKeyCmds, LazSynTextArea, SynEditMarkup;
|
||||
|
||||
type
|
||||
@ -53,6 +53,7 @@ type
|
||||
FBaseTestNames: Array of String;
|
||||
FFixedBaseTestNames: Integer;
|
||||
FForm : TForm;
|
||||
FScroll: TScrollBox;
|
||||
FUseFullText: Boolean;
|
||||
function GetClipBoardText: String;
|
||||
procedure SetBaseTestName(const AValue: String);
|
||||
@ -71,6 +72,7 @@ type
|
||||
function LinesReplaceText(Lines: Array of String; Repl: Array of const): String;
|
||||
protected
|
||||
procedure ReCreateEdit;
|
||||
procedure SetSynEditHeight(Lines: Integer; PartLinePixel: Integer = 3);
|
||||
procedure SetLines(Lines: Array of String);
|
||||
(* Setting selection, with one X/Y pair having negative values, will set caret to other X/Y pair and clear selection *)
|
||||
// Locical Caret
|
||||
@ -266,6 +268,9 @@ begin
|
||||
Clipboard.Open;
|
||||
|
||||
FForm := TForm.Create(nil);
|
||||
FScroll := TScrollBox.Create(FForm);
|
||||
FScroll.Parent := FForm;
|
||||
FScroll.Align := alClient;
|
||||
ReCreateEdit;
|
||||
FForm.Show;
|
||||
FFixedBaseTestNames := 0;
|
||||
@ -558,7 +563,7 @@ end;
|
||||
procedure TTestBase.ReCreateEdit;
|
||||
begin
|
||||
FreeAndNil(FSynEdit);
|
||||
FSynEdit := TTestSynEdit.Create(FForm);
|
||||
FSynEdit := TTestSynEdit.Create(FScroll);
|
||||
FSynEdit.Parent := FForm;
|
||||
FSynEdit.Top := 0;
|
||||
FSynEdit.Left := 0;
|
||||
@ -566,6 +571,12 @@ begin
|
||||
FSynEdit.Height := 250; // FSynEdit.Font.Height * 20 + 2;
|
||||
end;
|
||||
|
||||
procedure TTestBase.SetSynEditHeight(Lines: Integer; PartLinePixel: Integer);
|
||||
begin
|
||||
FSynEdit.Height := FSynEdit.LineHeight * Lines + PartLinePixel +
|
||||
(FSynEdit.Height - FSynEdit.ClientHeight);
|
||||
end;
|
||||
|
||||
procedure TTestBase.SetLines(Lines: array of String);
|
||||
begin
|
||||
SynEdit.Text := LinesToText(Lines);
|
||||
|
@ -257,6 +257,7 @@ begin
|
||||
Markup.EndMarkup;
|
||||
|
||||
PushBaseName('edit');
|
||||
SetSynEditHeight(40);
|
||||
ClearInvalidatedLines;
|
||||
DoKeyPressAtPos(1, 13, [VK_SPACE, VK_SPACE]); // if b then
|
||||
// TestInvalidate('after edit', 14, 15); // what about 13, ok it is already invalidated....
|
||||
|
Loading…
Reference in New Issue
Block a user