Sha256: c345db3733f30e6ca873e6a12ce4a0e0b34f6fe3ba1374eaabd8d94581cbbeb5

Contents?: true

Size: 1.36 KB

Versions: 31

Compression:

Stored size: 1.36 KB

Contents

require_relative 'test_helper'
require_relative '../lib/propane/creators/sketch_class'
require_relative '../lib/propane/creators/sketch_writer'

CLASS_SKETCH = <<~CODE

#!/usr/bin/env jruby
# frozen_string_literal: false
require 'propane'

class FredSketch < Propane::App
  def settings
    size 200, 200
  end

  def setup
    sketch_title 'Fred Sketch'
  end

  def draw

  end
end

FredSketch.new

CODE

class SketchClassTest < Minitest::Test

  def setup
    @basic = SketchClass.new(name: 'fred_sketch', width: 200, height: 200)
    @sketch = SketchClass.new(name: 'fred_sketch', width: 200, height: 200, mode: 'p2d')
  end

  def test_class
    result = CLASS_SKETCH.split(/\n/, -1)
    class_lines = @sketch.lines
    class_lines.each_with_index do |line, i|
      assert_equal result[i], line
    end
  end

  def test_indent
    assert_equal '  indent', @sketch.indent('indent')
  end

  def test_size
    assert_equal '    size 200, 200, P2D', @sketch.size
    assert_equal '    size 200, 200', @basic.size
  end

  def test_sketch_title
    assert_equal "    sketch_title 'Fred Sketch'", @sketch.sketch_title
  end

  def test_class
    assert_equal "FredSketch", @sketch.sketch_class
  end

  def test_class_new
    assert_equal "FredSketch.new", @sketch.sketch_new
  end

  def test_sketch_class
    assert_equal "class FredSketch < Propane::App", @basic.class_sketch
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
propane-3.4.2-java test/create_test.rb
propane-3.4.1-java test/create_test.rb
propane-3.4.0-java test/create_test.rb
propane-3.3.1-java test/create_test.rb
propane-3.3.0-java test/create_test.rb
propane-3.2.0-java test/create_test.rb
propane-3.1.0.pre-java test/create_test.rb
propane-2.9.3-java test/create_test.rb
propane-3.0.1.pre-java test/create_test.rb
propane-2.9.2-java test/create_test.rb
propane-3.0.0.pre-java test/create_test.rb
propane-2.9.1-java test/create_test.rb
propane-2.9.0-java test/create_test.rb
propane-2.7.2-java test/create_test.rb
propane-2.8.0.pre-java test/create_test.rb
propane-2.7.1-java test/create_test.rb
propane-2.7.0-java test/create_test.rb
propane-2.6.6-java test/create_test.rb
propane-2.6.5.pre-java test/create_test.rb
propane-2.6.4-java test/create_test.rb