You've already forked lazarus-ccr
fpspreadsheet: Replace new fpsutils.GetSetValues by typinfo.SetToString.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4382 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -168,8 +168,6 @@ function SameFont(AFont1, AFont2: TsFont): Boolean; overload;
|
|||||||
function SameFont(AFont: TsFont; AFontName: String; AFontSize: Single;
|
function SameFont(AFont: TsFont; AFontName: String; AFontSize: Single;
|
||||||
AStyle: TsFontStyles; AColor: TsColor; APos: TsFontPosition): Boolean; overload;
|
AStyle: TsFontStyles; AColor: TsColor; APos: TsFontPosition): Boolean; overload;
|
||||||
|
|
||||||
function GetSetValues(const aSet: PTypeInfo; Value: Integer):string;
|
|
||||||
|
|
||||||
//function GetUniqueTempDir(Global: Boolean): String;
|
//function GetUniqueTempDir(Global: Boolean): String;
|
||||||
|
|
||||||
procedure AppendToStream(AStream: TStream; const AString: String); inline; overload;
|
procedure AppendToStream(AStream: TStream; const AString: String); inline; overload;
|
||||||
@@ -2497,29 +2495,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{@@ Returns a readable string containing the names of the elements contained in
|
|
||||||
a set. For example, call like
|
|
||||||
s := GetSetValue(TypeInfo(TsFontStyles, Integer(font.style));
|
|
||||||
-------------------------------------------------------------------------------}
|
|
||||||
function GetSetValues(const aSet:PTypeInfo; Value: Integer):string;
|
|
||||||
var
|
|
||||||
vData1 : PTypeData;
|
|
||||||
vData2 : PTypeData;
|
|
||||||
vCntr : Integer;
|
|
||||||
v: Integer;
|
|
||||||
begin
|
|
||||||
Result := '';
|
|
||||||
if aSet^.Kind = tkSet then begin
|
|
||||||
vData1 := GetTypeData(aSet);
|
|
||||||
vData2 := GetTypeData(vData1^.CompType);
|
|
||||||
for vCntr := vData2^.MinValue to vData2^.MaxValue do
|
|
||||||
if (Value shr vCntr) and 1 <> 0 then
|
|
||||||
Result := Result+ GetEnumName(vData1^.CompType,vCntr)+',';
|
|
||||||
if Result <> '' then Delete(Result, Length(Result), 1);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
InitUTF8FormatSettings;
|
InitUTF8FormatSettings;
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
unit fonttests;
|
unit fonttests;
|
||||||
|
|
||||||
//{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
{$mode Delphi}{$H+}
|
//{$mode Delphi}{$H+}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
{ Font tests
|
{ Font tests
|
||||||
@@ -72,7 +72,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
fpsutils, TypInfo;
|
TypInfo;
|
||||||
|
|
||||||
const
|
const
|
||||||
FontSheet = 'Font';
|
FontSheet = 'Font';
|
||||||
@@ -244,17 +244,8 @@ begin
|
|||||||
font := MyWorksheet.ReadCellFont(MyCell);
|
font := MyWorksheet.ReadCellFont(MyCell);
|
||||||
CheckEquals(SollSizes[row], font.Size,
|
CheckEquals(SollSizes[row], font.Size,
|
||||||
'Test unsaved font size, cell ' + CellNotation(MyWorksheet,0,0));
|
'Test unsaved font size, cell ' + CellNotation(MyWorksheet,0,0));
|
||||||
{$IF FPC_FULLVERSION >= 030101}
|
currValue := SetToString(PTypeInfo(TypeInfo(TsFontStyles)), integer(font.Style), false);
|
||||||
currValue := GetEnumName(TypeInfo(TsFontStyles), byte(font.Style)); // wp: 2.6.4--> integer, 3.1.1 --> byte!
|
expectedValue := SetToString(PTypeInfo(TypeInfo(TsFontStyles)), integer(SollStyles[col]), false);
|
||||||
expectedValue := GetEnumName(TypeInfo(TsFontStyles), byte(SollStyles[col]));
|
|
||||||
currValue := GetSetValues(TypeInfo(TsFontStyles), byte(font.Style));
|
|
||||||
expectedValue := GetSetValues(TypeInfo(TsFontStyles), byte(SollStyles[col]));
|
|
||||||
{$ELSE}
|
|
||||||
// currValue := GetEnumName(TypeInfo(TsFontStyles), integer(font.Style)); // wp: 2.6.4--> integer, 3.1.1 --> byte!
|
|
||||||
// expectedValue := GetEnumName(TypeInfo(TsFontStyles), integer(SollStyles[col]));
|
|
||||||
currValue := GetSetValues(TypeInfo(TsFontStyles), integer(font.Style));
|
|
||||||
expectedValue := GetSetValues(TypeInfo(TsFontStyles), integer(SollStyles[col]));
|
|
||||||
{$ENDIF}
|
|
||||||
CheckEquals(currValue, expectedValue,
|
CheckEquals(currValue, expectedValue,
|
||||||
'Test unsaved font style, cell ' + CellNotation(MyWorksheet,0,0));
|
'Test unsaved font style, cell ' + CellNotation(MyWorksheet,0,0));
|
||||||
end;
|
end;
|
||||||
@@ -288,10 +279,8 @@ begin
|
|||||||
if abs(SollSizes[row] - font.Size) > 1e-6 then // safe-guard against rounding errors
|
if abs(SollSizes[row] - font.Size) > 1e-6 then // safe-guard against rounding errors
|
||||||
CheckEquals(SollSizes[row], font.Size,
|
CheckEquals(SollSizes[row], font.Size,
|
||||||
'Test saved font size, cell '+CellNotation(MyWorksheet,Row,Col));
|
'Test saved font size, cell '+CellNotation(MyWorksheet,Row,Col));
|
||||||
// currValue := GetEnumName(TypeInfo(TsFontStyles), integer(font.Style));
|
currValue := SetToString(PTypeInfo(TypeInfo(TsFontStyles)), integer(font.Style), false);
|
||||||
// expectedValue := GetEnumName(TypeInfo(TsFontStyles), integer(SollStyles[col]));
|
expectedValue := SetToString(PTypeInfo(TypeInfo(TsFontStyles)), integer(SollStyles[col]), false);
|
||||||
currValue := GetSetValues(TypeInfo(TsFontStyles), byte(font.Style));
|
|
||||||
expectedValue := GetSetValues(TypeInfo(TsFontStyles), byte(SollStyles[col]));
|
|
||||||
CheckEquals(currValue, expectedValue,
|
CheckEquals(currValue, expectedValue,
|
||||||
'Test unsaved font style, cell ' + CellNotation(MyWorksheet,0,0));
|
'Test unsaved font style, cell ' + CellNotation(MyWorksheet,0,0));
|
||||||
inc(counter);
|
inc(counter);
|
||||||
|
@@ -155,9 +155,6 @@
|
|||||||
<OtherUnitFiles Value=".."/>
|
<OtherUnitFiles Value=".."/>
|
||||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Other>
|
|
||||||
<CustomOptions Value="-d-MDelphi"/>
|
|
||||||
</Other>
|
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<Exceptions Count="6">
|
<Exceptions Count="6">
|
||||||
|
Reference in New Issue
Block a user