Sha256: 9f7f2c28fadfc986c07670539488216f199756835e84d07e3b3d3f8cd95b1862

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require 'test_helper'

describe Gtk::Image do
  describe '.new_from_icon_name' do
    it 'works when called with a symbol' do
      result = Gtk::Image.new_from_icon_name('hi', :dialog)
      _(result).must_be_instance_of Gtk::Image
    end

    it 'works when called with an integer' do
      result = Gtk::Image.new_from_icon_name('hi', 4)
      _(result).must_be_instance_of Gtk::Image
    end
  end

  describe '.new_from_gicon' do
    let(:gicon) { Gio::ThemedIcon.new('hi') }
    it 'works when called with a symbol' do
      result = Gtk::Image.new_from_gicon(gicon, :dialog)
      _(result).must_be_instance_of Gtk::Image
    end

    it 'works when called with an integer' do
      result = Gtk::Image.new_from_gicon(gicon, 4)
      _(result).must_be_instance_of Gtk::Image
    end
  end

  describe '#set_from_gicon' do
    let(:gicon) { Gio::ThemedIcon.new('gnome') }
    let(:image) { Gtk::Image.new }

    it 'works when called with a symbol' do
      image.set_from_gicon(gicon, :dialog)
      _(image.get_gicon).must_equal [gicon, 6]
    end

    it 'works when called with an integer' do
      image.set_from_gicon(gicon, 4)
      _(image.get_gicon).must_equal [gicon, 4]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gir_ffi-gtk-0.15.0 test/gir_ffi-gtk/image_test.rb