Sha256: 741f5f57ac537e384b9396080983c012f12cf7103e417e1d43005a9a9175668a

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

require 'Context/Bridge'
require 'Context/Context'
require 'Context/Views/Gtk/PageView'

module Context::Gtk 

    class FakeView < Context::View
        class FakeWidget < Gtk::Button
            include Widget

            def initialize(name)
                super(name)
                setupWidget
            end
        end
        
        def initialize(context)
            super(context)
            @widget = FakeWidget.new("Button")
        end

        def getWidget
            @widget
        end
    end

	describe PageView do

		before(:each) do
		    @bridge = Context::Bridge.new(Context::Gtk)
			@context = Context::Context.new(@bridge)
			@view = @bridge.PageView.new(@context)
		end

		it "should have a widget when initialized" do
			@view.getWidget.should_not be_nil
		end
				
		it "should add widgets from another view when added" do
			newContext = mock("Context::Context")
			newView = FakeView.new(newContext)
			@view.getWidget().should_receive(:gtkAddWidget).with(newView.getWidget)
			@view.addView(newView)
		end

        it "should remove widgets from another view when removed" do
			oldContext = mock("Context::MainContext")
			oldView = FakeView.new(oldContext)
            @view.addView(oldView)
			@view.getWidget().should_receive(:gtkRemoveWidget).with(oldView.getWidget)
			@view.removeView(oldView)
		end
            
		it "should react to destroy signals" do
			@view.should_receive(:close)
			@view.emitDestroyEvent
		end
	end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
jldrill-0.5.1.7 spec/Context/Views/Gtk/PageView_spec.rb
context-0.0.22 spec/Context/Views/Gtk/PageView_spec.rb