style_test.go 959 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package xlsx
  2. import (
  3. . "gopkg.in/check.v1"
  4. )
  5. type StyleSuite struct{}
  6. var _ = Suite(&StyleSuite{})
  7. func (s *StyleSuite) TestNewStyle(c *C) {
  8. style := NewStyle()
  9. c.Assert(style, NotNil)
  10. }
  11. func (s *StyleSuite) TestMakeXLSXStyleElements(c *C) {
  12. style := NewStyle()
  13. font := *NewFont(12, "Verdana")
  14. style.Font = font
  15. fill := *NewFill("solid", "00FF0000", "FF000000")
  16. style.Fill = fill
  17. xFont, xFill, _, _, _ := style.makeXLSXStyleElements()
  18. // HERE YOU ARE!
  19. c.Assert(xFont.Sz.Val, Equals, "12")
  20. c.Assert(xFont.Name.Val, Equals, "Verdana")
  21. c.Assert(xFill.PatternFill.PatternType, Equals, "solid")
  22. c.Assert(xFill.PatternFill.FgColor.RGB, Equals, "00FF0000")
  23. c.Assert(xFill.PatternFill.BgColor.RGB, Equals, "FF000000")
  24. }
  25. type FontSuite struct{}
  26. var _ = Suite(&FontSuite{})
  27. func (s *FontSuite) TestNewFont(c *C) {
  28. font := NewFont(12, "Verdana")
  29. c.Assert(font, NotNil)
  30. c.Assert(font.Name, Equals, "Verdana")
  31. c.Assert(font.Size, Equals, 12)
  32. }