Sha256: 4e97d344635f756220f84ba6535e4ccef3afe2d7d49ea488612e9b36733b68a5

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require 'Context/Gtk/Widget.rb'

module Context::Gtk 

	describe Widget do

        class FakeWidget
            include Widget
        end

        before(:each) do
			@widget = FakeWidget.new()
			@newWidget = FakeWidget.new()  
 			@oldWidget = FakeWidget.new()
       end

		it "should add and show the widget when add is called." do
			@widget.should_receive(:gtkAddWidget).with(@newWidget)
			@widget.should_receive(:show_all)
			@widget.addToThisWidget(@newWidget)
		end

        it "should remove the widget, reshow the container when removed is called." do
			@widget.should_receive(:gtkRemoveWidget).with(@oldWidget)
			@widget.should_receive(:show_all)
			@widget.removeFromThisWidget(@oldWidget)            
        end   
        
        it "should keep track of the main Window" do
            @widget.gtkWidgetMainWindow.should be_nil
            @widget.isAMainWindow
            @widget.gtkWidgetMainWindow.should be_eql(@widget)

			@widget.should_receive(:gtkAddWidget).with(@newWidget)
			@widget.should_receive(:show_all).exactly(2).times
			@widget.addToThisWidget(@newWidget)
            @newWidget.gtkWidgetMainWindow.should be_eql(@widget)

			@widget.should_receive(:gtkRemoveWidget).with(@newWidget)
			@widget.removeFromThisWidget(@newWidget)            
            @newWidget.gtkWidgetMainWindow.should be_nil
        end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
context-0.0.22 spec/Context/Gtk/Widget_spec.rb