draw_test.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package dao
  2. import (
  3. "testing"
  4. . "github.com/smartystreets/goconvey/convey"
  5. )
  6. func TestQueConf(t *testing.T) {
  7. Convey("QueConf true", t, func() {
  8. d.QueConf(true)
  9. })
  10. Convey("QueConf false", t, func() {
  11. d.QueConf(false)
  12. })
  13. }
  14. func TestHeight(t *testing.T) {
  15. Convey("Height true", t, func() {
  16. textImgConf := d.QueConf(true)
  17. d.Height(textImgConf, "这里错了", 1)
  18. })
  19. Convey("Height false", t, func() {
  20. textImgConf := d.QueConf(false)
  21. d.Height(textImgConf, "这里对了", 1)
  22. })
  23. }
  24. func TestDaoBoard(t *testing.T) {
  25. Convey("Board", t, func() {
  26. res := d.Board(4)
  27. So(res, ShouldNotBeNil)
  28. })
  29. }
  30. func TestContext(t *testing.T) {
  31. Convey("Context", t, func() {
  32. board := d.Board(4)
  33. d.Context(board, "/data/conf/yahei.ttf")
  34. })
  35. }
  36. // func TestDrawQue(t *testing.T) {
  37. // Convey("DrawQue", t, func() {
  38. // quec := d.QueConf(true)
  39. // imgh := d.Height(quec, "这里对了", 1)
  40. // board := d.Board(imgh)
  41. // imgc := d.Context(board, "/data/conf/yahei.ttf")
  42. // pt := freetype.Pt(0, int(quec.Fontsize))
  43. // d.DrawQue(imgc, "这里对了", quec, &pt)
  44. // d.DrawAns(imgc, quec, [4]string{"A", "B", "C", "D"}, &pt)
  45. // })
  46. // }