Просмотр исходного кода

Convert TestGetStyleWithBorders

Geoffrey J. Teale 11 лет назад
Родитель
Сommit
86a151ab9e
1 измененных файлов с 28 добавлено и 40 удалено
  1. 28 40
      lib_test.go

+ 28 - 40
lib_test.go

@@ -99,46 +99,34 @@ func (l *LibSuite) TestGetStyleWithFills(c *C) {
 	c.Assert(fill.FgColor, Equals, "FF000000")
 }
 
-// // Test that GetStyle correctly converts the xlsxStyle.Borders.
-// func (l *LibSuite) TestGetStyleWithBorders(c *C) {
-// 	var cell *Cell
-// 	var style *Style
-// 	var xStyles *xlsxStyles
-// 	var borders []xlsxBorder
-// 	var cellXfs []xlsxXf
-
-// 	borders = make([]xlsxBorder, 1)
-// 	borders[0] = xlsxBorder{
-// 		Left:   xlsxLine{Style: "thin"},
-// 		Right:  xlsxLine{Style: "thin"},
-// 		Top:    xlsxLine{Style: "thin"},
-// 		Bottom: xlsxLine{Style: "thin"}}
-
-// 	cellXfs = make([]xlsxXf, 1)
-// 	cellXfs[0] = xlsxXf{ApplyBorder: true, BorderId: 0}
-
-// 	xStyles = &xlsxStyles{Borders: borders, CellXfs: cellXfs}
-
-// 	cell = &Cell{Value: "123", styleIndex: 1, styles: xStyles}
-// 	style = cell.GetStyle()
-// 	border := style.Border
-// 	if border.Left != "thin" {
-// 		t.Error("Expected border.Left == 'thin', but got ",
-// 			border.Left)
-// 	}
-// 	if border.Right != "thin" {
-// 		t.Error("Expected border.Right == 'thin', but got ",
-// 			border.Right)
-// 	}
-// 	if border.Top != "thin" {
-// 		t.Error("Expected border.Top == 'thin', but got ",
-// 			border.Top)
-// 	}
-// 	if border.Bottom != "thin" {
-// 		t.Error("Expected border.Bottom == 'thin', but got ",
-// 			border.Bottom)
-// 	}
-// }
+// Test that GetStyle correctly converts the xlsxStyle.Borders.
+func (l *LibSuite) TestGetStyleWithBorders(c *C) {
+	var cell *Cell
+	var style *Style
+	var xStyles *xlsxStyles
+	var borders []xlsxBorder
+	var cellXfs []xlsxXf
+
+	borders = make([]xlsxBorder, 1)
+	borders[0] = xlsxBorder{
+		Left:   xlsxLine{Style: "thin"},
+		Right:  xlsxLine{Style: "thin"},
+		Top:    xlsxLine{Style: "thin"},
+		Bottom: xlsxLine{Style: "thin"}}
+
+	cellXfs = make([]xlsxXf, 1)
+	cellXfs[0] = xlsxXf{ApplyBorder: true, BorderId: 0}
+
+	xStyles = &xlsxStyles{Borders: borders, CellXfs: cellXfs}
+
+	cell = &Cell{Value: "123", styleIndex: 1, styles: xStyles}
+	style = cell.GetStyle()
+	border := style.Border
+	c.Assert(border.Left, Equals, "thin")
+	c.Assert(border.Right, Equals, "thin")
+	c.Assert(border.Top, Equals, "thin")
+	c.Assert(border.Bottom, Equals, "thin")
+}
 
 // // Test that we can correctly extract a reference table from the
 // // sharedStrings.xml file embedded in the XLSX file and return a