Sha256: 5da59fd56d86fc21b082d642e0ab036b62eeec0bed1bc4a3e29e5c165fa44b69

Contents?: true

Size: 1.66 KB

Versions: 18

Compression:

Stored size: 1.66 KB

Contents

class TestGtkImage < Test::Unit::TestCase
  include GtkTestUtils

  sub_test_case ".new" do
    test "empty" do
      image = Gtk::Image.new
      assert_equal(nil, image.pixbuf)
    end

    test "stock" do
      image = Gtk::Image.new(:stock => Gtk::Stock::GO_FORWARD,
                             :size => :dialog)
      assert_equal([
                     Gtk::Stock::GO_FORWARD.to_s,
                     Gtk::IconSize::DIALOG,
                   ],
                   image.stock)
    end

    test "icon_name" do
      icon_name = "dialog-password"
      image = Gtk::Image.new(:icon_name => icon_name,
                             :size => Gtk::IconSize::DIALOG)
      assert_equal([
                     icon_name,
                     Gtk::IconSize::DIALOG,
                   ],
                   image.icon_name)
    end

    test "icon" do
      icon = Gio::ThemedIcon.new("document-open")
      image = Gtk::Image.new(:icon => icon,
                             :size => :dialog)
      assert_equal([
                     icon,
                     Gtk::IconSize::DIALOG,
                   ],
                   image.icon)
    end

    test "resource" do
      resource = Gio::Resource.load(fixture_path("image.gresource"))
      Gio::Resources.register(resource)
      begin
        resource_path = "/org/ruby/gnome/gnome-logo-icon.png"
        image = Gtk::Image.new(:resource => resource_path,
                               :size => :dialog)
        omit("GTK+ 3.16 doesn't support getting resource path. See GitHub#461.")
        assert_equal(resource_path,
                     image.resource)
      ensure
        Gio::Resources.unregister(resource)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
gtk3-3.0.8-x86-mingw32 test/test-gtk-image.rb
gtk3-3.0.8-x64-mingw32 test/test-gtk-image.rb
gtk3-3.0.8 test/test-gtk-image.rb
gtk3-3.0.7-x86-mingw32 test/test-gtk-image.rb
gtk3-3.0.7-x64-mingw32 test/test-gtk-image.rb
gtk3-3.0.7 test/test-gtk-image.rb
gtk3-3.0.6-x86-mingw32 test/test-gtk-image.rb
gtk3-3.0.6-x64-mingw32 test/test-gtk-image.rb
gtk3-3.0.6 test/test-gtk-image.rb
gtk3-3.0.5-x64-mingw32 test/test-gtk-image.rb
gtk3-3.0.5-x86-mingw32 test/test-gtk-image.rb
gtk3-3.0.5 test/test-gtk-image.rb
gtk3-3.0.4-x86-mingw32 test/test-gtk-image.rb
gtk3-3.0.4-x64-mingw32 test/test-gtk-image.rb
gtk3-3.0.4 test/test-gtk-image.rb
gtk3-3.0.3-x64-mingw32 test/test-gtk-image.rb
gtk3-3.0.3-x86-mingw32 test/test-gtk-image.rb
gtk3-3.0.3 test/test-gtk-image.rb