fpspreadsheet: Fix inconsistencies in test suite introduced by FPC 3.2.0
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7547 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
52e4cccf80
commit
1339faac5a
@ -244,16 +244,26 @@ begin
|
||||
for i:=Low(SollNumbers) to High(SollNumbers) do
|
||||
begin
|
||||
SollNumberStrings[i, 0] := FloatToStr(SollNumbers[i], fs);
|
||||
|
||||
{ Here are workarounds for inconsistencies introduces by FPC 3.2.0 }
|
||||
{$IF FPC_FullVersion >= 30100}
|
||||
SollNumberStrings[i, 1] := Format('%.0f', [SollNumbers[i]], fs);
|
||||
SollNumberStrings[i, 2] := Format('%.2f', [SollNumbers[i]], fs);
|
||||
SollNumberStrings[i, 3] := Format('%.0n', [SollNumbers[i]], fs);
|
||||
SollNumberStrings[i, 4] := Format('%.2n', [SollNumbers[i]], fs);
|
||||
SollNumberStrings[i, 5] := FloatToStrF(SollNumbers[i], ffExponent, 3, 2, fs);
|
||||
SollNumberStrings[i, 6] := Format('%.0f%%', [SollNumbers[i]*100], fs);
|
||||
SollNumberStrings[i, 7] := Format('%.2f%%', [SollNumbers[i]*100], fs);
|
||||
{$ELSE}
|
||||
SollNumberStrings[i, 1] := FormatFloat('0', SollNumbers[i], fs);
|
||||
SollNumberStrings[i, 2] := FormatFloat('0.00', SollNumbers[i], fs);
|
||||
// For the next two cases don't use FormatFloat('#,##0') and
|
||||
// FormatFloat('#,##0.00') which produce '-0' and '-0.00', respectively,
|
||||
// for the case of -1.23456E-6 which is not consistent with Excel.
|
||||
SollNumberStrings[i, 3] := Format('%.0n', [SollNumbers[i]], fs);
|
||||
SollNumberStrings[i, 4] := Format('%.2n', [SollNumbers[i]], fs);
|
||||
SollNumberStrings[i, 5] := FormatFloat('0.00E+00', SollNumbers[i], fs);
|
||||
SollNumberStrings[i, 6] := FormatFloat('0', SollNumbers[i]*100, fs) + '%';
|
||||
SollNumberStrings[i, 7] := FormatFloat('0.00', SollNumbers[i]*100, fs) + '%';
|
||||
{$IFEND}
|
||||
|
||||
// Don't use FormatCurr for the next two cases because is reports the sign of
|
||||
// very small numbers inconsistenly with the spreadsheet applications.
|
||||
SollNumberStrings[i, 8] := FormatFloat('"€"#,##0;("€"#,##0)', SollNumbers[i], fs);
|
||||
@ -1793,6 +1803,11 @@ begin
|
||||
currStr := MyWorksheet.ReadAsText(r, c);
|
||||
currVal := MyWorksheet.ReadAsNumber(r, c);
|
||||
sollStr := FormatFloat(FormatStrings[c], currVal);
|
||||
{$IF FPC_FullVersion >= 30100} // workaround for FPC 3.2+ FormatFloat() issue
|
||||
if (pos('E', FormatStrings[c]) > 0) then
|
||||
sollStr := FloatToStrF(currVal, ffExponent, 4, 2);
|
||||
// sollStr := StringReplace(sollStr, 'E--1', 'E+00', [rfIgnoreCase]);
|
||||
{$IFEND}
|
||||
// Quick & dirty fix for FPC's issue with #.00E+00 showing a leading zero
|
||||
if (sollStr <> '') and (sollStr[1] = '0') and
|
||||
(pos('#.', FormatStrings[c]) = 1) and (pos('E', FormatStrings[c]) > 0)
|
||||
|
@ -904,10 +904,10 @@ begin
|
||||
try
|
||||
MyWorkbook.ReadFromFile(TempFile, AFormat);
|
||||
MyWorksheet := MyWorkbook.GetWorksheetByName(sheetname);
|
||||
CheckEquals(AFirstRow, MyWorksheet.Pagelayout.RepeatedRows.FirstIndex, 'First repeated row index mismatch');
|
||||
CheckEquals(ALastRow, MyWorksheet.PageLayout.RepeatedRows.LastIndex, 'Last repeated row index mismatch');
|
||||
CheckEquals(AFirstCol, MyWorksheet.PageLayout.RepeatedCols.FirstIndex, 'First repeated col index mismatch');
|
||||
CheckEquals(ALastCol, MyWorksheet.PageLayout.RepeatedCols.LastIndex, 'Last repeated col index mismatch');
|
||||
CheckEquals(Cardinal(AFirstRow), MyWorksheet.Pagelayout.RepeatedRows.FirstIndex, 'First repeated row index mismatch');
|
||||
CheckEquals(Cardinal(ALastRow), MyWorksheet.PageLayout.RepeatedRows.LastIndex, 'Last repeated row index mismatch');
|
||||
CheckEquals(Cardinal(AFirstCol), MyWorksheet.PageLayout.RepeatedCols.FirstIndex, 'First repeated col index mismatch');
|
||||
CheckEquals(Cardinal(ALastCol), MyWorksheet.PageLayout.RepeatedCols.LastIndex, 'Last repeated col index mismatch');
|
||||
finally
|
||||
MyWorkbook.Free;
|
||||
DeleteFile(TempFile);
|
||||
|
Loading…
Reference in New Issue
Block a user