Sha256: b9aac9afe6dcdb144c405b649a1e010ba965d837af2eef071bde31f2d50bf0ce

Contents?: true

Size: 1.11 KB

Versions: 38

Compression:

Stored size: 1.11 KB

Contents

require 'test/unit'

require 'fox16'

include Fox

class TC_FXSize < Test::Unit::TestCase
  def setup
    @size1 = FXSize.new
    @size2 = FXSize.new(300, 200)
  end

  def test_copy
    assert_equal(@size1, FXSize.new(@size1))
    assert_equal(@size2, FXSize.new(@size2))
  end

  def test_equals
    @size1.w = 250
    @size1.h = 475
    sameSize1 = FXSize.new
    sameSize1.w = 250
    sameSize1.h = 475
    assert_equal(@size1, sameSize1)
    assert_equal(sameSize1, @size1)

    sameSize2 = FXSize.new(300, 200)
    assert_equal(@size2, sameSize2)
    assert_equal(sameSize2, @size2)
  end

  def test_uminus
    size1 = -(@size1)
    assert(size1.w == -(@size1.w) && size1.h == -(@size1.h))
    size2 = -(@size2)
    assert(size2.w == -(@size2.w) && size2.h == -(@size2.h))
  end

  def test_add
    assert_equal(FXSize.new(1, 2) + FXSize.new(3, 4), FXSize.new(4, 6))
  end

  def test_sub
    assert_equal(FXSize.new(4, 6) - FXSize.new(3, 4), FXSize.new(1, 2))
  end

  def test_mul
    assert_equal(FXSize.new(1, 2)*3, FXSize.new(3, 6))
  end

  def test_div
    assert_equal(FXSize.new(3, 6)/3, FXSize.new(1, 2))
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

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