Sha256: 2b9516a1c03f466cf121be6313b574111a3911c043624b104635e8aa27720c42

Contents?: true

Size: 1.33 KB

Versions: 13

Compression:

Stored size: 1.33 KB

Contents

require File.expand_path('spec/spec_helper')

describe Ruco::Screen do
  describe :curses_style do
    it "is 'normal' for nothing" do
      Ruco::Screen.curses_style(:normal, true).should == 256
    end

    it "is red for red" do
      pending
      Ruco::Screen.curses_style(:red, true).should == Curses::color_pair( Curses::COLOR_RED )
    end

    it "is reverse for reverse" do
      Ruco::Screen.curses_style(:reverse, true).should == 512
    end

    it "raises on unknown style" do
      lambda{
        Ruco::Screen.curses_style(:foo, true)
      }.should raise_error
    end

    describe 'without colors' do
      it "is 'normal' for normal" do
        Ruco::Screen.curses_style(:normal, false).should == Curses::A_NORMAL
      end

      it "is reverse for reverse" do
        Ruco::Screen.curses_style(:reverse, false).should == Curses::A_REVERSE
      end

      it "is normal for unknown style" do
        Ruco::Screen.curses_style(:foo, false).should == Curses::A_NORMAL
      end
    end
  end

  describe :html_to_terminal_color do
    # http://www.mudpedia.org/wiki/Xterm_256_colors
    [
      ['#ff0000', 196],
      ['#00ff00', 46],
      ['#0000ff', 21],
      ['#ffffff', 231]
    ].each do |html,term|
      it "converts #{html} to #{term}" do
        Ruco::Screen.html_to_terminal_color(html).should == term
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ruco-0.2.12 spec/ruco/screen_spec.rb
ruco-0.2.11 spec/ruco/screen_spec.rb
ruco-0.2.10 spec/ruco/screen_spec.rb
ruco-0.2.9 spec/ruco/screen_spec.rb
ruco-0.2.8 spec/ruco/screen_spec.rb
ruco-0.2.7 spec/ruco/screen_spec.rb
ruco-0.2.6 spec/ruco/screen_spec.rb
ruco-0.2.5 spec/ruco/screen_spec.rb
ruco-0.2.4 spec/ruco/screen_spec.rb
ruco-0.2.3 spec/ruco/screen_spec.rb
ruco-0.2.2 spec/ruco/screen_spec.rb
ruco-0.2.1 spec/ruco/screen_spec.rb
ruco-0.2.0 spec/ruco/screen_spec.rb