Update go test.

formula
Ri Xu 9 years ago
parent 1a2570b873
commit 6185cd577d

@ -34,7 +34,7 @@ func TestExcelize(t *testing.T) {
// Test completion column. // Test completion column.
f1.SetCellValue("Sheet2", "M2", nil) f1.SetCellValue("Sheet2", "M2", nil)
// Test read cell value with given axis large than exists row. // Test read cell value with given axis large than exists row.
f1.GetCellValue("Sheet2", "E13") f1.GetCellValue("Sheet2", "E231")
for i := 1; i <= 300; i++ { for i := 1; i <= 300; i++ {
f1.SetCellStr("SHEET3", "c"+strconv.Itoa(i), strconv.Itoa(i)) f1.SetCellStr("SHEET3", "c"+strconv.Itoa(i), strconv.Itoa(i))
@ -78,6 +78,13 @@ func TestExcelize(t *testing.T) {
t.Log(err) t.Log(err)
} }
// Test set active sheet without BookViews and Sheets maps in xl/workbook.xml.
f4, err := OpenFile("./test/badWorkbook.xlsx")
f4.SetActiveSheet(2)
if err != nil {
t.Log(err)
}
// Test open a XLSX file with given illegal path. // Test open a XLSX file with given illegal path.
_, err = OpenFile("./test/Workbook.xlsx") _, err = OpenFile("./test/Workbook.xlsx")
if err != nil { if err != nil {

@ -42,7 +42,7 @@ func (f *File) setContentTypes(index int) {
// Update sheet property by given index. // Update sheet property by given index.
func (f *File) setSheet(index int) { func (f *File) setSheet(index int) {
var xlsx xlsxWorksheet var xlsx xlsxWorksheet
xlsx.Dimension.Ref = "A1" xlsx.Dimension.Ref = `A1`
xlsx.SheetViews.SheetView = append(xlsx.SheetViews.SheetView, xlsxSheetView{ xlsx.SheetViews.SheetView = append(xlsx.SheetViews.SheetView, xlsxSheetView{
WorkbookViewID: 0, WorkbookViewID: 0,
}) })
@ -85,7 +85,7 @@ func (f *File) addXlsxWorkbookRels(sheet int) {
content := f.readXlsxWorkbookRels() content := f.readXlsxWorkbookRels()
rID := len(content.Relationships) + 1 rID := len(content.Relationships) + 1
ID := bytes.Buffer{} ID := bytes.Buffer{}
ID.WriteString("rId") ID.WriteString(`rId`)
ID.WriteString(strconv.Itoa(rID)) ID.WriteString(strconv.Itoa(rID))
target := bytes.Buffer{} target := bytes.Buffer{}
target.WriteString(`worksheets/sheet`) target.WriteString(`worksheets/sheet`)

Binary file not shown.
Loading…
Cancel
Save