From 14c6a198ce27b44fcce5447a2b757ce403ebb8fc Mon Sep 17 00:00:00 2001 From: xuri Date: Mon, 24 Oct 2022 00:02:22 +0800 Subject: Support get cell value which contains a date in the ISO 8601 format - Support set and get font color with indexed color - New export variable `IndexedColorMapping` - Fix getting incorrect page margin settings when the margin is 0 - Update unit tests and comments typo fixes - ref #65, new formula functions: AGGREGATE and SUBTOTAL --- cell_test.go | 90 +++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 40 deletions(-) (limited to 'cell_test.go') diff --git a/cell_test.go b/cell_test.go index 511078e..980058a 100644 --- a/cell_test.go +++ b/cell_test.go @@ -298,42 +298,46 @@ func TestGetCellValue(t *testing.T) { assert.NoError(t, err) f.Sheet.Delete("xl/worksheets/sheet1.xml") - f.Pkg.Store("xl/worksheets/sheet1.xml", []byte(fmt.Sprintf(sheetData, ` - 2422.3000000000002 - 2422.3000000000002 - 12.4 - 964 - 1101.5999999999999 - 275.39999999999998 - 68.900000000000006 - 44385.208333333336 - 5.0999999999999996 - 5.1100000000000003 - 5.0999999999999996 - 5.1109999999999998 - 5.1111000000000004 - 2422.012345678 - 2422.0123456789 - 12.012345678901 - 964 - 1101.5999999999999 - 275.39999999999998 - 68.900000000000006 - 8.8880000000000001E-2 - 4.0000000000000003e-5 - 2422.3000000000002 - 1101.5999999999999 - 275.39999999999998 - 68.900000000000006 - 1.1000000000000001 - 1234567890123_4 - 123456789_0123_4 - +0.0000000000000000002399999999999992E-4 - 7.2399999999999992E-2 -`))) + f.Pkg.Store("xl/worksheets/sheet1.xml", []byte(fmt.Sprintf(sheetData, ` + 2422.3000000000002 + 2422.3000000000002 + 12.4 + 964 + 1101.5999999999999 + 275.39999999999998 + 68.900000000000006 + 44385.208333333336 + 5.0999999999999996 + 5.1100000000000003 + 5.0999999999999996 + 5.1109999999999998 + 5.1111000000000004 + 2422.012345678 + 2422.0123456789 + 12.012345678901 + 964 + 1101.5999999999999 + 275.39999999999998 + 68.900000000000006 + 8.8880000000000001E-2 + 4.0000000000000003e-5 + 2422.3000000000002 + 1101.5999999999999 + 275.39999999999998 + 68.900000000000006 + 1.1000000000000001 + 1234567890123_4 + 123456789_0123_4 + +0.0000000000000000002399999999999992E-4 + 7.2399999999999992E-2 + 20200208T080910.123 + 20200208T080910,123 + 20221022T150529Z + 2022-10-22T15:05:29Z + 2020-07-10 15:00:00.000`))) f.checked = nil - rows, err = f.GetRows("Sheet1") - assert.Equal(t, [][]string{{ + rows, err = f.GetCols("Sheet1") + assert.Equal(t, []string{ "2422.3", "2422.3", "12.4", @@ -365,7 +369,12 @@ func TestGetCellValue(t *testing.T) { "123456789_0123_4", "2.39999999999999E-23", "0.0724", - }}, rows) + "43869.3397004977", + "43869.3397004977", + "44856.6288078704", + "44856.6288078704", + "2020-07-10 15:00:00.000", + }, rows[0]) assert.NoError(t, err) } @@ -596,9 +605,10 @@ func TestSetCellRichText(t *testing.T) { { Text: "bold", Font: &Font{ - Bold: true, - Color: "2354e8", - Family: "Times New Roman", + Bold: true, + Color: "2354e8", + ColorIndexed: 0, + Family: "Times New Roman", }, }, { @@ -742,7 +752,7 @@ func TestSharedStringsError(t *testing.T) { assert.Equal(t, "1", f.getFromStringItem(1)) // Cleanup undelete temporary files assert.NoError(t, os.Remove(tempFile.(string))) - // Test reload the file error on set cell cell and rich text. The error message was different between macOS and Windows. + // Test reload the file error on set cell value and rich text. The error message was different between macOS and Windows. err = f.SetCellValue("Sheet1", "A19", "A19") assert.Error(t, err) -- cgit v1.2.1