codetools: added test rename lfm property

This commit is contained in:
mattias 2025-07-12 18:56:10 +02:00
parent e87b0b10d9
commit 05a719d9fc
2 changed files with 49 additions and 3 deletions

View File

@ -38,7 +38,7 @@ uses
TestStdCodetools, TestFindDeclaration, TestIdentCompletion, TestCompleteBlock,
TestRefactoring, TestCodeCompletion, TestCompReaderWriterPas,
fdt_arrays, TestCTPas2js, TestChangeDeclaration, TestLFMTrees,
TestDesignerFormTools, Dsgn_BearButtons, Dsgn_AmbigBearBtn;
TestDesignerFormTools;
const
ConfigFilename = 'codetools.config';

View File

@ -95,6 +95,7 @@ type
procedure TestRenameAlsoLFM_Variable;
procedure TestRenameAlsoLFM_Event;
procedure TestRenameAlsoLFM_SkipBinaryData;
procedure TestRenameAlsoLFM_Property; // ToDo
end;
implementation
@ -2159,8 +2160,6 @@ begin
end;
procedure TTestRefactoring.TestRenameAlsoLFM_Event;
var
Test1LFM, RedUnit: TCodeBuffer;
begin
TestRenameAlsoLFM(LinesToStr([ // red unit interface
'type',
@ -2252,6 +2251,53 @@ begin
end;
end;
procedure TTestRefactoring.TestRenameAlsoLFM_Property;
var
Test1LFM: TCodeBuffer;
begin
exit;
Test1LFM:=CodeToolBoss.CreateFile(ChangeFileExt(Code.Filename,'.lfm'));
try
Test1LFM.Source:=LinesToStr([
'object Form1: TForm1',
' Checked = False',
' object Button1',
' Checked = True',
' end',
'end']);
Add(LinesToStr([
'unit Test1;',
'{$mode objfpc}{$H+}',
'interface',
'type',
' TForm = class(TComponent)',
' property Checked: boolean;',
' end;',
' TButton = class(TComponent)',
' property Checked{#Rename}: boolean;',
' end;',
' TForm1 = class(TForm)',
' Button1: TButton;',
' end;',
'implementation',
'end.']));
RenameReferences('Activated',frfAllLFM);
CheckDiff(Test1LFM,LinesToStr([
'object Form1: TForm1',
' Checked = False',
' object Button1',
' Activated = True',
' end',
'end']));
finally
Test1LFM.IsDeleted:=true;
end;
end;
initialization
RegisterTests([TTestRefactoring]);
end.