Sha256: b8f1d6953345286f621885090e26ea1e41ecffd4e0dd1df6c1e09c75d0ae0009

Contents?: true

Size: 1.07 KB

Versions: 9

Compression:

Stored size: 1.07 KB

Contents

require 'helper'

require 'fileutils'

class LibnotifyIconFinderTest < LibnotifyTestCase
  test "find icon with highest resolution" do
    dir = fixture_file("/icons/*")
    assert_icon_path [ dir ], "/icons/128x128/happy.jpg", "happy.jpg"
  end

  test "search all provided dirs" do
    dirs = [ fixture_file("/icons/*"), fixture_file("/emoticons/*") ]

    assert_icon_path dirs, "/emoticons/128x128/happy.jpg", "happy.jpg"
  end

  test "does not find unknown icons" do
    dir = fixture_file("/icons/*")
    refute icon_finder([ dir ]).icon_path("unknown.jpg")
  end

  test "does not find known icon in unknown dirs" do
    dir = fixture_file("/unknown/*")
    refute icon_finder([ dir ]).icon_path("happy.jpg")
  end

  test "find icon alphabetically w/o resolution" do
    dir = fixture_file("/images/*")
    assert_icon_path [ dir ], "/images/another/happy.jpg", "happy.jpg"
  end

  private

  def icon_finder(*dirs)
    Libnotify::IconFinder.new(dirs)
  end

  def assert_icon_path(dirs, expected, name)
    assert_equal fixture_file(expected), icon_finder(*dirs).icon_path(name)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
libnotify-0.9.4 test/libnotify/icon_finder_test.rb
libnotify-0.9.3 test/libnotify/icon_finder_test.rb
libnotify-0.9.2 test/libnotify/icon_finder_test.rb
libnotify-0.9.1 test/libnotify/icon_finder_test.rb
libnotify-0.9.0 test/libnotify/icon_finder_test.rb
libnotify-0.8.4 test/libnotify/icon_finder_test.rb
libnotify-0.8.3 test/libnotify/icon_finder_test.rb
libnotify-0.8.2 test/libnotify/icon_finder_test.rb
libnotify-0.8.1 test/libnotify/icon_finder_test.rb