test/test_shape.rb in processing-0.5.31 vs test/test_shape.rb in processing-0.5.32

- old
+ new

@@ -233,10 +233,86 @@ s.endShape shape s ACTUAL end + def test_curveVertex() + assert_equal_draw_vertices <<~END + s.beginShape + s.curveVertex 100, 100 + s.curveVertex 800, 100 + s.curveVertex 800, 800 + s.curveVertex 100, 800 + s.endShape + END + + assert_equal_draw_vertices <<~END + s.beginShape + s.curveVertex 200, 200 + s.curveVertex 200, 200 + s.curveVertex 800, 200 + s.curveVertex 800, 400 + s.curveVertex 200, 400 + s.curveVertex 200, 800 + s.curveVertex 800, 800 + s.curveVertex 800, 700 + s.curveVertex 800, 700 + s.endShape + END + end + + def test_bezierVertex() + assert_equal_draw_vertices <<~END + s.beginShape + s.vertex 100, 100 + s.bezierVertex 900, 100, 900, 900, 200, 500 + s.endShape + END + + assert_equal_draw_vertices <<~END + s.beginShape + s.vertex 100, 100 + s.bezierVertex 900, 100, 900, 500, 300, 500 + s.bezierVertex 100, 900, 900, 900, 900, 600 + s.endShape + END + end + + def test_quadraticVertex() + assert_equal_draw_vertices <<~END + s.beginShape + s.vertex 100, 100 + s.quadraticVertex 800, 500, 200, 800 + s.endShape + END + + assert_equal_draw_vertices <<~END + s.beginShape + s.vertex 100, 100 + s.quadraticVertex 800, 100, 500, 500 + s.quadraticVertex 100, 800, 800, 800 + s.endShape + END + end + + def test_contour() + assert_equal_draw_vertices <<~END + s.beginShape + s.vertex 100, 100 + s.vertex 100, 900 + s.vertex 900, 900 + s.vertex 900, 100 + s.beginContour + s.vertex 200, 200 + s.vertex 800, 200 + s.vertex 700, 700 + s.vertex 200, 800 + s.endContour + s.endShape + END + end + def test_getVertex() s = createShape s.beginShape s.vertex 1, 2 s.vertex 3, 4 @@ -284,9 +360,58 @@ s.vertex 5, 6 assert_equal 3, s.getVertexCount s.endShape assert_equal 3, s.getVertexCount + end + + def test_fill() + assert_equal_draw <<~HEADER, <<~EXPECTED, <<~ACTUAL + noStroke + HEADER + fill 0, 255, 0 + rect 100, 100, 500, 400 + EXPECTED + s = createShape + s.beginShape + s.fill 0, 255, 0 + s.vertex 100, 100 + s.vertex 600, 100 + s.vertex 600, 500 + s.vertex 100, 500 + s.endShape + shape s + ACTUAL + end + + def test_setFill() + assert_equal_draw <<~HEADER, <<~EXPECTED, <<~ACTUAL + noStroke + HEADER + fill 0, 255, 0 + rect 100, 100, 500, 400 + EXPECTED + s = createShape + s.beginShape + s.vertex 100, 100 + s.vertex 600, 100 + s.vertex 600, 500 + s.vertex 100, 500 + s.endShape + s.setFill 0, 255, 0 + shape s + ACTUAL + + assert_equal_draw <<~HEADER, <<~EXPECTED, <<~ACTUAL + noStroke + HEADER + fill 0, 255, 0 + ellipse 300, 400, 500, 400 + EXPECTED + s = createShape ELLIPSE, 300, 400, 500, 400 + s.setFill 0, 255, 0 + shape s + ACTUAL end def test_addChild() group = createShape G::GROUP assert_nil group.getChild(0)