ffi-gdal 1.0.0.beta3 → 1.0.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +62 -0
- data/Gemfile +1 -1
- data/History.md +53 -28
- data/README.md +6 -0
- data/Rakefile +23 -1
- data/examples/extract_and_colorize.rb +21 -22
- data/examples/geometries.rb +2 -2
- data/examples/gridding.rb +106 -0
- data/examples/ogr_layer_to_layer.rb +1 -1
- data/examples/points.txt +127 -0
- data/examples/testing_gdal.rb +3 -4
- data/ffi-gdal.gemspec +3 -2
- data/lib/ext/error_symbols.rb +2 -57
- data/lib/ext/ffi_library_function_checks.rb +26 -0
- data/lib/ext/float_ext.rb +2 -2
- data/lib/ext/narray_ext.rb +2 -0
- data/lib/ext/numeric_as_data_type.rb +19 -0
- data/lib/ext/to_bool.rb +4 -4
- data/lib/ffi/cpl/conv.rb +132 -0
- data/lib/ffi/cpl/error.rb +67 -0
- data/lib/ffi/cpl/hash_set.rb +39 -0
- data/lib/ffi/cpl/http.rb +25 -0
- data/lib/ffi/cpl/http_result.rb +18 -0
- data/lib/ffi/cpl/list.rb +38 -0
- data/lib/ffi/cpl/mime_part.rb +11 -0
- data/lib/ffi/cpl/minixml.rb +47 -0
- data/lib/ffi/cpl/port.rb +23 -0
- data/lib/ffi/cpl/quad_tree.rb +51 -0
- data/lib/ffi/{ogr/ogr_envelope.rb → cpl/rect_obj.rb} +3 -3
- data/lib/ffi/cpl/string.rb +95 -0
- data/lib/ffi/cpl/vsi.rb +115 -0
- data/lib/ffi/cpl/xml_node.rb +6 -6
- data/lib/ffi/gdal/alg.rb +385 -0
- data/lib/ffi/gdal/{gdal_color_entry.rb → color_entry.rb} +1 -2
- data/lib/ffi/gdal/exceptions.rb +6 -0
- data/lib/ffi/gdal/{gdal_gcp.rb → gcp.rb} +1 -3
- data/lib/ffi/gdal/{gdal_h.rb → gdal.rb} +253 -252
- data/lib/ffi/gdal/grid.rb +58 -0
- data/lib/ffi/gdal/{gdal_grid_data_metrics_options.rb → grid_data_metrics_options.rb} +1 -2
- data/lib/ffi/gdal/{gdal_grid_inverse_distance_to_a_power_options.rb → grid_inverse_distance_to_a_power_options.rb} +1 -2
- data/lib/ffi/gdal/{gdal_grid_moving_average_options.rb → grid_moving_average_options.rb} +1 -2
- data/lib/ffi/gdal/{gdal_grid_nearest_neighbor_options.rb → grid_nearest_neighbor_options.rb} +1 -2
- data/lib/ffi/gdal/matching.rb +20 -0
- data/lib/ffi/gdal/{gdal_rpc_info.rb → rpc_info.rb} +1 -2
- data/lib/ffi/gdal/{gdal_transformer_info.rb → transformer_info.rb} +1 -2
- data/lib/ffi/gdal/version.rb +1 -1
- data/lib/ffi/gdal/vrt.rb +92 -0
- data/lib/ffi/gdal/{gdal_warp_options.rb → warp_options.rb} +8 -4
- data/lib/ffi/gdal/warper.rb +70 -0
- data/lib/ffi/gdal.rb +56 -69
- data/lib/ffi/ogr/api.rb +567 -0
- data/lib/ffi/ogr/{ogr_contour_writer_info.rb → contour_writer_info.rb} +2 -3
- data/lib/ffi/ogr/core.rb +181 -0
- data/lib/ffi/ogr/envelope.rb +12 -0
- data/lib/ffi/ogr/{ogr_envelope_3d.rb → envelope_3d.rb} +2 -2
- data/lib/ffi/ogr/featurestyle.rb +29 -0
- data/lib/ffi/ogr/field.rb +63 -0
- data/lib/ffi/ogr/geocoding.rb +30 -0
- data/lib/ffi/ogr/srs_api.rb +407 -0
- data/lib/ffi/ogr/style_param.rb +13 -0
- data/lib/ffi/ogr/{ogr_style_value.rb → style_value.rb} +4 -3
- data/lib/ffi/ogr.rb +7 -7
- data/lib/ffi-gdal.rb +7 -145
- data/lib/gdal/color_entry.rb +18 -14
- data/lib/gdal/color_entry_mixins/extensions.rb +32 -0
- data/lib/gdal/color_interpretation.rb +2 -2
- data/lib/gdal/color_table.rb +37 -32
- data/lib/gdal/color_table_mixins/extensions.rb +48 -0
- data/lib/gdal/cpl_error_handler.rb +119 -0
- data/lib/gdal/data_type.rb +7 -7
- data/lib/gdal/dataset.rb +131 -238
- data/lib/gdal/dataset_mixins/algorithm_methods.rb +182 -0
- data/lib/gdal/dataset_mixins/extensions.rb +542 -0
- data/lib/gdal/dataset_mixins/matching.rb +26 -0
- data/lib/gdal/driver.rb +68 -92
- data/lib/gdal/driver_mixins/extensions.rb +93 -0
- data/lib/gdal/exceptions.rb +32 -4
- data/lib/gdal/geo_transform.rb +63 -43
- data/lib/gdal/geo_transform_mixins/extensions.rb +57 -0
- data/lib/gdal/grid.rb +144 -0
- data/lib/gdal/grid_types/data_metrics_base.rb +14 -0
- data/lib/gdal/grid_types/inverse_distance_to_a_power.rb +19 -0
- data/lib/gdal/grid_types/metric_average_distance.rb +12 -0
- data/lib/gdal/grid_types/metric_average_distance_pts.rb +12 -0
- data/lib/gdal/grid_types/metric_count.rb +12 -0
- data/lib/gdal/grid_types/metric_maximum.rb +12 -0
- data/lib/gdal/grid_types/metric_minimum.rb +12 -0
- data/lib/gdal/grid_types/metric_range.rb +12 -0
- data/lib/gdal/grid_types/moving_average.rb +19 -0
- data/lib/gdal/grid_types/nearest_neighbor.rb +19 -0
- data/lib/gdal/grid_types.rb +22 -0
- data/lib/gdal/internal_helpers.rb +94 -0
- data/lib/gdal/major_object.rb +4 -7
- data/lib/gdal/options.rb +14 -7
- data/lib/gdal/raster_attribute_table.rb +38 -47
- data/lib/gdal/raster_attribute_table_mixins/extensions.rb +41 -0
- data/lib/gdal/raster_band.rb +193 -227
- data/lib/gdal/raster_band_classifier.rb +107 -0
- data/lib/gdal/raster_band_mixins/algorithm_methods.rb +292 -0
- data/lib/gdal/raster_band_mixins/extensions.rb +238 -0
- data/lib/gdal/rpc_info.rb +35 -0
- data/lib/gdal/transformer.rb +15 -0
- data/lib/gdal/transformers/approximate_transformer.rb +48 -0
- data/lib/gdal/transformers/base_general_image_projection_transformer.rb +45 -0
- data/lib/gdal/transformers/gcp_transformer.rb +55 -0
- data/lib/gdal/transformers/general_image_projection_transformer.rb +31 -0
- data/lib/gdal/transformers/general_image_projection_transformer2.rb +52 -0
- data/lib/gdal/transformers/general_image_projection_transformer3.rb +25 -0
- data/lib/gdal/transformers/geolocation_transformer.rb +42 -0
- data/lib/gdal/transformers/reprojection_transformer.rb +39 -0
- data/lib/gdal/transformers/rpc_transformer.rb +56 -0
- data/lib/gdal/transformers/tps_transformer.rb +40 -0
- data/lib/gdal/virtual_dataset.rb +96 -0
- data/lib/gdal/warp_operation.rb +20 -23
- data/lib/gdal.rb +17 -0
- data/lib/ogr/coordinate_transformation.rb +16 -41
- data/lib/ogr/data_source.rb +103 -58
- data/lib/ogr/data_source_extensions.rb +5 -6
- data/lib/ogr/data_source_mixins/capability_methods.rb +27 -0
- data/lib/ogr/driver.rb +61 -33
- data/lib/ogr/driver_mixins/capability_methods.rb +16 -0
- data/lib/ogr/envelope.rb +29 -18
- data/lib/ogr/envelope_extensions.rb +70 -49
- data/lib/ogr/error_handling.rb +46 -0
- data/lib/ogr/exceptions.rb +58 -12
- data/lib/ogr/feature.rb +334 -86
- data/lib/ogr/feature_definition.rb +94 -51
- data/lib/ogr/feature_definition_extensions.rb +36 -13
- data/lib/ogr/feature_extensions.rb +62 -11
- data/lib/ogr/field.rb +175 -54
- data/lib/ogr/field_definition.rb +110 -0
- data/lib/ogr/{field_extensions.rb → field_definition_extensions.rb} +4 -5
- data/lib/ogr/{geocoding_session.rb → geocoder.rb} +14 -13
- data/lib/ogr/geometries/geometry_collection.rb +13 -0
- data/lib/ogr/geometries/line_string.rb +35 -0
- data/lib/ogr/geometries/linear_ring.rb +11 -0
- data/lib/ogr/geometries/multi_line_string.rb +16 -0
- data/lib/ogr/geometries/multi_point.rb +14 -0
- data/lib/ogr/geometries/multi_polygon.rb +21 -0
- data/lib/ogr/geometries/none_geometry.rb +13 -0
- data/lib/ogr/geometries/point.rb +65 -0
- data/lib/ogr/geometries/point_extensions.rb +32 -0
- data/lib/ogr/geometries/polygon.rb +14 -0
- data/lib/ogr/geometries/unknown_geometry.rb +10 -0
- data/lib/ogr/geometry.rb +270 -242
- data/lib/ogr/geometry_extensions.rb +8 -9
- data/lib/ogr/geometry_field_definition.rb +99 -0
- data/lib/ogr/geometry_field_definition_extensions.rb +19 -0
- data/lib/ogr/geometry_types/container.rb +75 -0
- data/lib/ogr/geometry_types/curve.rb +25 -28
- data/lib/ogr/geometry_types/surface.rb +13 -4
- data/lib/ogr/internal_helpers.rb +57 -0
- data/lib/ogr/layer.rb +60 -181
- data/lib/ogr/layer_mixins/capability_methods.rb +102 -0
- data/lib/ogr/layer_mixins/extensions.rb +59 -0
- data/lib/ogr/layer_mixins/ogr_feature_methods.rb +127 -0
- data/lib/ogr/layer_mixins/ogr_field_methods.rb +143 -0
- data/lib/ogr/layer_mixins/ogr_layer_method_methods.rb +163 -0
- data/lib/ogr/layer_mixins/ogr_query_filter_methods.rb +89 -0
- data/lib/ogr/layer_mixins/ogr_sql_methods.rb +48 -0
- data/lib/ogr/spatial_reference.rb +108 -589
- data/lib/ogr/spatial_reference_extensions.rb +29 -3
- data/lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb +494 -0
- data/lib/ogr/spatial_reference_mixins/exporters.rb +134 -0
- data/lib/ogr/spatial_reference_mixins/importers.rb +243 -0
- data/lib/ogr/spatial_reference_mixins/morphers.rb +25 -0
- data/lib/ogr/spatial_reference_mixins/parameter_getter_setters.rb +122 -0
- data/lib/ogr/spatial_reference_mixins/type_checks.rb +62 -0
- data/lib/ogr/style_table.rb +53 -5
- data/lib/ogr/style_table_extensions.rb +21 -5
- data/lib/ogr/style_tool.rb +118 -0
- data/lib/ogr.rb +8 -0
- data/spec/ffi-gdal_spec.rb +1 -2
- data/spec/integration/{color_table_info_spec.rb → gdal/color_table_info_spec.rb} +12 -12
- data/spec/integration/{dataset_info_spec.rb → gdal/dataset_info_spec.rb} +2 -6
- data/spec/integration/{driver_info_spec.rb → gdal/driver_info_spec.rb} +5 -5
- data/spec/integration/{geo_transform_info_spec.rb → gdal/geo_transform_info_spec.rb} +1 -14
- data/spec/integration/{raster_attribute_table_info_spec.rb → gdal/raster_attribute_table_info_spec.rb} +1 -2
- data/spec/integration/{raster_band_info_spec.rb → gdal/raster_band_info_spec.rb} +30 -42
- data/spec/integration/ogr/layer_spec.rb +97 -0
- data/spec/spec_helper.rb +94 -5
- data/spec/support/integration_help.rb +1 -0
- data/spec/support/shared_contexts.rb +26 -0
- data/spec/support/shared_examples/{major_object_examples.rb → gdal/major_object_examples.rb} +5 -5
- data/spec/support/shared_examples/ogr/a_25D_geometry.rb +7 -0
- data/spec/support/shared_examples/ogr/a_container_geometry.rb +47 -0
- data/spec/support/shared_examples/ogr/a_geometry.rb +404 -0
- data/spec/support/shared_examples/ogr/a_line_string.rb +16 -0
- data/spec/support/test_style_table.txt +3 -0
- data/spec/unit/ext/error_symbols_spec.rb +41 -53
- data/spec/unit/ext/numeric_as_data_type_spec.rb +113 -0
- data/spec/unit/ffi/gdal_spec.rb +70 -0
- data/spec/unit/gdal/color_entry_spec.rb +5 -0
- data/spec/unit/gdal/color_interpretation_spec.rb +5 -0
- data/spec/unit/gdal/{color_table_extensions_spec.rb → color_table_mixins/extensions_spec.rb} +3 -3
- data/spec/unit/gdal/color_table_spec.rb +14 -16
- data/spec/unit/gdal/data_type_spec.rb +10 -17
- data/spec/unit/gdal/dataset_spec.rb +4 -7
- data/spec/unit/gdal/driver_mixins/extensions_spec.rb +22 -0
- data/spec/unit/gdal/driver_spec.rb +49 -0
- data/spec/unit/gdal/environment_methods_spec.rb +6 -0
- data/spec/unit/gdal/geo_transform_spec.rb +276 -0
- data/spec/unit/gdal/grid_spec.rb +5 -0
- data/spec/unit/gdal/internal_helpers_spec.rb +112 -0
- data/spec/unit/gdal/major_object_spec.rb +6 -0
- data/spec/unit/gdal/options_spec.rb +5 -0
- data/spec/unit/gdal/raster_attribute_table_spec.rb +5 -0
- data/spec/unit/gdal/raster_band_classifier_spec.rb +134 -0
- data/spec/unit/gdal/raster_band_spec.rb +5 -0
- data/spec/unit/gdal/rpc_info_spec.rb +5 -0
- data/spec/unit/gdal/version_info_spec.rb +6 -0
- data/spec/unit/gdal/virtual_dataset_spec.rb +32 -0
- data/spec/unit/gdal/warp_operation_spec.rb +5 -0
- data/spec/unit/ogr/data_source_mixins/capability_methods_spec.rb +30 -0
- data/spec/unit/ogr/data_source_spec.rb +209 -0
- data/spec/unit/ogr/driver_mixins/capability_methods_spec.rb +18 -0
- data/spec/unit/ogr/driver_spec.rb +150 -0
- data/spec/unit/ogr/envelope_spec.rb +322 -0
- data/spec/unit/ogr/feature_definition_spec.rb +313 -0
- data/spec/unit/ogr/feature_spec.rb +379 -0
- data/spec/unit/ogr/field_definition_spec.rb +135 -0
- data/spec/unit/ogr/field_spec.rb +193 -0
- data/spec/unit/ogr/geometries/geometry_collection_spec.rb +186 -0
- data/spec/unit/ogr/geometries/line_string_spec.rb +105 -0
- data/spec/unit/ogr/{linear_ring_spec.rb → geometries/linear_ring_spec.rb} +10 -31
- data/spec/unit/ogr/geometries/multi_line_string_spec.rb +14 -0
- data/spec/unit/ogr/geometries/multi_point_spec.rb +14 -0
- data/spec/unit/ogr/geometries/multi_polygon_spec.rb +41 -0
- data/spec/unit/ogr/geometries/none_geometry_spec.rb +12 -0
- data/spec/unit/ogr/{point_spec.rb → geometries/point_spec.rb} +19 -25
- data/spec/unit/ogr/geometries/polygon_spec.rb +17 -0
- data/spec/unit/ogr/geometries/unknown_geometry_spec.rb +10 -0
- data/spec/unit/ogr/geometry_field_definition_spec.rb +87 -0
- data/spec/unit/ogr/geometry_spec.rb +542 -0
- data/spec/unit/ogr/internal_helpers_spec.rb +57 -0
- data/spec/unit/ogr/layer_mixins/capability_methods_spec.rb +88 -0
- data/spec/unit/ogr/layer_mixins/ogr_feature_methods_spec.rb +145 -0
- data/spec/unit/ogr/layer_mixins/ogr_field_methods_spec.rb +432 -0
- data/spec/unit/ogr/layer_mixins/ogr_layer_method_methods_spec.rb +20 -0
- data/spec/unit/ogr/layer_mixins/ogr_query_filter_methods_spec.rb +42 -0
- data/spec/unit/ogr/layer_mixins/ogr_sql_methods_spec.rb +12 -0
- data/spec/unit/ogr/layer_spec.rb +66 -67
- data/spec/unit/ogr/spatial_reference_mixins/coordinate_system_getter_setters_spec.rb +46 -0
- data/spec/unit/ogr/spatial_reference_mixins/exporters_spec.rb +139 -0
- data/spec/unit/ogr/spatial_reference_mixins/importers_spec.rb +38 -0
- data/spec/unit/ogr/spatial_reference_mixins/morphers_spec.rb +36 -0
- data/spec/unit/ogr/spatial_reference_mixins/parameter_getter_setters_spec.rb +102 -0
- data/spec/unit/ogr/spatial_reference_mixins/type_checks_spec.rb +157 -0
- data/spec/unit/ogr/spatial_reference_spec.rb +42 -0
- data/spec/unit/ogr/style_table_spec.rb +132 -0
- data/spec/unit/ogr/style_tool_spec.rb +157 -0
- data/spec/unit/version_info_spec.rb +1 -1
- metadata +285 -75
- data/lib/ffi/cpl/conv_h.rb +0 -143
- data/lib/ffi/cpl/error_h.rb +0 -63
- data/lib/ffi/cpl/minixml_h.rb +0 -14
- data/lib/ffi/cpl/string_h.rb +0 -81
- data/lib/ffi/cpl/vsi_h.rb +0 -112
- data/lib/ffi/gdal/alg_h.rb +0 -127
- data/lib/ffi/gdal/grid_h.rb +0 -51
- data/lib/ffi/gdal/warper_h.rb +0 -48
- data/lib/ffi/ogr/api_h.rb +0 -553
- data/lib/ffi/ogr/core_h.rb +0 -148
- data/lib/ffi/ogr/featurestyle_h.rb +0 -22
- data/lib/ffi/ogr/geocoding_h.rb +0 -21
- data/lib/ffi/ogr/ogr_field.rb +0 -50
- data/lib/ffi/ogr/ogr_style_param.rb +0 -12
- data/lib/ffi/ogr/srs_api_h.rb +0 -325
- data/lib/gdal/color_entry_extensions.rb +0 -30
- data/lib/gdal/color_table_extensions.rb +0 -47
- data/lib/gdal/dataset_extensions.rb +0 -496
- data/lib/gdal/driver_extensions.rb +0 -56
- data/lib/gdal/geo_transform_extensions.rb +0 -90
- data/lib/gdal/raster_attribute_table_extensions.rb +0 -40
- data/lib/gdal/raster_band_extensions.rb +0 -198
- data/lib/ogr/geometry_types/collection.rb +0 -45
- data/lib/ogr/layer_extensions.rb +0 -55
- data/lib/ogr/line_string.rb +0 -7
- data/lib/ogr/linear_ring.rb +0 -6
- data/lib/ogr/multi_line_string.rb +0 -9
- data/lib/ogr/multi_point.rb +0 -7
- data/lib/ogr/multi_polygon.rb +0 -14
- data/lib/ogr/point.rb +0 -89
- data/lib/ogr/polygon.rb +0 -9
@@ -0,0 +1,313 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ogr/feature_definition'
|
3
|
+
|
4
|
+
RSpec.describe OGR::FeatureDefinition do
|
5
|
+
subject(:feature_definition) do
|
6
|
+
fd = described_class.new('spec feature definition')
|
7
|
+
fd.geometry_type = :wkbMultiPolygon
|
8
|
+
fd
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:field) { OGR::FieldDefinition.new('test field', :OFTString) }
|
12
|
+
|
13
|
+
describe '#name' do
|
14
|
+
it 'returns the name given to it' do
|
15
|
+
expect(subject.name).to eq 'spec feature definition'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#field_count' do
|
20
|
+
context 'no fields' do
|
21
|
+
subject { feature_definition.field_count }
|
22
|
+
it { is_expected.to be_zero }
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'with fields' do
|
26
|
+
before { feature_definition.add_field_definition(field) }
|
27
|
+
|
28
|
+
it 'returns the number of fields that have been added' do
|
29
|
+
expect(subject.field_count).to eq 1
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#field_definition' do
|
35
|
+
context 'field definition at the given index does not exist' do
|
36
|
+
it 'raises a RuntimeError' do
|
37
|
+
expect { subject.field_definition(0) }.to raise_exception RuntimeError
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'field definition at the given index exists' do
|
42
|
+
before { subject.add_field_definition(field) }
|
43
|
+
|
44
|
+
it 'returns the Field' do
|
45
|
+
expect(subject.field_definition(0)).to be_a OGR::FieldDefinition
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '#add_field_definition + #field_definition' do
|
51
|
+
context 'param is not a FieldDefinition' do
|
52
|
+
it 'raises' do
|
53
|
+
expect do
|
54
|
+
subject.add_field_definition('not a pointer')
|
55
|
+
end.to raise_exception OGR::InvalidFieldDefinition
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'param is a FieldDefinition' do
|
60
|
+
let(:field) { OGR::FieldDefinition.new('test field', :OFTString) }
|
61
|
+
|
62
|
+
it 'adds the field' do
|
63
|
+
subject.add_field_definition(field)
|
64
|
+
expect(subject.field_definition(0)).to be_a OGR::FieldDefinition
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe '#delete_field_definition' do
|
70
|
+
context 'no fields' do
|
71
|
+
it 'raises an OGR::Failure' do
|
72
|
+
expect do
|
73
|
+
subject.delete_field_definition(0)
|
74
|
+
end.to raise_exception OGR::Failure
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context 'valid field' do
|
79
|
+
before { subject.add_field_definition(field) }
|
80
|
+
|
81
|
+
it 'deletes the field' do
|
82
|
+
subject.delete_field_definition(0)
|
83
|
+
|
84
|
+
expect do
|
85
|
+
subject.delete_field_definition(0)
|
86
|
+
end.to raise_exception OGR::Failure
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe '#field_index' do
|
92
|
+
context 'field with requested name does not exist' do
|
93
|
+
it 'returns nil' do
|
94
|
+
expect(subject.field_index('things')).to be_nil
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'field with requested name exists' do
|
99
|
+
let(:field) { OGR::FieldDefinition.new('test field', :OFTString) }
|
100
|
+
before { subject.add_field_definition(field) }
|
101
|
+
|
102
|
+
it "returns the FieldDefinition's index" do
|
103
|
+
expect(subject.field_index('test field')).to be_zero
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe '#geometry_type' do
|
109
|
+
context 'default' do
|
110
|
+
subject(:feature_definition) do
|
111
|
+
described_class.new('spec feature definition')
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'is :wkbUnknown' do
|
115
|
+
expect(subject.geometry_type).to eq :wkbUnknown
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe '#geometry_type= + #geometry_type' do
|
121
|
+
context 'valid geometry type' do
|
122
|
+
it 'assigns the new geometry type' do
|
123
|
+
subject.geometry_type = :wkbPoint
|
124
|
+
expect(subject.geometry_type).to eq :wkbPoint
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
context 'invalid geometry type' do
|
129
|
+
it 'raises an ArgumenError' do
|
130
|
+
expect { subject.geometry_type = :bubbles }.
|
131
|
+
to raise_exception ArgumentError
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
describe '#geometry_ignored?' do
|
137
|
+
context 'default' do
|
138
|
+
subject { feature_definition.geometry_ignored? }
|
139
|
+
it { is_expected.to eq false }
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
describe '#ignore_geometry! + #geometry_ignored?' do
|
144
|
+
context 'set to ignore' do
|
145
|
+
it 'causes the geometry to be ignored' do
|
146
|
+
subject.ignore_geometry!
|
147
|
+
expect(subject.geometry_ignored?).to eq true
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
context 'set to not ignore' do
|
152
|
+
it 'causes the geometry to be ignored' do
|
153
|
+
subject.ignore_geometry! false
|
154
|
+
expect(subject.geometry_ignored?).to eq false
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
describe '#style_ignored?' do
|
160
|
+
context 'default' do
|
161
|
+
subject { feature_definition.style_ignored? }
|
162
|
+
it { is_expected.to eq false }
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
describe '#ignore_style! + #style_ignored?' do
|
167
|
+
context 'set to ignore' do
|
168
|
+
it 'causes the style to be ignored' do
|
169
|
+
subject.ignore_style!
|
170
|
+
expect(subject.style_ignored?).to eq true
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
context 'set to not ignore' do
|
175
|
+
it 'causes the style to be ignored' do
|
176
|
+
subject.ignore_style! false
|
177
|
+
expect(subject.style_ignored?).to eq false
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
describe '#geometry_field_count' do
|
183
|
+
context 'default' do
|
184
|
+
subject { feature_definition.geometry_field_count }
|
185
|
+
it { is_expected.to eq 1 }
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
describe '#geometry_field_definition' do
|
190
|
+
context 'default, at 0' do
|
191
|
+
it 'returns an OGR::GeometryFieldDefinition' do
|
192
|
+
expect(subject.geometry_field_definition(0)).
|
193
|
+
to be_a OGR::GeometryFieldDefinition
|
194
|
+
end
|
195
|
+
|
196
|
+
it 'has a type that is the same as the feature' do
|
197
|
+
gfd = subject.geometry_field_definition(0)
|
198
|
+
expect(subject.geometry_type).to eq gfd.type
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
describe '#add_geometry_field_definition + #geometry_field_definition' do
|
204
|
+
let(:geometry_field_definition) do
|
205
|
+
OGR::GeometryFieldDefinition.new('test1', :wkbPolygon)
|
206
|
+
end
|
207
|
+
|
208
|
+
it 'adds the geometry_field_definition' do
|
209
|
+
expect do
|
210
|
+
subject.add_geometry_field_definition geometry_field_definition
|
211
|
+
end.to change { subject.geometry_field_count }.by 1
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
describe '#delete_geometry_field_definition' do
|
216
|
+
context 'no geometry field definition at given index' do
|
217
|
+
it 'raises an OGR::Failure' do
|
218
|
+
expect do
|
219
|
+
subject.delete_geometry_field_definition(123)
|
220
|
+
end.to raise_exception OGR::Failure
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
context 'geometry field definition exists at given index' do
|
225
|
+
let(:geometry_field_definition) do
|
226
|
+
OGR::GeometryFieldDefinition.new('test1', :wkbPolygon)
|
227
|
+
end
|
228
|
+
|
229
|
+
before { subject.add_geometry_field_definition(geometry_field_definition) }
|
230
|
+
|
231
|
+
it 'deletes the gfld' do
|
232
|
+
expect do
|
233
|
+
subject.delete_geometry_field_definition(1)
|
234
|
+
end.to change { subject.geometry_field_count }.by(-1)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
describe '#field_definitions' do
|
240
|
+
it 'returns an array of size field_count' do
|
241
|
+
expect(subject.field_definitions).to be_an Array
|
242
|
+
expect(subject.field_definitions.size).to eq subject.field_count
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
describe '#field_definition_by_name' do
|
247
|
+
context 'field with name does not exist' do
|
248
|
+
it 'returns nil' do
|
249
|
+
expect(subject.field_definition_by_name('asdfasdfasdf')).to be_nil
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
describe '#geometry_field_definition_by_name' do
|
255
|
+
context 'field with name does not exist' do
|
256
|
+
it 'returns nil' do
|
257
|
+
subject.geometry_field_definition(0).name
|
258
|
+
expect(subject.geometry_field_definition_by_name('asdfasdf')).to be_nil
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
context 'field with name exists' do
|
263
|
+
it 'returns the OGR::GeometryFieldDefinition' do
|
264
|
+
name = subject.geometry_field_definition(0).name
|
265
|
+
expect(subject.geometry_field_definition_by_name(name)).
|
266
|
+
to be_a OGR::GeometryFieldDefinition
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
describe '#same?' do
|
272
|
+
context 'is the same as the other' do
|
273
|
+
let(:other_feature_definition) do
|
274
|
+
df = described_class.new('spec feature definition')
|
275
|
+
df.geometry_type = :wkbMultiPolygon
|
276
|
+
df
|
277
|
+
end
|
278
|
+
|
279
|
+
it 'returns true' do
|
280
|
+
expect(subject.same?(other_feature_definition)).to eq true
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
context 'not the same as the other' do
|
285
|
+
let(:other_feature_definition) do
|
286
|
+
described_class.new('other feature definition')
|
287
|
+
end
|
288
|
+
|
289
|
+
it 'returns false' do
|
290
|
+
expect(subject.same?(other_feature_definition)).to eq false
|
291
|
+
end
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
describe '#as_json' do
|
296
|
+
it 'returns a Hash of all attributes and values' do
|
297
|
+
expect(subject.as_json).to eq(field_count: 0,
|
298
|
+
field_definitions: [],
|
299
|
+
geometry_field_count: 1,
|
300
|
+
geometry_type: :wkbMultiPolygon,
|
301
|
+
is_geometry_ignored: false,
|
302
|
+
is_style_ignored: false,
|
303
|
+
name: 'spec feature definition')
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
describe '#to_json' do
|
308
|
+
it 'is a String' do
|
309
|
+
expect(subject.to_json).to be_a String
|
310
|
+
expect(subject.to_json).to_not be_empty
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
@@ -0,0 +1,379 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'date'
|
3
|
+
require 'ogr/feature'
|
4
|
+
|
5
|
+
RSpec.describe OGR::Feature do
|
6
|
+
let(:integer_field) { OGR::FieldDefinition.new('test integer field', :OFTInteger) }
|
7
|
+
let(:integer_list_field) { OGR::FieldDefinition.new('test integer list field', :OFTIntegerList) }
|
8
|
+
let(:real_field) { OGR::FieldDefinition.new('test real field', :OFTReal) }
|
9
|
+
let(:real_list_field) { OGR::FieldDefinition.new('test real list field', :OFTRealList) }
|
10
|
+
let(:string_field) { OGR::FieldDefinition.new('test string field', :OFTString) }
|
11
|
+
let(:string_list_field) { OGR::FieldDefinition.new('test string list field', :OFTStringList) }
|
12
|
+
let(:binary_field) { OGR::FieldDefinition.new('test binary field', :OFTBinary) }
|
13
|
+
let(:date_field) { OGR::FieldDefinition.new('test date field', :OFTDate) }
|
14
|
+
|
15
|
+
let(:geometry_field_definition) do
|
16
|
+
OGR::GeometryFieldDefinition.new('test geometry', :wkbPoint)
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:feature_definition) do
|
20
|
+
fd = OGR::FeatureDefinition.new('test FD')
|
21
|
+
|
22
|
+
fd.add_field_definition(integer_field) # 0
|
23
|
+
fd.add_field_definition(integer_list_field) # 1
|
24
|
+
fd.add_field_definition(real_field) # 2
|
25
|
+
fd.add_field_definition(real_list_field) # 3
|
26
|
+
fd.add_field_definition(string_field) # 4
|
27
|
+
fd.add_field_definition(string_list_field) # 5
|
28
|
+
fd.add_field_definition(binary_field) # 6
|
29
|
+
fd.add_field_definition(date_field) # 7
|
30
|
+
|
31
|
+
fd.add_geometry_field_definition(geometry_field_definition)
|
32
|
+
|
33
|
+
fd
|
34
|
+
end
|
35
|
+
|
36
|
+
let(:empty_feature_definition) do
|
37
|
+
OGR::FeatureDefinition.new('empty test FD')
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '.new' do
|
41
|
+
context 'param is not a FeatureDefinition or pointer to a FeatureDefinition' do
|
42
|
+
it 'raises an OGR::InvalidFeature' do
|
43
|
+
expect do
|
44
|
+
described_class.new('not a pointer')
|
45
|
+
end.to raise_exception OGR::InvalidFeature
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
subject(:feature) { described_class.new(feature_definition) }
|
51
|
+
|
52
|
+
describe '#clone' do
|
53
|
+
it 'returns a new Feature' do
|
54
|
+
expect(subject.clone).to be_a OGR::Feature
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#field_count' do
|
59
|
+
context 'no fields' do
|
60
|
+
subject { empty_feature_definition.field_count }
|
61
|
+
it { is_expected.to be_zero }
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'with fields' do
|
65
|
+
it 'returns the number of fields that have been added' do
|
66
|
+
expect(subject.field_count).to eq 8
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#set_field_integer + #field_as_integer' do
|
72
|
+
context 'to a valid index' do
|
73
|
+
it 'adds the field' do
|
74
|
+
subject.set_field_integer(0, 123)
|
75
|
+
expect(subject.field_as_integer(0)).to eq 123
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context 'to an invalid valid index' do
|
80
|
+
it 'adds the field' do
|
81
|
+
expect do
|
82
|
+
subject.set_field_integer(100, 123)
|
83
|
+
end.to raise_exception GDAL::Error
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context 'value is not an integer' do
|
88
|
+
it 'raises a TypeError' do
|
89
|
+
expect do
|
90
|
+
subject.set_field_integer(0, 'meow')
|
91
|
+
end.to raise_exception TypeError
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe '#set_field_integer_list + #field_as_integer_list' do
|
97
|
+
context 'to a valid index' do
|
98
|
+
it 'adds the integer list' do
|
99
|
+
subject.set_field_integer_list(1, [1, 2, 3])
|
100
|
+
expect(subject.field_as_integer_list(1)).to eq [1, 2, 3]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context 'to an invalid valid index' do
|
105
|
+
it 'adds the field' do
|
106
|
+
expect do
|
107
|
+
subject.set_field_integer_list(100, [1, 2, 3])
|
108
|
+
end.to raise_exception GDAL::Error
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
context 'value is not an array of integers' do
|
113
|
+
it 'raises a TypeError' do
|
114
|
+
expect do
|
115
|
+
subject.set_field_integer_list(1, ['meow'])
|
116
|
+
end.to raise_exception TypeError
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe '#set_field_double + #field_as_double' do
|
122
|
+
context 'to a valid index' do
|
123
|
+
it 'adds the field' do
|
124
|
+
subject.set_field_double(2, 123.123)
|
125
|
+
expect(subject.field_as_double(2)).to eq 123.123
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
context 'to an invalid valid index' do
|
130
|
+
it 'adds the field' do
|
131
|
+
expect do
|
132
|
+
subject.set_field_double(100, 123.123)
|
133
|
+
end.to raise_exception GDAL::Error
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
context 'value is not a float' do
|
138
|
+
it 'raises a TypeError' do
|
139
|
+
expect do
|
140
|
+
subject.set_field_double(2, 'meow')
|
141
|
+
end.to raise_exception TypeError
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
describe '#set_field_double_list + #field_as_double_list' do
|
147
|
+
context 'to a valid index' do
|
148
|
+
it 'adds the double list' do
|
149
|
+
subject.set_field_double_list(3, [1.1, 2.1, 3.1])
|
150
|
+
expect(subject.field_as_double_list(3)).to eq [1.1, 2.1, 3.1]
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
context 'to an invalid valid index' do
|
155
|
+
it 'adds the field' do
|
156
|
+
expect do
|
157
|
+
subject.set_field_double_list(100, [1.1, 2.1, 3.1])
|
158
|
+
end.to raise_exception GDAL::Error
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
context 'value is not an array of doubles' do
|
163
|
+
it 'raises a TypeError' do
|
164
|
+
expect do
|
165
|
+
subject.set_field_double_list(3, ['meow'])
|
166
|
+
end.to raise_exception TypeError
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
describe '#set_field_string + #field_as_string' do
|
172
|
+
context 'to a valid index' do
|
173
|
+
it 'adds the field' do
|
174
|
+
subject.set_field_string(4, 'test string')
|
175
|
+
expect(subject.field_as_string(4)).to eq 'test string'
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
context 'to an invalid valid index' do
|
180
|
+
it 'raises a GDAL::Error' do
|
181
|
+
expect do
|
182
|
+
subject.set_field_string(100, 'test string')
|
183
|
+
end.to raise_exception GDAL::Error
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
context 'value is not a string' do
|
188
|
+
it 'raises a TypeError' do
|
189
|
+
expect do
|
190
|
+
subject.set_field_string(4, 123)
|
191
|
+
end.to raise_exception TypeError
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
describe '#set_field_string_list' do
|
197
|
+
context 'to a valid index' do
|
198
|
+
it 'adds the string list' do
|
199
|
+
subject.set_field_string_list(5, %w[one two three])
|
200
|
+
expect(subject.field_as_string_list(5)).to eq %w[one two three]
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
context 'to an invalid valid index' do
|
205
|
+
it 'raises a GDAL::Error' do
|
206
|
+
expect do
|
207
|
+
subject.set_field_string_list(100, [1, 2, 3])
|
208
|
+
end.to raise_exception GDAL::Error, 'Invalid index : 100'
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
context 'value is not an array of strings' do
|
213
|
+
it 'returns an empty Array' do
|
214
|
+
subject.set_field_integer_list(5, [1, 2, 3])
|
215
|
+
expect(subject.field_as_string_list(5)).to eq []
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
describe '#set_field_raw + #field_as_raw' do
|
221
|
+
let(:integer_field_struct) do
|
222
|
+
f = FFI::OGR::Field.new
|
223
|
+
f[:integer] = 1
|
224
|
+
f
|
225
|
+
end
|
226
|
+
|
227
|
+
let(:integer_list_field_struct) do
|
228
|
+
f = FFI::OGR::Field.new
|
229
|
+
f[:integer_list] = [1, 2, 3]
|
230
|
+
f
|
231
|
+
end
|
232
|
+
|
233
|
+
context 'to a valid index' do
|
234
|
+
it 'adds the field' do
|
235
|
+
subject.set_field_raw(0, integer_field_struct)
|
236
|
+
expect(subject.field_as_integer(0)).to eq 1
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
context 'to an invalid valid index' do
|
241
|
+
it 'adds the field' do
|
242
|
+
expect do
|
243
|
+
subject.set_field_raw(100, integer_field_struct)
|
244
|
+
end.to raise_exception GDAL::Error
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
context 'raw field is not of the given type' do
|
249
|
+
let(:int_feature_definition) do
|
250
|
+
fd = OGR::FeatureDefinition.new('test FD')
|
251
|
+
fd.add_field_definition(integer_field) # 0
|
252
|
+
|
253
|
+
fd
|
254
|
+
end
|
255
|
+
|
256
|
+
subject { described_class.new(int_feature_definition) }
|
257
|
+
|
258
|
+
it 'raises a TypeError' do
|
259
|
+
expect do
|
260
|
+
subject.set_field_raw(0, integer_list_field_struct)
|
261
|
+
end.to raise_exception TypeError
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
describe '#set_field_binary + #field_as_binary' do
|
267
|
+
context 'to a valid index' do
|
268
|
+
it 'adds the field' do
|
269
|
+
subject.set_field_binary(6, [65, 66, 67, 68, 69].pack('C*'))
|
270
|
+
expect(subject.field_as_binary(6)).to eq [65, 66, 67, 68, 69]
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
context 'to an invalid valid index' do
|
275
|
+
it 'adds the field' do
|
276
|
+
expect do
|
277
|
+
subject.set_field_binary(100, 123)
|
278
|
+
end.to raise_exception TypeError
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
context 'value is not binary' do
|
283
|
+
it 'raises a TypeError' do
|
284
|
+
expect do
|
285
|
+
subject.set_field_binary(6, 123)
|
286
|
+
end.to raise_exception TypeError
|
287
|
+
end
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
describe '#set_field_date_time + #field_as_date_time' do
|
292
|
+
let(:date_time) do
|
293
|
+
DateTime.now
|
294
|
+
end
|
295
|
+
|
296
|
+
context 'to a valid index' do
|
297
|
+
it 'adds the field' do
|
298
|
+
subject.set_field_date_time(7, date_time)
|
299
|
+
expect(subject.field_as_date_time(7).httpdate).to eq date_time.httpdate
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
context 'to an invalid valid index' do
|
304
|
+
it 'adds the field' do
|
305
|
+
expect do
|
306
|
+
subject.set_field_binary(100, 123)
|
307
|
+
end.to raise_exception TypeError
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
context 'value is not binary' do
|
312
|
+
it 'raises a TypeError' do
|
313
|
+
expect do
|
314
|
+
subject.set_field_binary(6, 123)
|
315
|
+
end.to raise_exception TypeError
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
describe '#field_definition' do
|
320
|
+
context 'field exists at the given index' do
|
321
|
+
it 'returns the FieldDefinition' do
|
322
|
+
expect(subject.field_definition(0)).to be_a OGR::FieldDefinition
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
context 'field does not exist at the given index' do
|
327
|
+
it 'raises a GDAL::Error' do
|
328
|
+
expect { subject.field_definition(123) }.to raise_exception GDAL::Error
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
describe 'field_index' do
|
334
|
+
context 'field exists with the given name' do
|
335
|
+
it "returns the FieldDefinition's index" do
|
336
|
+
expect(subject.field_index('test binary field')).to eq 6
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
context 'field does not exist with the given name' do
|
341
|
+
it 'returns nil' do
|
342
|
+
expect(subject.field_index('asdfadsasd')).to be_nil
|
343
|
+
end
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
describe '#field_set?' do
|
348
|
+
context 'field at the given index is not set' do
|
349
|
+
it 'returns false' do
|
350
|
+
expect(subject.field_set?(0)).to eq false
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
context 'field at the given index is set' do
|
355
|
+
before do
|
356
|
+
subject.set_field_string(0, 'Pants')
|
357
|
+
end
|
358
|
+
|
359
|
+
it 'returns true' do
|
360
|
+
expect(subject.field_set?(0)).to eq true
|
361
|
+
end
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
describe '#unset_field + #field_set?' do
|
366
|
+
context 'field is set' do
|
367
|
+
it 'removes the field' do
|
368
|
+
subject.unset_field(0)
|
369
|
+
expect(subject.field_set?(0)).to eq false
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
context 'field is not set' do
|
374
|
+
it 'raises a GDAL::Error' do
|
375
|
+
expect { subject.unset_field(100) }.to raise_exception GDAL::Error
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|
379
|
+
end
|