Sha256: b1ab241b87d7a4428a3eacc2f0ed4ed219067e25e6f2318497ef2a13ce764931

Contents?: true

Size: 1.59 KB

Versions: 9

Compression:

Stored size: 1.59 KB

Contents

# frozen_string_literal: true

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

9 entries across 9 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta16 spec/unit/gdal/color_table_mixins/extensions_spec.rb
ffi-gdal-1.0.0.beta15 spec/unit/gdal/color_table_mixins/extensions_spec.rb
ffi-gdal-1.0.0.beta14 spec/unit/gdal/color_table_mixins/extensions_spec.rb
ffi-gdal-1.0.0.beta13 spec/unit/gdal/color_table_mixins/extensions_spec.rb
ffi-gdal-1.0.0.beta12 spec/unit/gdal/color_table_mixins/extensions_spec.rb
ffi-gdal-1.0.0.beta11 spec/unit/gdal/color_table_mixins/extensions_spec.rb
ffi-gdal-1.0.0.beta10 spec/unit/gdal/color_table_mixins/extensions_spec.rb
ffi-gdal-1.0.0.beta9 spec/unit/gdal/color_table_mixins/extensions_spec.rb
ffi-gdal-1.0.0.beta8 spec/unit/gdal/color_table_mixins/extensions_spec.rb