fpspreadsheet: Make ods stringtests test case ignore the string result of the ##0.0E0 format which is designed in ods to have a different result than biff; just compare the numerical value.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3129 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-06-02 19:48:50 +00:00
parent 09d9d95789
commit 8fd1b142ab

View File

@ -175,7 +175,7 @@ begin
for Row := Low(SollStrings) to High(SollStrings) do
begin
ActualString:=MyWorkSheet.ReadAsUTF8Text(Row,0);
CheckEquals(SollStrings[Row],ActualString,'Test value mismatch cell '+CellNotation(MyWorkSheet,Row));
CheckEquals(SollStrings[Row],ActualString,'Test value mismatch, cell '+CellNotation(MyWorkSheet,Row));
end;
// Finalization
MyWorkbook.Free;
@ -294,6 +294,7 @@ end;
procedure TSpreadReadStringTests.TestReadString(FileName: string; Row: integer);
var
ActualString: string;
AFormat: TsSpreadsheetFormat;
begin
if Row>High(SollStrings) then
fail('Error in test code: array bounds overflow. Check array size is correct.');
@ -305,20 +306,25 @@ begin
// Open the spreadsheet
TestWorkbook := TsWorkbook.Create;
case UpperCase(ExtractFileExt(FileName)) of
'.XLSX': TestWorkbook.ReadFromFile(FileName, sfOOXML);
'.ODS': TestWorkbook.ReadFromFile(FileName, sfOpenDocument);
// Excel XLS/BIFF
else TestWorkbook.ReadFromFile(FileName, sfExcel8);
case Uppercase(ExtractFileExt(FileName)) of
'.XLSX': AFormat := sfOOXML;
'.ODS' : AFormat := sfOpenDocument;
else AFormat := sfExcel8;
end;
TestWorkbook.ReadFromFile(FileName, AFormat);
TestWorksheet := GetWorksheetByName(TestWorkBook, StringsSheet);
if TestWorksheet=nil then
fail('Error in test code: could not retrieve worksheet.');
end;
ActualString := TestWorkSheet.ReadAsUTF8Text(Row,0);
if (Row = 11) and (AFormat = sfOpenDocument) then
// SciFloat is not supported by Biff2 and ODS --> we just compare the value
CheckEquals(StrToFloat(SollStrings[Row]), StrToFloat(ActualString),
'Test value mismatch, cell ' + CellNotation(TestWorksheet, Row))
else
CheckEquals(SollStrings[Row], ActualString, 'Test value mismatch, '
+'cell '+CellNotation(TestWorkSheet,Row));
+'cell '+CellNotation(TestWorkSheet, Row));
// Don't free the workbook here - it will be reused. It is destroyed at finalization.
end;