From 3ece904b0082f4d63afe0d795b61c860d0790c83 Mon Sep 17 00:00:00 2001 From: GaoFei Date: Sat, 15 Oct 2022 00:03:49 +0800 Subject: This closes #1369, support set, and get font color with theme and tint (#1370) --- cell_test.go | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'cell_test.go') diff --git a/cell_test.go b/cell_test.go index 7598058..511078e 100644 --- a/cell_test.go +++ b/cell_test.go @@ -518,7 +518,7 @@ func TestSetCellFormula(t *testing.T) { } func TestGetCellRichText(t *testing.T) { - f := NewFile() + f, theme := NewFile(), 1 runsSource := []RichTextRun{ { @@ -527,13 +527,15 @@ func TestGetCellRichText(t *testing.T) { { Text: "b", Font: &Font{ - Underline: "single", - Color: "ff0000", - Bold: true, - Italic: true, - Family: "Times New Roman", - Size: 100, - Strike: true, + Underline: "single", + Color: "ff0000", + ColorTheme: &theme, + ColorTint: 0.5, + Bold: true, + Italic: true, + Family: "Times New Roman", + Size: 100, + Strike: true, }, }, } @@ -580,6 +582,10 @@ func TestGetCellRichText(t *testing.T) { // Test set cell rich text with illegal cell reference _, err = f.GetCellRichText("Sheet1", "A") assert.EqualError(t, err, newCellNameToCoordinatesError("A", newInvalidCellNameError("A")).Error()) + // Test set rich text color theme without tint + assert.NoError(t, f.SetCellRichText("Sheet1", "A1", []RichTextRun{{Font: &Font{ColorTheme: &theme}}})) + // Test set rich text color tint without theme + assert.NoError(t, f.SetCellRichText("Sheet1", "A1", []RichTextRun{{Font: &Font{ColorTint: 0.5}}})) } func TestSetCellRichText(t *testing.T) { -- cgit v1.2.1