test/test-window.rb in mireru-0.9.2 vs test/test-window.rb in mireru-0.9.3
- old
+ new
@@ -21,30 +21,37 @@
def setup
@window = Mireru::Window.new([])
end
- class AddFromFileTest
- def test_scrollable
+ class AddFromFileTest < self
+ def test_textview
file = __FILE__
- mock(Mireru::Widget).new(file, *@window.size) do
+ stub(Mireru::Widget).create do
Gtk::TextView.new
end
- mock(@window).show_all
+ stub(@window).show_all
@window.add_from_file(file)
- assert_equal(Gtk::ScrolledWindow, @window.child.class)
- assert_equal(Gtk::TextView, @window.child.child.class)
+ pane = @window.child
+ vbox = pane.child2
+ scrolled_window = vbox.children[0]
+ widget = scrolled_window.child
+ assert_kind_of(Gtk::TextView, widget)
end
- def test_no_scrollable
+ def test_viewport
file = File.join(fixtures_dir, "nijip.png")
- mock(Mireru::Widget).new(file, *@window.size) do
+ stub(Mireru::Widget).create do
Gtk::Image.new
end
- mock(@window).show_all
+ stub(@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)
+ pane = @window.child
+ vbox = pane.child2
+ scrolled_window = vbox.children[0]
+ view_port = scrolled_window.child
+ assert_kind_of(Gtk::Viewport, view_port)
+ widget = view_port.child
+ assert_kind_of(Gtk::Image, widget)
end
end
end