Sha256: 474c512e84ab79eac752ae6cfe6431655130afc2b1b7b2c5344de7dcb74d437b

Contents?: true

Size: 1.49 KB

Versions: 4

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'
require 'support/integration_help'
require 'ffi-gdal'


TIF_FILES.each do |file|
  dataset =  GDAL::Dataset.open(file, 'r')

  describe 'Color Table Info' do
    after :all do
      dataset.close
    end

    # TODO: Test against each raster band
    subject do
      band = GDAL::RasterBand.new(dataset.c_pointer, band_id: 1)
      band.color_table
    end

    describe '#palette_interpretation' do
      it 'returns a GDALPaletteInterp' do
        next if subject.nil?

        expect(subject.palette_interpretation).to eq :GPI_RGB
      end
    end

    describe '#color_entry_count' do
      it 'returns a Fixnum (256 with current test files)' do
        next if subject.nil?

        expect(subject.color_entry_count).to eq 256
      end
    end

    describe '#color_entry' do
      it 'returns a FFI::GDAL::GDALColorEntry' do
        next if subject.nil?

        expect(subject.color_entry(0)).to be_a FFI::GDAL::GDALColorEntry
      end

      it 'has 4 Fixnum values, >= 0' do
        next if subject.nil?

        expect(subject.color_entry(0)[:c1]).to be_a Fixnum
        expect(subject.color_entry(0)[:c1]).to be >= 0

        expect(subject.color_entry(0)[:c2]).to be_a Fixnum
        expect(subject.color_entry(0)[:c2]).to be >= 0

        expect(subject.color_entry(0)[:c3]).to be_a Fixnum
        expect(subject.color_entry(0)[:c3]).to be >= 0

        expect(subject.color_entry(0)[:c4]).to be_a Fixnum
        expect(subject.color_entry(0)[:c4]).to be >= 0
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ffi-gdal-0.0.4 spec/ffi-gdal/integration/color_table_info_spec.rb
ffi-gdal-0.0.3 spec/ffi-gdal/integration/color_table_info_spec.rb
ffi-gdal-0.0.2 spec/ffi-gdal/integration/color_table_info_spec.rb
ffi-gdal-0.0.1 spec/ffi-gdal/integration/color_table_info_spec.rb