Sha256: aad9f4e645a86c8dad7bc7ea0fb860e378afadc97d470661d93f35b3b6db94ec

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

# -*- coding: utf-8 -*-


require_relative 'helpers'


class TestWindow < Test::Unit::TestCase

  def setup ()
    @w = Reflex::Window.new
  end

  def teardown ()
    @w.close
  end

  def test_hidden ()
    assert_equal true, @w.hidden
    @w.show
    assert_equal false, @w.hidden
    @w.hide
    assert_equal true, @w.hidden
  end

  def test_hidden_count ()
    @w.hide
    assert_equal true, @w.hidden
    @w.show
    assert_equal true, @w.hidden
    @w.show
    assert_equal false, @w.hidden
  end

  def test_title ()
    assert_equal '', @w.title
    @w.title = 'test title'
    assert_equal 'test title', @w.title
  end

  def test_root ()
    assert_not_nil @w.root
    assert_nil     @w.root.parent
    assert_equal 'root', @w.root.name
  end

  def test_window ()
    assert_equal @w, @w.root.window
  end

  def test_move ()
    b = @w.bounds.to_a
    @w.move_to 100, 100
    assert_equal [100, 100], @w.bounds.pos.to_a
    @w.move_by 5, 5
    assert_equal [105, 105], @w.bounds.pos.to_a
    @w.move_by -1, -1
    assert_equal [104, 104], @w.bounds.pos.to_a
  end

  def test_resize ()
    b = @w.bounds.to_a
    @w.resize_to 200, 200
    assert_equal [200, 200], @w.bounds.size.to_a
    @w.resize_by 5, 5
    assert_equal [205, 205], @w.bounds.size.to_a
    @w.resize_by -1, -1
    assert_equal [204, 204], @w.bounds.size.to_a
  end

end# TestWindow

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reflexion-0.1.4 test/test_window.rb