diff options
author | Thomas Charbonnel <thomascharbonnel@users.noreply.github.com> | 2022-07-26 12:36:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-26 12:36:21 +0800 |
commit | fd0eb2bcbf31eccfc2b853dc406e0cfd247f7fb2 (patch) | |
tree | c49eb078121b9a8bf62eca715c0df12ea0d80544 /sheetpr_test.go | |
parent | ebea684ae5c60776d4d8364b7360d0c0603cb3b0 (diff) |
This closes #1283, support set and get color index, theme and tint for sheet tab
This commit renames `TabColor` into `TabColorRGB` (but keeps an alias for backwards compatibility), as well as adds support for more tab color options (Theme, Indexed and Tint).
Signed-off-by: Thomas Charbonnel <github@charbonnel.email>
Diffstat (limited to 'sheetpr_test.go')
-rw-r--r-- | sheetpr_test.go | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/sheetpr_test.go b/sheetpr_test.go index 91685d8..000b33a 100644 --- a/sheetpr_test.go +++ b/sheetpr_test.go @@ -13,7 +13,10 @@ var _ = []SheetPrOption{ EnableFormatConditionsCalculation(false), Published(false), FitToPage(true), - TabColor("#FFFF00"), + TabColorIndexed(42), + TabColorRGB("#FFFF00"), + TabColorTheme(TabColorThemeLight2), + TabColorTint(0.5), AutoPageBreaks(true), OutlineSummaryBelow(true), } @@ -23,7 +26,10 @@ var _ = []SheetPrOptionPtr{ (*EnableFormatConditionsCalculation)(nil), (*Published)(nil), (*FitToPage)(nil), - (*TabColor)(nil), + (*TabColorIndexed)(nil), + (*TabColorRGB)(nil), + (*TabColorTheme)(nil), + (*TabColorTint)(nil), (*AutoPageBreaks)(nil), (*OutlineSummaryBelow)(nil), } @@ -37,7 +43,10 @@ func ExampleFile_SetSheetPrOptions() { EnableFormatConditionsCalculation(false), Published(false), FitToPage(true), - TabColor("#FFFF00"), + TabColorIndexed(42), + TabColorRGB("#FFFF00"), + TabColorTheme(TabColorThemeLight2), + TabColorTint(0.5), AutoPageBreaks(true), OutlineSummaryBelow(false), ); err != nil { @@ -55,7 +64,10 @@ func ExampleFile_GetSheetPrOptions() { enableFormatConditionsCalculation EnableFormatConditionsCalculation published Published fitToPage FitToPage - tabColor TabColor + tabColorIndexed TabColorIndexed + tabColorRGB TabColorRGB + tabColorTheme TabColorTheme + tabColorTint TabColorTint autoPageBreaks AutoPageBreaks outlineSummaryBelow OutlineSummaryBelow ) @@ -65,7 +77,10 @@ func ExampleFile_GetSheetPrOptions() { &enableFormatConditionsCalculation, &published, &fitToPage, - &tabColor, + &tabColorIndexed, + &tabColorRGB, + &tabColorTheme, + &tabColorTint, &autoPageBreaks, &outlineSummaryBelow, ); err != nil { @@ -76,7 +91,10 @@ func ExampleFile_GetSheetPrOptions() { fmt.Println("- enableFormatConditionsCalculation:", enableFormatConditionsCalculation) fmt.Println("- published:", published) fmt.Println("- fitToPage:", fitToPage) - fmt.Printf("- tabColor: %q\n", tabColor) + fmt.Printf("- tabColorIndexed: %d\n", tabColorIndexed) + fmt.Printf("- tabColorRGB: %q\n", tabColorRGB) + fmt.Printf("- tabColorTheme: %d\n", tabColorTheme) + fmt.Printf("- tabColorTint: %f\n", tabColorTint) fmt.Println("- autoPageBreaks:", autoPageBreaks) fmt.Println("- outlineSummaryBelow:", outlineSummaryBelow) // Output: @@ -85,7 +103,10 @@ func ExampleFile_GetSheetPrOptions() { // - enableFormatConditionsCalculation: true // - published: true // - fitToPage: false - // - tabColor: "" + // - tabColorIndexed: -1 + // - tabColorRGB: "" + // - tabColorTheme: -1 + // - tabColorTint: 0.000000 // - autoPageBreaks: false // - outlineSummaryBelow: true } @@ -101,7 +122,10 @@ func TestSheetPrOptions(t *testing.T) { {new(EnableFormatConditionsCalculation), EnableFormatConditionsCalculation(false)}, {new(Published), Published(false)}, {new(FitToPage), FitToPage(true)}, - {new(TabColor), TabColor("FFFF00")}, + {new(TabColorIndexed), TabColorIndexed(42)}, + {new(TabColorRGB), TabColorRGB("FFFF00")}, + {new(TabColorTheme), TabColorTheme(TabColorThemeLight2)}, + {new(TabColorTint), TabColorTint(0.5)}, {new(AutoPageBreaks), AutoPageBreaks(true)}, {new(OutlineSummaryBelow), OutlineSummaryBelow(false)}, } @@ -154,7 +178,7 @@ func TestSheetPrOptions(t *testing.T) { func TestSetSheetPrOptions(t *testing.T) { f := NewFile() - assert.NoError(t, f.SetSheetPrOptions("Sheet1", TabColor(""))) + assert.NoError(t, f.SetSheetPrOptions("Sheet1", TabColorRGB(""))) // Test SetSheetPrOptions on not exists worksheet. assert.EqualError(t, f.SetSheetPrOptions("SheetN"), "sheet SheetN is not exist") } |