Sha256: 227e33df8d06e66fe09157d262dd4a181ce0c97d3fa22a79f994057523062543

Contents?: true

Size: 1.17 KB

Versions: 56

Compression:

Stored size: 1.17 KB

Contents

require 'test/unit'

require 'fox16'

class TC_FXRegion < Test::Unit::TestCase
  include Fox


  def setup
    @region = FXRegion.new(5, 5, 10, 10)
  end

  def test_construct_from_points
    points = [
               FXPoint.new(0, 0),
               FXPoint.new(0, 100),
               FXPoint.new(100, 100),
               FXPoint.new(0, 0)
             ]
    FXRegion.new(points, true)
    FXRegion.new(points, false)
    FXRegion.new(points)
  end

  def test_copy_constructor
    assert_equal(@region, FXRegion.new(@region))
  end

  def test_empty
    assert(!@region.empty?)
    empty_region = FXRegion.new(5, 5, 0, 0)
    assert(empty_region.empty?)
  end

  def test_containsPoint
    # Definitely out of bounds
    assert(!@region.contains?(2, 3))

    # Definitely in bounds
    assert(@region.contains?(6, 6))

    # Check corners too
    assert(@region.contains?(5, 5))
    assert(@region.contains?(5, 14))
    assert(@region.contains?(14, 14))
    assert(@region.contains?(14, 5))
  end

  def test_containsRectangle
    assert(@region.contains?(2, 3, 15, 15)) # why doesn't this fail?
    assert(@region.contains?(5, 5, 10, 10))
    assert(@region.contains?(6, 6, 5, 5))
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
fxruby-1.6.48 test/TC_FXRegion.rb
fxruby-1.6.48-x64-mingw32 test/TC_FXRegion.rb
fxruby-1.6.48-x64-mingw-ucrt test/TC_FXRegion.rb
fxruby-1.6.48-x86-mingw32 test/TC_FXRegion.rb
fxruby-1.6.47 test/TC_FXRegion.rb
fxruby-1.6.47-x64-mingw-ucrt test/TC_FXRegion.rb
fxruby-1.6.47-x64-mingw32 test/TC_FXRegion.rb
fxruby-1.6.47-x86-mingw32 test/TC_FXRegion.rb
fxruby-1.6.46 test/TC_FXRegion.rb
fxruby-1.6.46-x64-mingw32 test/TC_FXRegion.rb
fxruby-1.6.46-x64-mingw-ucrt test/TC_FXRegion.rb
fxruby-1.6.46-x86-mingw32 test/TC_FXRegion.rb
fxruby-1.6.45 test/TC_FXRegion.rb
fxruby-1.6.45-x64-mingw32 test/TC_FXRegion.rb
fxruby-1.6.45-x64-mingw-ucrt test/TC_FXRegion.rb
fxruby-1.6.45-x86-mingw32 test/TC_FXRegion.rb
fxruby-1.6.44 test/TC_FXRegion.rb
fxruby-1.6.44-x64-mingw32 test/TC_FXRegion.rb
fxruby-1.6.44-x86-mingw32 test/TC_FXRegion.rb
fxruby-1.6.43 test/TC_FXRegion.rb