Sha256: 0918d854e99f3aa1fa48d757462e39a58078620b815105850f7148c057b87c26

Contents?: true

Size: 947 Bytes

Versions: 4

Compression:

Stored size: 947 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

4 entries across 4 versions & 1 rubygems

Version Path
gir_ffi-gtk-0.14.1 test/gir_ffi-gtk/container_test.rb
gir_ffi-gtk-0.14.0 test/gir_ffi-gtk/container_test.rb
gir_ffi-gtk-0.13.1 test/gir_ffi-gtk/container_test.rb
gir_ffi-gtk-0.13.0 test/gir_ffi-gtk/container_test.rb