Browse Source

Test xlsxBorder.Equals

Geoffrey J. Teale 11 years ago
parent
commit
a95866cffd
1 changed files with 26 additions and 0 deletions
  1. 26 0
      xmlStyle_test.go

+ 26 - 0
xmlStyle_test.go

@@ -204,3 +204,29 @@ func (x *XMLStyleSuite) TestFillEquals(c *C) {
 	// For sanity
 	c.Assert(fillA.Equals(fillB), Equals, true)
 }
+
+func (x *XMLStyleSuite) TestBorderEquals(c *C) {
+	borderA := xlsxBorder{Left: xlsxLine{Style: "none"},
+		Right:  xlsxLine{Style: "none"},
+		Top:    xlsxLine{Style: "none"},
+		Bottom: xlsxLine{Style: "none"}}
+	borderB := xlsxBorder{Left: xlsxLine{Style: "none"},
+		Right:  xlsxLine{Style: "none"},
+		Top:    xlsxLine{Style: "none"},
+		Bottom: xlsxLine{Style: "none"}}
+	c.Assert(borderA.Equals(borderB), Equals, true)
+	borderB.Left.Style = "thin"
+	c.Assert(borderA.Equals(borderB), Equals, false)
+	borderB.Left.Style = "none"
+	borderB.Right.Style = "thin"
+	c.Assert(borderA.Equals(borderB), Equals, false)
+	borderB.Right.Style = "none"
+	borderB.Top.Style = "thin"
+	c.Assert(borderA.Equals(borderB), Equals, false)
+	borderB.Top.Style = "none"
+	borderB.Bottom.Style = "thin"
+	c.Assert(borderA.Equals(borderB), Equals, false)
+	borderB.Bottom.Style = "none"
+	// for sanity
+	c.Assert(borderA.Equals(borderB), Equals, true)
+}