Sha256: bc5564c7eb9b48f966db5d90254b1ebbdbd0544fc226f9ccb7ceda9195263232

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require "mireru2/window"

class WindowTest < Test::Unit::TestCase
  def setup
    @window = Mireru2::Window.new
  end

  def test_add_container
    container = %w(a, b, c)
    mock(container).shift { "a" }
    mock(@window).add_from_file("a")
    @window.add_container(container)
  end

  def test_add_from_file_of_scrollable
    file = __FILE__
    mock(Mireru2::Widget).create(file, *@window.size) do
      Gtk::TextView.new
    end
    mock(@window).show_all
    @window.add_from_file(file)
    assert_equal(Gtk::ScrolledWindow, @window.child.class)
    assert_equal(Gtk::TextView, @window.child.child.class)
  end

  def test_add_from_file_of_no_scrollable
    file = "fixtures/nijip.png"
    mock(Mireru2::Widget).create(file, *@window.size) do
      Gtk::Image.new
    end
    mock(@window).show_all
    @window.add_from_file(file)
    assert_equal(Gtk::ScrolledWindow, @window.child.class)
    assert_equal(Gtk::Viewport, @window.child.child.class)
    assert_equal(Gtk::Image, @window.child.child.child.class)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mireru2-0.0.1 test/test-window.rb