Class: TestSglButton

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/sgl/sgl-button.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#test_buttonObject



111
112
113
114
115
116
# File 'lib/sgl/sgl-button.rb', line 111

def test_button
  b = Button.new(1, 2)
  assert_equal(1, b.x)
  assert_equal(2, b.y)
  assert_equal([1, 2], b.pos)
end

#test_drawObject



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/sgl/sgl-button.rb', line 118

def test_draw
  app = SGL::Application.new
  app.set_setup {
	app.window(100, 100)
	app.runtime = 0.1
  }
  i = 0
  button = Button.new(0, 0)
  app.set_display {
	button.move_to(i, i)
	button.draw(i)
	i += 5
	i = 0 if 100 < i
  }
  app.mainloop
end