Sha256: 0089d184bda0926a46e36566278217536c1842d7565fa13c08eb9e00a4970110

Contents?: true

Size: 1.56 KB

Versions: 4

Compression:

Stored size: 1.56 KB

Contents

require 'spec_helper'
require 'gdal/color_table'

RSpec.describe GDAL::ColorTable do
  subject do
    described_class.new(:GPI_RGB)
  end

  describe '#color_entries_for' do
    context 'no colors' do
      it 'returns an empty array' do
        expect(subject.color_entries_for(1)).to be_empty
      end
    end

    context 'colors' do
      it 'returns all of the color values ColorEntrys for the color number' do
        subject.add_color_entry(0, 1, 2, 3, 4)
        subject.add_color_entry(1, 10, 20, 30, 40)
        expect(subject.color_entries_for(1)).to eq([1, 10])
      end
    end
  end

  describe '#color_entries' do
    context 'no colors' do
      it 'returns an empty array' do
        expect(subject.color_entries).to be_empty
      end
    end

    context 'colors' do
      it 'returns an array of the ColorEntrys' do
        subject.add_color_entry(0, 1, 2, 3, 4)
        subject.add_color_entry(1, 10, 20, 30, 40)

        expect(subject.color_entries.size).to eq 2
        expect(subject.color_entries.first).to be_a GDAL::ColorEntry
      end
    end
  end

  describe '#color_entries_as_rgb' do
    context 'no colors' do
      it 'returns an empty array' do
        expect(subject.color_entries_as_rgb).to be_empty
      end
    end

    context 'colors' do
      it 'returns an array of the ColorEntrys' do
        subject.add_color_entry(0, 1, 2, 3, 4)
        subject.add_color_entry(1, 10, 20, 30, 40)

        expect(subject.color_entries_as_rgb.size).to eq 2
        expect(subject.color_entries_as_rgb.first).to be_a GDAL::ColorEntry
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta7 spec/unit/gdal/color_table_mixins/extensions_spec.rb
ffi-gdal-1.0.0.beta6 spec/unit/gdal/color_table_mixins/extensions_spec.rb
ffi-gdal-1.0.0.beta5 spec/unit/gdal/color_table_mixins/extensions_spec.rb
ffi-gdal-1.0.0.beta4 spec/unit/gdal/color_table_mixins/extensions_spec.rb