Sha256: 29ca24e574f1e75370e4b02c1b9556f3d15f38ef8a729758344560e0fff66c7b

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

require_relative './lib/wxapp_runner'
require 'wx/shapes'

class GridShapeTests < Test::Unit::TestCase

  def test_grid_shape
    obj = Wx::SF::GridShape.new
    obj.set_relative_position(Wx::RealPoint.new(100, 99))
    obj.set_rect_size(20.0, 20.0)
    obj.set_dimensions(2, 3)
    obj.accept_child(Wx::SF::RectShape)
    assert(obj.append_to_grid(Wx::SF::RectShape.new)) # should be cell 0,0
    assert(obj.insert_to_grid(1, 0, Wx::SF::RectShape.new)) # cell 1,0
    assert_instance_of(Wx::SF::RectShape, obj.get_managed_shape(0, 0))
    assert_nil(obj.get_managed_shape(0, 1))
    assert_nil(obj.get_managed_shape(0, 2))
    assert_instance_of(Wx::SF::RectShape, obj.get_managed_shape(1, 0))
    assert_nil(obj.get_managed_shape(1, 1))
    assert_nil(obj.get_managed_shape(1, 2))
    assert_nothing_raised { obj.do_children_layout }
  end

  def test_flex_grid_shape
    obj = Wx::SF::FlexGridShape.new
    obj.set_relative_position(Wx::RealPoint.new(100, 99))
    obj.set_rect_size(20.0, 20.0)
    obj.set_dimensions(2, 3)
    obj.accept_child(Wx::SF::RectShape)
    assert(obj.append_to_grid(Wx::SF::RectShape.new)) # should be cell 0,0
    assert(obj.insert_to_grid(1, 0, Wx::SF::RectShape.new)) # cell 1,0
    assert_instance_of(Wx::SF::RectShape, obj.get_managed_shape(0, 0))
    assert_nil(obj.get_managed_shape(0, 1))
    assert_nil(obj.get_managed_shape(0, 2))
    assert_instance_of(Wx::SF::RectShape, obj.get_managed_shape(1, 0))
    assert_nil(obj.get_managed_shape(1, 1))
    assert_nil(obj.get_managed_shape(1, 2))
    assert_nothing_raised { obj.do_children_layout }
  end


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wxruby3-shapes-0.9.0.pre.beta.3 tests/test_grid_shapes.rb