mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-10 09:18:26 +02:00
textextent test: Fixes rendering for widgetsets which correctly apply the Brush under TextOut
git-svn-id: trunk@33564 -
This commit is contained in:
parent
027d11ac6a
commit
1e32edd4db
@ -41,10 +41,13 @@ var
|
|||||||
lSize: TSize;
|
lSize: TSize;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
for i := 0 to 23 do lPartialWidths[i] := 0;
|
||||||
|
|
||||||
// Basic initialization
|
// Basic initialization
|
||||||
Image.Canvas.Font.Size := 12;
|
Image.Canvas.Font.Size := 12;
|
||||||
Image.Canvas.Pen.Color := clWhite;
|
Image.Canvas.Pen.Color := clWhite;
|
||||||
Image.Canvas.Brush.Color := clWhite;
|
Image.Canvas.Brush.Color := clWhite;
|
||||||
|
Image.Canvas.Brush.Style := bsSolid;
|
||||||
Image.Canvas.Rectangle(0, 0, Image.Width, Image.Height);
|
Image.Canvas.Rectangle(0, 0, Image.Width, Image.Height);
|
||||||
|
|
||||||
// TextFitInfo test 1 (calls GetTextExtentExPoint with partial widths = nil)
|
// TextFitInfo test 1 (calls GetTextExtentExPoint with partial widths = nil)
|
||||||
@ -52,7 +55,9 @@ begin
|
|||||||
lRes := Image.Canvas.TextFitInfo(lStr, 80);
|
lRes := Image.Canvas.TextFitInfo(lStr, 80);
|
||||||
Image.Canvas.TextOut(20, 20, Format('TextFitInfo Test 1. Returned %d should be aprox. 7 to 10', [lRes]));
|
Image.Canvas.TextOut(20, 20, Format('TextFitInfo Test 1. Returned %d should be aprox. 7 to 10', [lRes]));
|
||||||
Image.Canvas.Brush.Color := clBlue;
|
Image.Canvas.Brush.Color := clBlue;
|
||||||
|
Image.Canvas.Brush.Style := bsSolid;
|
||||||
Image.Canvas.Rectangle(20, 35, 100, 50);
|
Image.Canvas.Rectangle(20, 35, 100, 50);
|
||||||
|
Image.Canvas.Brush.Style := bsClear;
|
||||||
Image.Canvas.TextOut(20, 35, lStr);
|
Image.Canvas.TextOut(20, 35, lStr);
|
||||||
|
|
||||||
// GetTextExtentExPoint test 1 with partial widths and MaxCount
|
// GetTextExtentExPoint test 1 with partial widths and MaxCount
|
||||||
@ -60,11 +65,14 @@ begin
|
|||||||
LCLIntf.GetTextExtentExPoint(Image.Canvas.Handle, PChar(lStr),
|
LCLIntf.GetTextExtentExPoint(Image.Canvas.Handle, PChar(lStr),
|
||||||
Length(lStr), 50, @lMaxCount, @lPartialWidths[0], lSize);
|
Length(lStr), 50, @lMaxCount, @lPartialWidths[0], lSize);
|
||||||
lRes := Image.Canvas.TextFitInfo(lStr, 50);
|
lRes := Image.Canvas.TextFitInfo(lStr, 50);
|
||||||
|
Image.Canvas.Brush.Style := bsClear;
|
||||||
Image.Canvas.TextOut(20, 60, Format('GetTextExtentExPoint Test 1. Returned MaxCount=%d should be aprox. 4 to 6', [lMaxCount]));
|
Image.Canvas.TextOut(20, 60, Format('GetTextExtentExPoint Test 1. Returned MaxCount=%d should be aprox. 4 to 6', [lMaxCount]));
|
||||||
Image.Canvas.Brush.Color := clBlue;
|
Image.Canvas.Brush.Color := clBlue;
|
||||||
for i := 0 to 6 do
|
for i := 0 to 6 do
|
||||||
begin
|
begin
|
||||||
|
Image.Canvas.Brush.Style := bsSolid;
|
||||||
Image.Canvas.Rectangle(20, 75 + i * 15, 20+lPartialWidths[i], 90 + i * 15);
|
Image.Canvas.Rectangle(20, 75 + i * 15, 20+lPartialWidths[i], 90 + i * 15);
|
||||||
|
Image.Canvas.Brush.Style := bsClear;
|
||||||
Image.Canvas.TextOut(20, 75 + i *15, lStr);
|
Image.Canvas.TextOut(20, 75 + i *15, lStr);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -15,8 +15,36 @@
|
|||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<StringTable ProductVersion=""/>
|
<StringTable ProductVersion=""/>
|
||||||
</VersionInfo>
|
</VersionInfo>
|
||||||
<BuildModes Count="1">
|
<BuildModes Count="2">
|
||||||
<Item1 Name="Default" Default="True"/>
|
<Item1 Name="Default" Default="True"/>
|
||||||
|
<Item2 Name="Qt">
|
||||||
|
<MacroValues Count="1">
|
||||||
|
<Macro1 Name="LCLWidgetType" Value="qt"/>
|
||||||
|
</MacroValues>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="textextent"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Linking>
|
||||||
|
<Options>
|
||||||
|
<Win32>
|
||||||
|
<GraphicApplication Value="True"/>
|
||||||
|
</Win32>
|
||||||
|
</Options>
|
||||||
|
</Linking>
|
||||||
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<UseMsgFile Value="True"/>
|
||||||
|
</CompilerMessages>
|
||||||
|
<CompilerPath Value="$(CompPath)"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
</Item2>
|
||||||
</BuildModes>
|
</BuildModes>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
@ -65,6 +93,9 @@
|
|||||||
</Options>
|
</Options>
|
||||||
</Linking>
|
</Linking>
|
||||||
<Other>
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<UseMsgFile Value="True"/>
|
||||||
|
</CompilerMessages>
|
||||||
<CompilerPath Value="$(CompPath)"/>
|
<CompilerPath Value="$(CompPath)"/>
|
||||||
</Other>
|
</Other>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
|
Loading…
Reference in New Issue
Block a user