require "test/unit"
require "phi"
class TCCanvas < Test::Unit::TestCase
  def test_ancestors
    assert_equal Phi::Persistent, Phi::Canvas.superclass
  end

  def test_ellipse
    form = Phi::Form.new
    # cv = Phi::Canvas.new
    cv = form.canvas
    assert_equal cv, cv.ellipse(0, 0, 1, 1)
    r = Phi::Rect.new(0, 0, 1, 1)
    assert_equal cv, cv.ellipse(r)
  end

  def test_rectangle
    form = Phi::Form.new
    # cv = Phi::Canvas.new
    cv = form.canvas
    assert_equal cv, cv.rectangle(0, 0, 1, 1)
    r = Phi::Rect.new(0, 0, 1, 1)
    assert_equal cv, cv.rectangle(r)
  end

  def test_round_rect
    form = Phi::Form.new
    # cv = Phi::Canvas.new
    cv = form.canvas
    assert_equal cv, cv.round_rect(0, 0, 1, 1, 0, 0)
    r = Phi::Rect.new(0, 0, 1, 1)
    assert_equal cv, cv.round_rect(r, 0, 0)
  end

  def test_polyline
    form = Phi::Form.new
    # cv = Phi::Canvas.new
    cv = form.canvas
    assert_equal cv, cv.polyline(0, 0, 1, 0)
    p0 = Phi::Point.new(0, 0)
    p1 = Phi::Point.new(1, 0)
    assert_equal cv, cv.polyline(p0, p1)
  end

  def test_bezier
    form = Phi::Form.new
    # cv = Phi::Canvas.new
    cv = form.canvas
    assert_equal cv, cv.poly_bezier(0, 0, 1, 0)
    p0 = Phi::Point.new(0, 0)
    p1 = Phi::Point.new(1, 0)
    assert_equal cv, cv.poly_bezier(p0, p1)
  end
end
