Sha256: d6d00c081076340f5cd1038bed65cdee2068eefeb477fc70bd9373e91575a0ac

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

# encoding: utf-8
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

1 entries across 1 versions & 1 rubygems

Version Path
jldrill-0.6.0.1 spec/Context/Views/Gtk/PageView_spec.rb