|
|
|
@ -293,7 +293,7 @@ func TestSetColStyle(t *testing.T) {
|
|
|
|
|
assert.NoError(t, err)
|
|
|
|
|
// Test set column style on not exists worksheet.
|
|
|
|
|
assert.EqualError(t, f.SetColStyle("SheetN", "E", styleID), "sheet SheetN does not exist")
|
|
|
|
|
// Test set column style with illegal cell coordinates.
|
|
|
|
|
// Test set column style with illegal column name.
|
|
|
|
|
assert.EqualError(t, f.SetColStyle("Sheet1", "*", styleID), newInvalidColumnNameError("*").Error())
|
|
|
|
|
assert.EqualError(t, f.SetColStyle("Sheet1", "A:*", styleID), newInvalidColumnNameError("*").Error())
|
|
|
|
|
// Test set column style with invalid style ID.
|
|
|
|
@ -302,6 +302,10 @@ func TestSetColStyle(t *testing.T) {
|
|
|
|
|
assert.EqualError(t, f.SetColStyle("Sheet1", "B", 10), newInvalidStyleID(10).Error())
|
|
|
|
|
|
|
|
|
|
assert.NoError(t, f.SetColStyle("Sheet1", "B", styleID))
|
|
|
|
|
style, err := f.GetColStyle("Sheet1", "B")
|
|
|
|
|
assert.NoError(t, err)
|
|
|
|
|
assert.Equal(t, styleID, style)
|
|
|
|
|
|
|
|
|
|
// Test set column style with already exists column with style.
|
|
|
|
|
assert.NoError(t, f.SetColStyle("Sheet1", "B", styleID))
|
|
|
|
|
assert.NoError(t, f.SetColStyle("Sheet1", "D:C", styleID))
|
|
|
|
@ -343,6 +347,20 @@ func TestColWidth(t *testing.T) {
|
|
|
|
|
convertRowHeightToPixels(0)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestGetColStyle(t *testing.T) {
|
|
|
|
|
f := NewFile()
|
|
|
|
|
styleID, err := f.GetColStyle("Sheet1", "A")
|
|
|
|
|
assert.NoError(t, err)
|
|
|
|
|
assert.Equal(t, styleID, 0)
|
|
|
|
|
|
|
|
|
|
// Test set column style on not exists worksheet.
|
|
|
|
|
_, err = f.GetColStyle("SheetN", "A")
|
|
|
|
|
assert.EqualError(t, err, "sheet SheetN does not exist")
|
|
|
|
|
// Test set column style with illegal column name.
|
|
|
|
|
_, err = f.GetColStyle("Sheet1", "*")
|
|
|
|
|
assert.EqualError(t, err, newInvalidColumnNameError("*").Error())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestInsertCols(t *testing.T) {
|
|
|
|
|
f := NewFile()
|
|
|
|
|
sheet1 := f.GetSheetName(0)
|
|
|
|
|