Sha256: 68a7db689af1c9d02d96afb40b50ff9044d50181093c1750fcd97c94b6a562fe

Contents?: true

Size: 1.46 KB

Versions: 2

Compression:

Stored size: 1.46 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 = dataset.raster_band(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

2 entries across 2 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta3 spec/integration/color_table_info_spec.rb
ffi-gdal-1.0.0.beta1 spec/integration/color_table_info_spec.rb