Sha256: 7dfc9bbd5478482fc53b5edc195a6d467465db722afb2f3a22fee4355a6d1c81

Contents?: true

Size: 1.19 KB

Versions: 38

Compression:

Stored size: 1.19 KB

Contents

require 'test/unit'

require 'fox16'

include Fox

class TC_FXRegion < Test::Unit::TestCase

  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)
             ]
    r1 = FXRegion.new(points, true)
    r2 = FXRegion.new(points, false)
    r3 = 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

38 entries across 38 versions & 1 rubygems

Version Path
fxruby-1.6.20-x86-mingw32 test/TC_FXRegion.rb
fxruby-1.6.20-x86-linux test/TC_FXRegion.rb
fxruby-1.6.20 test/TC_FXRegion.rb
fxruby-1.6.20-universal-darwin-10 test/TC_FXRegion.rb
fxruby-1.6.19-x86-mingw32 tests/TC_FXRegion.rb
fxruby-1.6.14-mswin32 tests/TC_FXRegion.rb
fxruby-1.6.13-mswin32 tests/TC_FXRegion.rb
fxruby-1.6.0 tests/TC_FXRegion.rb
fxruby-1.6.1 tests/TC_FXRegion.rb
fxruby-1.6.11 tests/TC_FXRegion.rb
fxruby-1.6.10 tests/TC_FXRegion.rb
fxruby-1.6.12 tests/TC_FXRegion.rb
fxruby-1.6.13 tests/TC_FXRegion.rb
fxruby-1.6.14-universal-darwin-9 tests/TC_FXRegion.rb
fxruby-1.6.15-universal-darwin-9 tests/TC_FXRegion.rb
fxruby-1.6.14 tests/TC_FXRegion.rb
fxruby-1.6.15 tests/TC_FXRegion.rb
fxruby-1.6.15-x86-mswin32-60 tests/TC_FXRegion.rb
fxruby-1.6.16-universal-darwin-9 tests/TC_FXRegion.rb
fxruby-1.6.16-x86-mswin32-60 tests/TC_FXRegion.rb