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;
|
||||
AStyle: TsFontStyles; AColor: TsColor; APos: TsFontPosition): Boolean; overload;
|
||||
|
||||
function GetSetValues(const aSet: PTypeInfo; Value: Integer):string;
|
||||
|
||||
//function GetUniqueTempDir(Global: Boolean): String;
|
||||
|
||||
procedure AppendToStream(AStream: TStream; const AString: String); inline; overload;
|
||||
@ -2497,29 +2495,6 @@ begin
|
||||
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
|
||||
InitUTF8FormatSettings;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
unit fonttests;
|
||||
|
||||
//{$mode objfpc}{$H+}
|
||||
{$mode Delphi}{$H+}
|
||||
{$mode objfpc}{$H+}
|
||||
//{$mode Delphi}{$H+}
|
||||
|
||||
interface
|
||||
{ Font tests
|
||||
@ -72,7 +72,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
fpsutils, TypInfo;
|
||||
TypInfo;
|
||||
|
||||
const
|
||||
FontSheet = 'Font';
|
||||
@ -244,17 +244,8 @@ begin
|
||||
font := MyWorksheet.ReadCellFont(MyCell);
|
||||
CheckEquals(SollSizes[row], font.Size,
|
||||
'Test unsaved font size, cell ' + CellNotation(MyWorksheet,0,0));
|
||||
{$IF FPC_FULLVERSION >= 030101}
|
||||
currValue := GetEnumName(TypeInfo(TsFontStyles), byte(font.Style)); // wp: 2.6.4--> integer, 3.1.1 --> byte!
|
||||
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}
|
||||
currValue := SetToString(PTypeInfo(TypeInfo(TsFontStyles)), integer(font.Style), false);
|
||||
expectedValue := SetToString(PTypeInfo(TypeInfo(TsFontStyles)), integer(SollStyles[col]), false);
|
||||
CheckEquals(currValue, expectedValue,
|
||||
'Test unsaved font style, cell ' + CellNotation(MyWorksheet,0,0));
|
||||
end;
|
||||
@ -288,10 +279,8 @@ begin
|
||||
if abs(SollSizes[row] - font.Size) > 1e-6 then // safe-guard against rounding errors
|
||||
CheckEquals(SollSizes[row], font.Size,
|
||||
'Test saved font size, cell '+CellNotation(MyWorksheet,Row,Col));
|
||||
// currValue := GetEnumName(TypeInfo(TsFontStyles), integer(font.Style));
|
||||
// expectedValue := GetEnumName(TypeInfo(TsFontStyles), integer(SollStyles[col]));
|
||||
currValue := GetSetValues(TypeInfo(TsFontStyles), byte(font.Style));
|
||||
expectedValue := GetSetValues(TypeInfo(TsFontStyles), byte(SollStyles[col]));
|
||||
currValue := SetToString(PTypeInfo(TypeInfo(TsFontStyles)), integer(font.Style), false);
|
||||
expectedValue := SetToString(PTypeInfo(TypeInfo(TsFontStyles)), integer(SollStyles[col]), false);
|
||||
CheckEquals(currValue, expectedValue,
|
||||
'Test unsaved font style, cell ' + CellNotation(MyWorksheet,0,0));
|
||||
inc(counter);
|
||||
|
@ -155,9 +155,6 @@
|
||||
<OtherUnitFiles Value=".."/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Other>
|
||||
<CustomOptions Value="-d-MDelphi"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="6">
|
||||
|
Reference in New Issue
Block a user