Sha256: fca99588e396eea887efb5c880c8c9f0e176270e70335c298faba085ad20c758

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

require "mireru/widget"

class WidgetTest < Test::Unit::TestCase
  def test_image?
    assert_nil(Mireru::Widget.image?(__FILE__))
    assert_not_nil(Mireru::Widget.image?("test/fixtures/nijip.png"))
    assert_not_nil(Mireru::Widget.image?("hoge.PNG"))
    assert_not_nil(Mireru::Widget.image?("hoge.jpg"))
    assert_not_nil(Mireru::Widget.image?("hoge.jpeg"))
    assert_not_nil(Mireru::Widget.image?("hoge.gif"))
  end

  def test_buffer_from_file_of_text
    widget = Mireru::Widget.__send__(:buffer_from_file, __FILE__)
    assert_equal(GtkSource::Buffer, widget.class)
  end

  def test_buffer_from_file_of_binary
    assert_raise Mireru::Error do
      Mireru::Widget.__send__(:buffer_from_file, "test/fixtures/nijip.png")
    end
  end

  def test_buffer_from_text_of_utf8
    widget = Mireru::Widget.__send__(:buffer_from_text, "御庭番")
    assert_equal(GtkSource::Buffer, widget.class)
  end

  def test_buffer_from_text_of_sjis
    widget = Mireru::Widget.__send__(:buffer_from_text, "御庭番".encode("SJIS"))
    assert_equal(GtkSource::Buffer, widget.class)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mireru-0.1.8 test/test-widget.rb
mireru-0.1.7 test/test-widget.rb
mireru-0.1.6 test/test-widget.rb
mireru-0.1.5 test/test-widget.rb
mireru-0.1.4 test/test-widget.rb
mireru-0.1.3 test/test-widget.rb
mireru-0.1.2 test/test-widget.rb
mireru-0.1.1 test/test-widget.rb