Sha256: f74b9693f2f47a57470c219ea0ae52fb267f619c27683afb6ad15d22d458484c

Contents?: true

Size: 864 Bytes

Versions: 4

Compression:

Stored size: 864 Bytes

Contents

require File.expand_path("helpers.rb", File.dirname(__FILE__))

class MagicDrawable < Ray::Drawable
  VertexType = Ray::GL::Vertex.make [[:foo, "bar", :float]]

  def initialize
    super VertexType
    self.vertex_count = 3
  end
end

context "a buffer renderer" do
  setup { Ray::BufferRenderer.new :static, Ray::Vertex }

  asserts("copies its drawable array") do
    !(topic.drawables.equal? topic.drawables)
  end

  asserts(:drawables).empty

  context "after adding drawables" do
    obj = Ray::Polygon.circle([100,100], 50)
    hookup { topic << obj }

    asserts(:drawables).equals [obj]

    context "and clearing it" do
      hookup { topic.clear }
      asserts(:drawables).empty
    end
  end

  asserts("adding a drawable that uses another vertex type") {
    topic << MagicDrawable.new
  }.raises_kind_of Exception
end

run_tests if __FILE__ == $0

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ray-0.2.1 test/buffer_renderer_test.rb
ray-0.2.0 test/buffer_renderer_test.rb
ray-0.1.1 test/buffer_renderer_test.rb
ray-0.1.0 test/buffer_renderer_test.rb