You've already forked lazarus-ccr
fpspreadsheet: Add unit tests for writing/reading of borders, borderstyle and wordwrap for ods files. Passed.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3109 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -181,6 +181,13 @@ const
|
|||||||
DATEMODE_1900_BASE=2; //StarCalc compatibility, 1900-01-01 in FPC DateTime
|
DATEMODE_1900_BASE=2; //StarCalc compatibility, 1900-01-01 in FPC DateTime
|
||||||
DATEMODE_1904_BASE=1462; //1/1/1904 in FPC TDateTime
|
DATEMODE_1904_BASE=1462; //1/1/1904 in FPC TDateTime
|
||||||
|
|
||||||
|
const
|
||||||
|
// lsThin, lsMedium, lsDashed, lsDotted, lsThick, lsDouble, lsHair)
|
||||||
|
BORDER_LINESTYLES: array[TsLineStyle] of string =
|
||||||
|
('solid', 'solid', 'dashed', 'fine-dashed', 'solid', 'double', 'dotted');
|
||||||
|
BORDER_LINEWIDTHS: array[TsLinestyle] of string =
|
||||||
|
('0.002cm', '2pt', '0.002cm', '0.002cm', '3pt', '0.039cm', '0.002cm');
|
||||||
|
|
||||||
type
|
type
|
||||||
{ Style items relevant to FPSpreadsheet. Stored in the StylesList of the reader. }
|
{ Style items relevant to FPSpreadsheet. Stored in the StylesList of the reader. }
|
||||||
TStyleData = class
|
TStyleData = class
|
||||||
@ -765,10 +772,12 @@ var
|
|||||||
wrap: Boolean;
|
wrap: Boolean;
|
||||||
borders: TsCellBorders;
|
borders: TsCellBorders;
|
||||||
borderStyles: TsCellBorderStyles;
|
borderStyles: TsCellBorderStyles;
|
||||||
bkClr: DWord;
|
bkClr: TsColorValue;
|
||||||
s: String;
|
s: String;
|
||||||
|
|
||||||
procedure SetBorderStyle(ABorder: TsCellBorder; AStyleValue: String);
|
procedure SetBorderStyle(ABorder: TsCellBorder; AStyleValue: String);
|
||||||
|
const
|
||||||
|
EPS = 0.1; // takes care of rounding errors for line widths
|
||||||
var
|
var
|
||||||
L: TStringList;
|
L: TStringList;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@ -776,7 +785,7 @@ var
|
|||||||
s: String;
|
s: String;
|
||||||
wid: Double;
|
wid: Double;
|
||||||
linestyle: String;
|
linestyle: String;
|
||||||
rgb: DWord;
|
rgb: TsColorValue;
|
||||||
p: Integer;
|
p: Integer;
|
||||||
begin
|
begin
|
||||||
L := TStringList.Create;
|
L := TStringList.Create;
|
||||||
@ -785,15 +794,14 @@ var
|
|||||||
L.StrictDelimiter := true;
|
L.StrictDelimiter := true;
|
||||||
L.DelimitedText := AStyleValue;
|
L.DelimitedText := AStyleValue;
|
||||||
wid := 0;
|
wid := 0;
|
||||||
rgb := DWord(-1);
|
rgb := TsColorValue(-1);
|
||||||
linestyle := '';
|
linestyle := '';
|
||||||
for i:=0 to L.Count-1 do begin
|
for i:=0 to L.Count-1 do begin
|
||||||
s := L[i];
|
s := L[i];
|
||||||
if (s = 'solid') or (s = 'dashed') or (s = 'fine-dashed') or (s = 'dotted')
|
if (s = 'solid') or (s = 'dashed') or (s = 'fine-dashed') or (s = 'dotted') or (s = 'double')
|
||||||
then linestyle := s;
|
then begin
|
||||||
if s[1] = '#' then begin
|
linestyle := s;
|
||||||
s[1] := '$';
|
continue;
|
||||||
rgb := StrToInt(s);
|
|
||||||
end;
|
end;
|
||||||
p := pos('pt', s);
|
p := pos('pt', s);
|
||||||
if p = Length(s)-1 then begin
|
if p = Length(s)-1 then begin
|
||||||
@ -810,11 +818,12 @@ var
|
|||||||
wid := cmToPts(StrToFloat(copy(s, 1, p-1), fs));
|
wid := cmToPts(StrToFloat(copy(s, 1, p-1), fs));
|
||||||
Continue;
|
Continue;
|
||||||
end;
|
end;
|
||||||
|
rgb := HTMLColorStrToColor(s);
|
||||||
end;
|
end;
|
||||||
borderStyles[ABorder].LineStyle := lsThin;
|
borderStyles[ABorder].LineStyle := lsThin;
|
||||||
if (linestyle = 'solid') then begin
|
if (linestyle = 'solid') then begin
|
||||||
if (wid >= 2) then borderStyles[ABorder].LineStyle := lsThick
|
if (wid >= 3 - EPS) then borderStyles[ABorder].LineStyle := lsThick
|
||||||
else if (wid >= 1) then borderStyles[ABorder].LineStyle := lsMedium
|
else if (wid >= 2 - EPS) then borderStyles[ABorder].LineStyle := lsMedium
|
||||||
end else
|
end else
|
||||||
if (linestyle = 'dotted') then
|
if (linestyle = 'dotted') then
|
||||||
borderStyles[ABorder].LineStyle := lsHair
|
borderStyles[ABorder].LineStyle := lsHair
|
||||||
@ -823,9 +832,12 @@ var
|
|||||||
borderStyles[ABorder].LineStyle := lsDashed
|
borderStyles[ABorder].LineStyle := lsDashed
|
||||||
else
|
else
|
||||||
if (linestyle = 'fine-dashed') then
|
if (linestyle = 'fine-dashed') then
|
||||||
borderStyles[ABorder].LineStyle := lsDotted;
|
borderStyles[ABorder].LineStyle := lsDotted
|
||||||
borderStyles[ABorder].Color := IfThen(rgb = DWord(-1), scBlack,
|
else
|
||||||
Workbook.AddColorToPalette(LongRGBToExcelPhysical(rgb)));
|
if (linestyle = 'double') then
|
||||||
|
borderStyles[ABorder].LineStyle := lsDouble;
|
||||||
|
borderStyles[ABorder].Color := IfThen(rgb = TsColorValue(-1),
|
||||||
|
scBlack, Workbook.AddColorToPalette(rgb));
|
||||||
finally
|
finally
|
||||||
L.Free;
|
L.Free;
|
||||||
end;
|
end;
|
||||||
@ -853,17 +865,15 @@ begin
|
|||||||
|
|
||||||
borders := [];
|
borders := [];
|
||||||
wrap := false;
|
wrap := false;
|
||||||
bkClr := DWord(-1);
|
bkClr := TsColorValue(-1);
|
||||||
|
|
||||||
styleChildNode := styleNode.FirstChild;
|
styleChildNode := styleNode.FirstChild;
|
||||||
while Assigned(styleChildNode) do begin
|
while Assigned(styleChildNode) do begin
|
||||||
if styleChildNode.NodeName = 'style:table-cell-properties' then begin
|
if styleChildNode.NodeName = 'style:table-cell-properties' then begin
|
||||||
// Background color
|
// Background color
|
||||||
s := GetAttrValue(styleChildNode, 'fo:background-color');
|
s := GetAttrValue(styleChildNode, 'fo:background-color');
|
||||||
if (s <> '') and (s <> 'transparent') then begin
|
if (s <> '') and (s <> 'transparent') then
|
||||||
if s[1] = '#' then s[1] := '$';
|
bkClr := HTMLColorStrToColor(s);
|
||||||
bkClr := StrToInt(s);
|
|
||||||
end;
|
|
||||||
// Borders
|
// Borders
|
||||||
s := GetAttrValue(styleChildNode, 'fo:border');
|
s := GetAttrValue(styleChildNode, 'fo:border');
|
||||||
if (s <>'') then begin
|
if (s <>'') then begin
|
||||||
@ -914,8 +924,8 @@ begin
|
|||||||
style.TextRotation := trHorizontal;
|
style.TextRotation := trHorizontal;
|
||||||
style.Borders := borders;
|
style.Borders := borders;
|
||||||
style.BorderStyles := borderStyles;
|
style.BorderStyles := borderStyles;
|
||||||
style.BackgroundColor := IfThen(bkClr = DWord(-1), scNotDefined,
|
style.BackgroundColor := IfThen(bkClr = TsColorValue(-1), scNotDefined,
|
||||||
Workbook.AddColorToPalette(LongRGBToExcelPhysical(bkClr)));
|
Workbook.AddColorToPalette(bkClr));
|
||||||
|
|
||||||
styleIndex := FStyleList.Add(style);
|
styleIndex := FStyleList.Add(style);
|
||||||
end;
|
end;
|
||||||
@ -1151,6 +1161,7 @@ end;
|
|||||||
function TsSpreadOpenDocWriter.WriteStylesXMLAsString: string;
|
function TsSpreadOpenDocWriter.WriteStylesXMLAsString: string;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
clr: string;
|
||||||
begin
|
begin
|
||||||
Result := '';
|
Result := '';
|
||||||
|
|
||||||
@ -1176,24 +1187,59 @@ begin
|
|||||||
|
|
||||||
if (uffBorder in FFormattingStyles[i].UsedFormattingFields) then
|
if (uffBorder in FFormattingStyles[i].UsedFormattingFields) then
|
||||||
begin
|
begin
|
||||||
if cbSouth in FFormattingStyles[i].Border then Result := Result + 'fo:border-bottom="0.002cm solid #000000" '
|
if cbSouth in FFormattingStyles[i].Border then begin
|
||||||
else Result := Result + 'fo:border-bottom="none" ';
|
Result := Result + Format('fo:border-bottom="%s %s %s" ', [
|
||||||
|
BORDER_LINEWIDTHS[FFormattingStyles[i].BorderStyles[cbSouth].LineStyle],
|
||||||
|
BORDER_LINESTYLES[FFormattingStyles[i].BorderStyles[cbSouth].LineStyle],
|
||||||
|
Workbook.GetPaletteColorAsHTMLStr(FFormattingStyles[i].BorderStyles[cbSouth].Color)
|
||||||
|
]);
|
||||||
|
if FFormattingStyles[i].BorderStyles[cbSouth].LineStyle = lsDouble then
|
||||||
|
Result := Result + 'style:border-linewidth-bottom="0.002cm 0.035cm 0.002cm" ';
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := Result + 'fo:border-bottom="none" ';
|
||||||
|
|
||||||
if cbWest in FFormattingStyles[i].Border then Result := Result + 'fo:border-left="0.002cm solid #000000" '
|
if cbWest in FFormattingStyles[i].Border then begin
|
||||||
else Result := Result + 'fo:border-left="none" ';
|
Result := Result + Format('fo:border-left="%s %s %s" ', [
|
||||||
|
BORDER_LINEWIDTHS[FFormattingStyles[i].BorderStyles[cbWest].LineStyle],
|
||||||
|
BORDER_LINESTYLES[FFormattingStyles[i].BorderStyles[cbWest].LineStyle],
|
||||||
|
Workbook.GetPaletteColorAsHTMLStr(FFormattingStyles[i].BorderStyles[cbWest].Color)
|
||||||
|
]);
|
||||||
|
if FFormattingStyles[i].BorderStyles[cbWest].LineStyle = lsDouble then
|
||||||
|
Result := Result + 'style:border-linewidth-left="0.002cm 0.035cm 0.002cm" ';
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := Result + 'fo:border-left="none" ';
|
||||||
|
|
||||||
if cbEast in FFormattingStyles[i].Border then Result := Result + 'fo:border-right="0.002cm solid #000000" '
|
if cbEast in FFormattingStyles[i].Border then begin
|
||||||
else Result := Result + 'fo:border-right="none" ';
|
Result := Result + Format('fo:border-right="%s %s %s" ', [
|
||||||
|
BORDER_LINEWIDTHS[FFormattingStyles[i].BorderStyles[cbEast].LineStyle],
|
||||||
|
BORDER_LINESTYLES[FFormattingStyles[i].BorderStyles[cbEast].LineStyle],
|
||||||
|
Workbook.GetPaletteColorAsHTMLStr(FFormattingStyles[i].BorderStyles[cbEast].Color)
|
||||||
|
]);
|
||||||
|
if FFormattingStyles[i].BorderStyles[cbSouth].LineStyle = lsDouble then
|
||||||
|
Result := Result + 'style:border-linewidth-right="0.002cm 0.035cm 0.002cm" ';
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := Result + 'fo:border-right="none" ';
|
||||||
|
|
||||||
if cbNorth in FFormattingStyles[i].Border then Result := Result + 'fo:border-top="0.002cm solid #000000" '
|
if cbNorth in FFormattingStyles[i].Border then begin
|
||||||
else Result := Result + 'fo:border-top="none" ';
|
Result := Result + Format('fo:border-top="%s %s %s" ', [
|
||||||
|
BORDER_LINEWIDTHS[FFormattingStyles[i].BorderStyles[cbNorth].LineStyle],
|
||||||
|
BORDER_LINESTYLES[FFormattingStyles[i].BorderStyles[cbNorth].LineStyle],
|
||||||
|
Workbook.GetPaletteColorAsHTMLStr(FFormattingStyles[i].BorderStyles[cbNorth].Color)
|
||||||
|
]);
|
||||||
|
if FFormattingStyles[i].BorderStyles[cbSouth].LineStyle = lsDouble then
|
||||||
|
Result := Result + 'style:border-linewidth-top="0.002cm 0.035cm 0.002cm" ';
|
||||||
|
end else
|
||||||
|
Result := Result + 'fo:border-top="none" ';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (uffBackgroundColor in FFormattingStyles[i].UsedFormattingFields) then
|
if (uffBackgroundColor in FFormattingStyles[i].UsedFormattingFields) then
|
||||||
begin
|
Result := Result + Format('fo:background-color="%s" ', [
|
||||||
Result := Result + 'fo:background-color="#'
|
Workbook.GetPaletteColorAsHTMLStr(FFormattingStyles[i].BackgroundColor)
|
||||||
+ Workbook.FPSColorToHexString(FFormattingStyles[i].BackgroundColor, FFormattingStyles[i].RGBBackgroundColor) +'" ';
|
]);
|
||||||
end;
|
// + Workbook.FPSColorToHexString(FFormattingStyles[i].BackgroundColor, FFormattingStyles[i].RGBBackgroundColor) +'" ';
|
||||||
|
|
||||||
if (uffWordWrap in FFormattingStyles[i].UsedFormattingFields) then
|
if (uffWordWrap in FFormattingStyles[i].UsedFormattingFields) then
|
||||||
begin
|
begin
|
||||||
@ -1309,8 +1355,18 @@ end;
|
|||||||
}
|
}
|
||||||
procedure TsSpreadOpenDocWriter.WriteBlank(AStream: TStream;
|
procedure TsSpreadOpenDocWriter.WriteBlank(AStream: TStream;
|
||||||
const ARow, ACol: Cardinal; ACell: PCell);
|
const ARow, ACol: Cardinal; ACell: PCell);
|
||||||
|
var
|
||||||
|
lStyle: String = '';
|
||||||
|
lIndex: Integer;
|
||||||
begin
|
begin
|
||||||
// no action at the moment...
|
// Write empty cell only if it has formatting
|
||||||
|
if ACell^.UsedFormattingFields <> [] then begin
|
||||||
|
lIndex := FindFormattingInList(ACell);
|
||||||
|
lStyle := ' table:style-name="ce' + IntToStr(lIndex) + '" ';
|
||||||
|
FContent := FContent +
|
||||||
|
' <table:table-cell ' + lStyle + '>' + LineEnding +
|
||||||
|
' </table:table-cell>' + LineEnding;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -554,6 +554,7 @@ type
|
|||||||
function FPSColorToHexString(AColor: TsColor; ARGBColor: TFPColor): String;
|
function FPSColorToHexString(AColor: TsColor; ARGBColor: TFPColor): String;
|
||||||
function GetColorName(AColorIndex: TsColor): string;
|
function GetColorName(AColorIndex: TsColor): string;
|
||||||
function GetPaletteColor(AColorIndex: TsColor): TsColorValue;
|
function GetPaletteColor(AColorIndex: TsColor): TsColorValue;
|
||||||
|
function GetPaletteColorAsHTMLStr(AColorIndex: TsColor): String;
|
||||||
procedure SetPaletteColor(AColorIndex: TsColor; AColorValue: TsColorValue);
|
procedure SetPaletteColor(AColorIndex: TsColor; AColorValue: TsColorValue);
|
||||||
function GetPaletteSize: Integer;
|
function GetPaletteSize: Integer;
|
||||||
procedure UseDefaultPalette;
|
procedure UseDefaultPalette;
|
||||||
@ -2921,6 +2922,15 @@ begin
|
|||||||
Result := $000000; // "black" as default
|
Result := $000000; // "black" as default
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{@@
|
||||||
|
Converts the palette color of the given index to a string that can be used
|
||||||
|
in HTML code. For ods.
|
||||||
|
}
|
||||||
|
function TsWorkbook.GetPaletteColorAsHTMLStr(AColorIndex: TsColor): String;
|
||||||
|
begin
|
||||||
|
Result := ColorToHTMLColorStr(GetPaletteColor(AColorIndex));
|
||||||
|
end;
|
||||||
|
|
||||||
{@@
|
{@@
|
||||||
Replaces a color value of the current palette by a new value. The color must
|
Replaces a color value of the current palette by a new value. The color must
|
||||||
be given as ABGR (little-endian), with A=0}
|
be given as ABGR (little-endian), with A=0}
|
||||||
|
@ -105,6 +105,9 @@ function FormatDateTime(const FormatStr: string; DateTime: TDateTime;
|
|||||||
function cmToPts(AValue: Double): Double;
|
function cmToPts(AValue: Double): Double;
|
||||||
function mmToPts(AValue: Double): Double;
|
function mmToPts(AValue: Double): Double;
|
||||||
|
|
||||||
|
function HTMLColorStrToColor(AValue: String): TsColorValue;
|
||||||
|
function ColorToHTMLColorStr(AValue: TsColorValue): String;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -1296,13 +1299,64 @@ end;
|
|||||||
{ Converts centimeters to points (72 pts = 1 inch) }
|
{ Converts centimeters to points (72 pts = 1 inch) }
|
||||||
function cmToPts(AValue: Double): Double;
|
function cmToPts(AValue: Double): Double;
|
||||||
begin
|
begin
|
||||||
Result := AValue/(2.54*72);
|
Result := AValue/2.54*72;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Converts millimeters to points (72 pts = 1 inch) }
|
{ Converts millimeters to points (72 pts = 1 inch) }
|
||||||
function mmToPts(AValue: Double): Double;
|
function mmToPts(AValue: Double): Double;
|
||||||
begin
|
begin
|
||||||
Result := AValue/(25.4*72);
|
Result := AValue/25.4*72;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ converts a HTML color string to a TsColorValue. For ods }
|
||||||
|
function HTMLColorStrToColor(AValue: String): TsColorValue;
|
||||||
|
begin
|
||||||
|
if AValue = '' then
|
||||||
|
Result := scNotDefined
|
||||||
|
else
|
||||||
|
if AValue[1] = '#' then begin
|
||||||
|
AValue[1] := '$';
|
||||||
|
Result := LongRGBToExcelPhysical(StrToInt(AValue));
|
||||||
|
end else begin
|
||||||
|
AValue := lowercase(AValue);
|
||||||
|
if AValue = 'red' then
|
||||||
|
Result := $0000FF
|
||||||
|
else if AValue = 'cyan' then
|
||||||
|
Result := $FFFF00
|
||||||
|
else if AValue = 'blue' then
|
||||||
|
Result := $FF0000
|
||||||
|
else if AValue = 'purple' then
|
||||||
|
Result := $800080
|
||||||
|
else if AValue = 'yellow' then
|
||||||
|
Result := $00FFFF
|
||||||
|
else if AValue = 'lime' then
|
||||||
|
Result := $00FF00
|
||||||
|
else if AValue = 'white' then
|
||||||
|
Result := $FFFFFF
|
||||||
|
else if AValue = 'black' then
|
||||||
|
Result := $000000
|
||||||
|
else if (AValue = 'gray') or (AValue = 'grey') then
|
||||||
|
Result := $808080
|
||||||
|
else if AValue = 'silver' then
|
||||||
|
Result := $C0C0C0
|
||||||
|
else if AValue = 'maroon' then
|
||||||
|
Result := $000080
|
||||||
|
else if AValue = 'green' then
|
||||||
|
Result := $008000
|
||||||
|
else if AValue = 'olive' then
|
||||||
|
Result := $008080;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ converts an rgb color value to a string as used in HTML code (for ods) }
|
||||||
|
function ColorToHTMLColorStr(AValue: TsColorValue): String;
|
||||||
|
type
|
||||||
|
TRGB = record r,g,b,a: Byte end;
|
||||||
|
var
|
||||||
|
rgb: TRGB;
|
||||||
|
begin
|
||||||
|
rgb := TRGB(AValue);
|
||||||
|
Result := Format('#%.2x%.2x%.2x', [rgb.r, rgb.g, rgb.b]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -70,38 +70,43 @@ type
|
|||||||
// If previous read tests are ok, this effectively tests writing.
|
// If previous read tests are ok, this effectively tests writing.
|
||||||
|
|
||||||
{ BIFF2 Tests }
|
{ BIFF2 Tests }
|
||||||
procedure TestWriteReadBIFF2_Alignment;
|
procedure TestWriteRead_BIFF2_Alignment;
|
||||||
procedure TestWriteReadBIFF2_Border;
|
procedure TestWriteRead_BIFF2_Border;
|
||||||
procedure TestWriteReadBIFF2_ColWidths;
|
procedure TestWriteRead_BIFF2_ColWidths;
|
||||||
procedure TestWriteReadBIFF2_RowHeights;
|
procedure TestWriteRead_BIFF2_RowHeights;
|
||||||
procedure TestWriteReadBIFF2_DateTimeFormats;
|
procedure TestWriteRead_BIFF2_DateTimeFormats;
|
||||||
procedure TestWriteReadBIFF2_NumberFormats;
|
procedure TestWriteRead_BIFF2_NumberFormats;
|
||||||
// These features are not supported by Excel2 --> no test cases required!
|
// These features are not supported by Excel2 --> no test cases required!
|
||||||
// - BorderStyle
|
// - BorderStyle
|
||||||
// - TextRotation
|
// - TextRotation
|
||||||
// - Wordwrap
|
// - Wordwrap
|
||||||
|
|
||||||
{ BIFF5 Tests }
|
{ BIFF5 Tests }
|
||||||
procedure TestWriteReadBIFF5_Alignment;
|
procedure TestWriteRead_BIFF5_Alignment;
|
||||||
procedure TestWriteReadBIFF5_Border;
|
procedure TestWriteRead_BIFF5_Border;
|
||||||
procedure TestWriteReadBIFF5_BorderStyles;
|
procedure TestWriteRead_BIFF5_BorderStyles;
|
||||||
procedure TestWriteReadBIFF5_ColWidths;
|
procedure TestWriteRead_BIFF5_ColWidths;
|
||||||
procedure TestWriteReadBIFF5_RowHeights;
|
procedure TestWriteRead_BIFF5_RowHeights;
|
||||||
procedure TestWriteReadBIFF5_DateTimeFormats;
|
procedure TestWriteRead_BIFF5_DateTimeFormats;
|
||||||
procedure TestWriteReadBIFF5_NumberFormats;
|
procedure TestWriteRead_BIFF5_NumberFormats;
|
||||||
procedure TestWriteReadBIFF5_TextRotation;
|
procedure TestWriteRead_BIFF5_TextRotation;
|
||||||
procedure TestWriteReadBIFF5_WordWrap;
|
procedure TestWriteRead_BIFF5_WordWrap;
|
||||||
|
|
||||||
{ BIFF8 Tests }
|
{ BIFF8 Tests }
|
||||||
procedure TestWriteReadBIFF8_Alignment;
|
procedure TestWriteRead_BIFF8_Alignment;
|
||||||
procedure TestWriteReadBIFF8_Border;
|
procedure TestWriteRead_BIFF8_Border;
|
||||||
procedure TestWriteReadBIFF8_BorderStyles;
|
procedure TestWriteRead_BIFF8_BorderStyles;
|
||||||
procedure TestWriteReadBIFF8_ColWidths;
|
procedure TestWriteRead_BIFF8_ColWidths;
|
||||||
procedure TestWriteReadBIFF8_RowHeights;
|
procedure TestWriteRead_BIFF8_RowHeights;
|
||||||
procedure TestWriteReadBIFF8_DateTimeFormats;
|
procedure TestWriteRead_BIFF8_DateTimeFormats;
|
||||||
procedure TestWriteReadBIFF8_NumberFormats;
|
procedure TestWriteRead_BIFF8_NumberFormats;
|
||||||
procedure TestWriteReadBIFF8_TextRotation;
|
procedure TestWriteRead_BIFF8_TextRotation;
|
||||||
procedure TestWriteReadBIFF8_WordWrap;
|
procedure TestWriteRead_BIFF8_WordWrap;
|
||||||
|
|
||||||
|
{ ODS Tests }
|
||||||
|
procedure TestWriteRead_ODS_Border;
|
||||||
|
procedure TestWriteRead_ODS_BorderStyles;
|
||||||
|
procedure TestWriteRead_ODS_WordWrap;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -251,6 +256,9 @@ begin
|
|||||||
inherited TearDown;
|
inherited TearDown;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ --- Number format tests --- }
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadNumberFormats(AFormat: TsSpreadsheetFormat);
|
procedure TSpreadWriteReadFormatTests.TestWriteReadNumberFormats(AFormat: TsSpreadsheetFormat);
|
||||||
var
|
var
|
||||||
MyWorksheet: TsWorksheet;
|
MyWorksheet: TsWorksheet;
|
||||||
@ -301,21 +309,24 @@ begin
|
|||||||
DeleteFile(TempFile);
|
DeleteFile(TempFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF2_NumberFormats;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF2_NumberFormats;
|
||||||
begin
|
begin
|
||||||
TestWriteReadNumberFormats(sfExcel2);
|
TestWriteReadNumberFormats(sfExcel2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF5_NumberFormats;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF5_NumberFormats;
|
||||||
begin
|
begin
|
||||||
TestWriteReadNumberFormats(sfExcel5);
|
TestWriteReadNumberFormats(sfExcel5);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF8_NumberFormats;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF8_NumberFormats;
|
||||||
begin
|
begin
|
||||||
TestWriteReadNumberFormats(sfExcel8);
|
TestWriteReadNumberFormats(sfExcel8);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ --- Date/time formats --- }
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadDateTimeFormats(AFormat: TsSpreadsheetFormat);
|
procedure TSpreadWriteReadFormatTests.TestWriteReadDateTimeFormats(AFormat: TsSpreadsheetFormat);
|
||||||
var
|
var
|
||||||
MyWorksheet: TsWorksheet;
|
MyWorksheet: TsWorksheet;
|
||||||
@ -370,21 +381,24 @@ begin
|
|||||||
DeleteFile(TempFile);
|
DeleteFile(TempFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF2_DateTimeFormats;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF2_DateTimeFormats;
|
||||||
begin
|
begin
|
||||||
TestWriteReadDateTimeFormats(sfExcel2);
|
TestWriteReadDateTimeFormats(sfExcel2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF5_DateTimeFormats;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF5_DateTimeFormats;
|
||||||
begin
|
begin
|
||||||
TestWriteReadDateTimeFormats(sfExcel5);
|
TestWriteReadDateTimeFormats(sfExcel5);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF8_DateTimeFormats;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF8_DateTimeFormats;
|
||||||
begin
|
begin
|
||||||
TestWriteReadDateTimeFormats(sfExcel8);
|
TestWriteReadDateTimeFormats(sfExcel8);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ --- Alignment tests --- }
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadAlignment(AFormat: TsSpreadsheetFormat);
|
procedure TSpreadWriteReadFormatTests.TestWriteReadAlignment(AFormat: TsSpreadsheetFormat);
|
||||||
const
|
const
|
||||||
CELLTEXT = 'This is a text.';
|
CELLTEXT = 'This is a text.';
|
||||||
@ -425,9 +439,9 @@ begin
|
|||||||
MyCell := MyWorksheet.FindCell(row, col);
|
MyCell := MyWorksheet.FindCell(row, col);
|
||||||
if MyCell = nil then
|
if MyCell = nil then
|
||||||
fail('Error in test code. Failed to get cell.');
|
fail('Error in test code. Failed to get cell.');
|
||||||
CheckEquals(vertAlign = MyCell^.VertAlignment, true,
|
CheckEquals(true, vertAlign = MyCell^.VertAlignment,
|
||||||
'Test unsaved vertical alignment, cell ' + CellNotation(MyWorksheet,0,0));
|
'Test unsaved vertical alignment, cell ' + CellNotation(MyWorksheet,0,0));
|
||||||
CheckEquals(horAlign = MyCell^.HorAlignment, true,
|
CheckEquals(true, horAlign = MyCell^.HorAlignment,
|
||||||
'Test unsaved horizontal alignment, cell ' + CellNotation(MyWorksheet,0,0));
|
'Test unsaved horizontal alignment, cell ' + CellNotation(MyWorksheet,0,0));
|
||||||
inc(col);
|
inc(col);
|
||||||
end;
|
end;
|
||||||
@ -460,10 +474,10 @@ begin
|
|||||||
fail('Error in test code. Failed to get cell.');
|
fail('Error in test code. Failed to get cell.');
|
||||||
vertAlign := TsVertAlignment(col);
|
vertAlign := TsVertAlignment(col);
|
||||||
if vertAlign = vaDefault then vertAlign := vaBottom;
|
if vertAlign = vaDefault then vertAlign := vaBottom;
|
||||||
CheckEquals(vertAlign = MyCell^.VertAlignment, true,
|
CheckEquals(true, vertAlign = MyCell^.VertAlignment,
|
||||||
'Test saved vertical alignment mismatch, cell '+CellNotation(MyWorksheet,Row,Col));
|
'Test saved vertical alignment mismatch, cell '+CellNotation(MyWorksheet,Row,Col));
|
||||||
horAlign := TsHorAlignment(row);
|
horAlign := TsHorAlignment(row);
|
||||||
CheckEquals(horAlign = MyCell^.HorAlignment, true,
|
CheckEquals(true, horAlign = MyCell^.HorAlignment,
|
||||||
'Test saved horizontal alignment mismatch, cell '+CellNotation(MyWorksheet,Row,Col));
|
'Test saved horizontal alignment mismatch, cell '+CellNotation(MyWorksheet,Row,Col));
|
||||||
end;
|
end;
|
||||||
MyWorkbook.Free;
|
MyWorkbook.Free;
|
||||||
@ -471,21 +485,24 @@ begin
|
|||||||
DeleteFile(TempFile);
|
DeleteFile(TempFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF2_Alignment;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF2_Alignment;
|
||||||
begin
|
begin
|
||||||
TestWriteReadAlignment(sfExcel2);
|
TestWriteReadAlignment(sfExcel2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF5_Alignment;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF5_Alignment;
|
||||||
begin
|
begin
|
||||||
TestWriteReadAlignment(sfExcel5);
|
TestWriteReadAlignment(sfExcel5);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF8_Alignment;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF8_Alignment;
|
||||||
begin
|
begin
|
||||||
TestWriteReadAlignment(sfExcel8);
|
TestWriteReadAlignment(sfExcel8);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ --- Border on/off tests --- }
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBorder(AFormat: TsSpreadsheetFormat);
|
procedure TSpreadWriteReadFormatTests.TestWriteReadBorder(AFormat: TsSpreadsheetFormat);
|
||||||
const
|
const
|
||||||
row = 0;
|
row = 0;
|
||||||
@ -531,7 +548,7 @@ begin
|
|||||||
fail('Error in test code. Failed to get cell');
|
fail('Error in test code. Failed to get cell');
|
||||||
current := GetEnumName(TypeInfo(TsCellBorders), byte(MyCell^.Border));
|
current := GetEnumName(TypeInfo(TsCellBorders), byte(MyCell^.Border));
|
||||||
expected := GetEnumName(TypeInfo(TsCellBorders), byte(SollBorders[col]));
|
expected := GetEnumName(TypeInfo(TsCellBorders), byte(SollBorders[col]));
|
||||||
CheckEquals(current, expected,
|
CheckEquals(expected, current,
|
||||||
'Test saved border mismatch, cell ' + CellNotation(MyWorksheet, row, col));
|
'Test saved border mismatch, cell ' + CellNotation(MyWorksheet, row, col));
|
||||||
end;
|
end;
|
||||||
// Finalization
|
// Finalization
|
||||||
@ -540,21 +557,29 @@ begin
|
|||||||
DeleteFile(TempFile);
|
DeleteFile(TempFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF2_Border;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF2_Border;
|
||||||
begin
|
begin
|
||||||
TestWriteReadBorder(sfExcel2);
|
TestWriteReadBorder(sfExcel2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF5_Border;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF5_Border;
|
||||||
begin
|
begin
|
||||||
TestWriteReadBorder(sfExcel5);
|
TestWriteReadBorder(sfExcel5);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF8_Border;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF8_Border;
|
||||||
begin
|
begin
|
||||||
TestWriteReadBorder(sfExcel8);
|
TestWriteReadBorder(sfExcel8);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_ODS_Border;
|
||||||
|
begin
|
||||||
|
TestWriteReadBorder(sfOpenDocument);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ --- BorderStyle tests --- }
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBorderStyles(AFormat: TsSpreadsheetFormat);
|
procedure TSpreadWriteReadFormatTests.TestWriteReadBorderStyles(AFormat: TsSpreadsheetFormat);
|
||||||
{ This test paints 10x10 cells with all borders, each separated by an empty
|
{ This test paints 10x10 cells with all borders, each separated by an empty
|
||||||
column and an empty row. The border style varies from border to border
|
column and an empty row. The border style varies from border to border
|
||||||
@ -623,11 +648,11 @@ begin
|
|||||||
for b in TsCellBorder do begin
|
for b in TsCellBorder do begin
|
||||||
current := ord(MyCell^.BorderStyles[b].LineStyle);
|
current := ord(MyCell^.BorderStyles[b].LineStyle);
|
||||||
expected := ord(SollBorderLineStyles[ls]);
|
expected := ord(SollBorderLineStyles[ls]);
|
||||||
CheckEquals(current, expected,
|
CheckEquals(expected, current,
|
||||||
'Test saved border line style mismatch, cell ' + CellNotation(MyWorksheet, row*2, col*2));
|
'Test saved border line style mismatch, cell ' + CellNotation(MyWorksheet, row*2, col*2));
|
||||||
current := MyCell^.BorderStyles[b].Color;
|
current := MyCell^.BorderStyles[b].Color;
|
||||||
expected := SollBorderColors[c];
|
expected := SollBorderColors[c];
|
||||||
CheckEquals(current, expected,
|
CheckEquals(expected, current,
|
||||||
'Test saved border color mismatch, cell ' + CellNotation(MyWorksheet, row*2, col*2));
|
'Test saved border color mismatch, cell ' + CellNotation(MyWorksheet, row*2, col*2));
|
||||||
inc(ls);
|
inc(ls);
|
||||||
if ls > High(SollBorderLineStyles) then begin
|
if ls > High(SollBorderLineStyles) then begin
|
||||||
@ -646,16 +671,24 @@ begin
|
|||||||
DeleteFile(TempFile);
|
DeleteFile(TempFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF5_BorderStyles;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF5_BorderStyles;
|
||||||
begin
|
begin
|
||||||
TestWriteReadBorderStyles(sfExcel5);
|
TestWriteReadBorderStyles(sfExcel5);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF8_BorderStyles;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF8_BorderStyles;
|
||||||
begin
|
begin
|
||||||
TestWriteReadBorderStyles(sfExcel8);
|
TestWriteReadBorderStyles(sfExcel8);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_ODS_BorderStyles;
|
||||||
|
begin
|
||||||
|
TestWriteReadBorderStyles(sfOpenDocument);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ --- Column widths tests --- }
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadColWidths(AFormat: TsSpreadsheetFormat);
|
procedure TSpreadWriteReadFormatTests.TestWriteReadColWidths(AFormat: TsSpreadsheetFormat);
|
||||||
var
|
var
|
||||||
MyWorksheet: TsWorksheet;
|
MyWorksheet: TsWorksheet;
|
||||||
@ -704,21 +737,24 @@ begin
|
|||||||
DeleteFile(TempFile);
|
DeleteFile(TempFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF2_ColWidths;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF2_ColWidths;
|
||||||
begin
|
begin
|
||||||
TestWriteReadColWidths(sfExcel2);
|
TestWriteReadColWidths(sfExcel2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF5_ColWidths;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF5_ColWidths;
|
||||||
begin
|
begin
|
||||||
TestWriteReadColWidths(sfExcel5);
|
TestWriteReadColWidths(sfExcel5);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF8_ColWidths;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF8_ColWidths;
|
||||||
begin
|
begin
|
||||||
TestWriteReadColWidths(sfExcel8);
|
TestWriteReadColWidths(sfExcel8);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ --- Row height tests --- }
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadRowHeights(AFormat: TsSpreadsheetFormat);
|
procedure TSpreadWriteReadFormatTests.TestWriteReadRowHeights(AFormat: TsSpreadsheetFormat);
|
||||||
var
|
var
|
||||||
MyWorksheet: TsWorksheet;
|
MyWorksheet: TsWorksheet;
|
||||||
@ -766,21 +802,24 @@ begin
|
|||||||
DeleteFile(TempFile);
|
DeleteFile(TempFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF2_RowHeights;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF2_RowHeights;
|
||||||
begin
|
begin
|
||||||
TestWriteReadRowHeights(sfExcel2);
|
TestWriteReadRowHeights(sfExcel2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF5_RowHeights;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF5_RowHeights;
|
||||||
begin
|
begin
|
||||||
TestWriteReadRowHeights(sfExcel5);
|
TestWriteReadRowHeights(sfExcel5);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF8_RowHeights;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF8_RowHeights;
|
||||||
begin
|
begin
|
||||||
TestWriteReadRowHeights(sfExcel8);
|
TestWriteReadRowHeights(sfExcel8);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ --- Text rotation tests --- }
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadTextRotation(AFormat: TsSpreadsheetFormat);
|
procedure TSpreadWriteReadFormatTests.TestWriteReadTextRotation(AFormat: TsSpreadsheetFormat);
|
||||||
const
|
const
|
||||||
col = 0;
|
col = 0;
|
||||||
@ -834,16 +873,19 @@ begin
|
|||||||
DeleteFile(TempFile);
|
DeleteFile(TempFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF5_TextRotation;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF5_TextRotation;
|
||||||
begin
|
begin
|
||||||
TestWriteReadTextRotation(sfExcel5);
|
TestWriteReadTextRotation(sfExcel5);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF8_TextRotation;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF8_TextRotation;
|
||||||
begin
|
begin
|
||||||
TestWriteReadTextRotation(sfExcel8);
|
TestWriteReadTextRotation(sfExcel8);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ --- Wordwrap tests --- }
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadWordWrap(AFormat: TsSpreadsheetFormat);
|
procedure TSpreadWriteReadFormatTests.TestWriteReadWordWrap(AFormat: TsSpreadsheetFormat);
|
||||||
const
|
const
|
||||||
LONGTEXT = 'This is a very, very, very, very long text.';
|
LONGTEXT = 'This is a very, very, very, very long text.';
|
||||||
@ -867,13 +909,13 @@ begin
|
|||||||
MyCell := MyWorksheet.FindCell(0, 0);
|
MyCell := MyWorksheet.FindCell(0, 0);
|
||||||
if MyCell = nil then
|
if MyCell = nil then
|
||||||
fail('Error in test code. Failed to get word-wrapped cell.');
|
fail('Error in test code. Failed to get word-wrapped cell.');
|
||||||
CheckEquals((uffWordWrap in MyCell^.UsedFormattingFields), true, 'Test unsaved word wrap mismatch cell ' + CellNotation(MyWorksheet,0,0));
|
CheckEquals(true, (uffWordWrap in MyCell^.UsedFormattingFields), 'Test unsaved word wrap mismatch cell ' + CellNotation(MyWorksheet,0,0));
|
||||||
MyWorksheet.WriteUTF8Text(1, 0, LONGTEXT);
|
MyWorksheet.WriteUTF8Text(1, 0, LONGTEXT);
|
||||||
MyWorksheet.WriteUsedFormatting(1, 0, []);
|
MyWorksheet.WriteUsedFormatting(1, 0, []);
|
||||||
MyCell := MyWorksheet.FindCell(1, 0);
|
MyCell := MyWorksheet.FindCell(1, 0);
|
||||||
if MyCell = nil then
|
if MyCell = nil then
|
||||||
fail('Error in test code. Failed to get word-wrapped cell.');
|
fail('Error in test code. Failed to get word-wrapped cell.');
|
||||||
CheckEquals((uffWordWrap in MyCell^.UsedFormattingFields), false, 'Test unsaved non-wrapped cell mismatch, cell ' + CellNotation(MyWorksheet,0,0));
|
CheckEquals(false, (uffWordWrap in MyCell^.UsedFormattingFields), 'Test unsaved non-wrapped cell mismatch, cell ' + CellNotation(MyWorksheet,0,0));
|
||||||
MyWorkBook.WriteToFile(TempFile, AFormat, true);
|
MyWorkBook.WriteToFile(TempFile, AFormat, true);
|
||||||
MyWorkbook.Free;
|
MyWorkbook.Free;
|
||||||
|
|
||||||
@ -889,26 +931,32 @@ begin
|
|||||||
MyCell := MyWorksheet.FindCell(0, 0);
|
MyCell := MyWorksheet.FindCell(0, 0);
|
||||||
if MyCell = nil then
|
if MyCell = nil then
|
||||||
fail('Error in test code. Failed to get word-wrapped cell.');
|
fail('Error in test code. Failed to get word-wrapped cell.');
|
||||||
CheckEquals((uffWordWrap in MyCell^.UsedFormattingFields), true, 'failed to return correct word-wrap flag, cell ' + CellNotation(MyWorksheet,0,0));
|
CheckEquals(true, (uffWordWrap in MyCell^.UsedFormattingFields), 'failed to return correct word-wrap flag, cell ' + CellNotation(MyWorksheet,0,0));
|
||||||
MyCell := MyWorksheet.FindCell(1, 0);
|
MyCell := MyWorksheet.FindCell(1, 0);
|
||||||
if MyCell = nil then
|
if MyCell = nil then
|
||||||
fail('Error in test code. Failed to get non-wrapped cell.');
|
fail('Error in test code. Failed to get non-wrapped cell.');
|
||||||
CheckEquals((uffWordWrap in MyCell^.UsedFormattingFields), false, 'failed to return correct word-wrap flag, cell ' + CellNotation(MyWorksheet,0,0));
|
CheckEquals(false, (uffWordWrap in MyCell^.UsedFormattingFields), 'failed to return correct word-wrap flag, cell ' + CellNotation(MyWorksheet,0,0));
|
||||||
MyWorkbook.Free;
|
MyWorkbook.Free;
|
||||||
|
|
||||||
DeleteFile(TempFile);
|
DeleteFile(TempFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF5_Wordwrap;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF5_Wordwrap;
|
||||||
begin
|
begin
|
||||||
TestWriteReadWordwrap(sfExcel5);
|
TestWriteReadWordwrap(sfExcel5);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpreadWriteReadFormatTests.TestWriteReadBIFF8_Wordwrap;
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_BIFF8_Wordwrap;
|
||||||
begin
|
begin
|
||||||
TestWriteReadWordwrap(sfExcel8);
|
TestWriteReadWordwrap(sfExcel8);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSpreadWriteReadFormatTests.TestWriteRead_ODS_Wordwrap;
|
||||||
|
begin
|
||||||
|
TestWriteReadWordwrap(sfOpenDocument);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
RegisterTest(TSpreadWriteReadFormatTests);
|
RegisterTest(TSpreadWriteReadFormatTests);
|
||||||
InitSollFmtData;
|
InitSollFmtData;
|
||||||
|
Reference in New Issue
Block a user