Sha256: 2e55ac32d0f7e4e5fbf604f2827daabb0f451df83775a751c194dbe1c6a91e15

Contents?: true

Size: 950 Bytes

Versions: 5

Compression:

Stored size: 950 Bytes

Contents

require 'test_helper'

describe Gtk::Container do
  let(:container) { Gtk::Table.new 1, 1, true }
  let(:widget) { Gtk::Label.new 'foo' }

  describe '#add_with_properties' do
    before do
      container.add_with_properties widget, :'left-attach' => 1
    end

    it 'adds the widget to the container' do
      container.get_children.to_a.must_equal [widget]
    end

    it 'sets the child properties for the widget' do
      container.child_get_property(widget, 'left-attach').must_equal 1
    end
  end

  describe '#child_get_property' do
    it 'fetches the given child property' do
      container.add widget
      container.child_set_property(widget, 'left-attach', 1)
      container.child_get_property(widget, 'left-attach').must_equal 1
    end

    it 'raises an ArgumentError for unknown properties' do
      container.add widget
      proc { container.child_get_property(widget, 'foobar') }.must_raise ArgumentError
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gir_ffi-gtk-0.12.1 test/gir_ffi-gtk/container_test.rb
gir_ffi-gtk-0.12.0 test/gir_ffi-gtk/container_test.rb
gir_ffi-gtk-0.11.0 test/gir_ffi-gtk/container_test.rb
gir_ffi-gtk-0.10.0 test/gir_ffi-gtk/container_test.rb
gir_ffi-gtk-0.9.0 test/gir_ffi-gtk/container_test.rb