rgeo 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/ext/geos_c_impl/extconf.rb +1 -0
  3. data/ext/geos_c_impl/factory.c +10 -1
  4. data/ext/geos_c_impl/geometry.c +25 -3
  5. data/ext/geos_c_impl/line_string.c +1 -12
  6. data/ext/geos_c_impl/polygon.c +0 -3
  7. data/ext/geos_c_impl/preface.h +3 -0
  8. data/lib/rgeo.rb +0 -1
  9. data/lib/rgeo/feature/geometry.rb +17 -0
  10. data/lib/rgeo/feature/types.rb +4 -4
  11. data/lib/rgeo/geographic/projected_feature_methods.rb +1 -22
  12. data/lib/rgeo/geos/ffi_feature_methods.rb +5 -0
  13. data/lib/rgeo/geos/utils.rb +2 -0
  14. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +1 -0
  15. data/lib/rgeo/version.rb +1 -1
  16. metadata +11 -171
  17. data/lib/rgeo/yaml.rb +0 -23
  18. data/test/cartesian_analysis_test.rb +0 -65
  19. data/test/cartesian_bbox_test.rb +0 -123
  20. data/test/common/factory_tests.rb +0 -78
  21. data/test/common/geometry_collection_tests.rb +0 -237
  22. data/test/common/line_string_tests.rb +0 -330
  23. data/test/common/multi_line_string_tests.rb +0 -182
  24. data/test/common/multi_point_tests.rb +0 -200
  25. data/test/common/multi_polygon_tests.rb +0 -191
  26. data/test/common/point_tests.rb +0 -370
  27. data/test/common/polygon_tests.rb +0 -228
  28. data/test/coord_sys/ogc_cs_test.rb +0 -342
  29. data/test/coord_sys/proj4_srs_data_test.rb +0 -41
  30. data/test/coord_sys/proj4_test.rb +0 -150
  31. data/test/coord_sys/sr_org_test.rb +0 -32
  32. data/test/coord_sys/url_reader_test.rb +0 -42
  33. data/test/geos_capi/factory_test.rb +0 -31
  34. data/test/geos_capi/geometry_collection_test.rb +0 -24
  35. data/test/geos_capi/line_string_test.rb +0 -24
  36. data/test/geos_capi/misc_test.rb +0 -116
  37. data/test/geos_capi/multi_line_string_test.rb +0 -24
  38. data/test/geos_capi/multi_point_test.rb +0 -24
  39. data/test/geos_capi/multi_polygon_test.rb +0 -39
  40. data/test/geos_capi/parsing_unparsing_test.rb +0 -40
  41. data/test/geos_capi/point_test.rb +0 -72
  42. data/test/geos_capi/polygon_test.rb +0 -154
  43. data/test/geos_capi/zmfactory_test.rb +0 -57
  44. data/test/geos_ffi/factory_test.rb +0 -31
  45. data/test/geos_ffi/geometry_collection_test.rb +0 -24
  46. data/test/geos_ffi/line_string_test.rb +0 -24
  47. data/test/geos_ffi/misc_test.rb +0 -63
  48. data/test/geos_ffi/multi_line_string_test.rb +0 -24
  49. data/test/geos_ffi/multi_point_test.rb +0 -24
  50. data/test/geos_ffi/multi_polygon_test.rb +0 -33
  51. data/test/geos_ffi/parsing_unparsing_test.rb +0 -41
  52. data/test/geos_ffi/point_test.rb +0 -77
  53. data/test/geos_ffi/polygon_test.rb +0 -46
  54. data/test/geos_ffi/zmfactory_test.rb +0 -58
  55. data/test/mixins_test.rb +0 -141
  56. data/test/oneoff_test.rb +0 -26
  57. data/test/projected_geographic/factory_test.rb +0 -25
  58. data/test/projected_geographic/geometry_collection_test.rb +0 -24
  59. data/test/projected_geographic/line_string_test.rb +0 -24
  60. data/test/projected_geographic/multi_line_string_test.rb +0 -26
  61. data/test/projected_geographic/multi_point_test.rb +0 -30
  62. data/test/projected_geographic/multi_polygon_test.rb +0 -25
  63. data/test/projected_geographic/point_test.rb +0 -51
  64. data/test/projected_geographic/polygon_test.rb +0 -24
  65. data/test/simple_cartesian/calculations_test.rb +0 -99
  66. data/test/simple_cartesian/factory_test.rb +0 -27
  67. data/test/simple_cartesian/geometry_collection_test.rb +0 -30
  68. data/test/simple_cartesian/line_string_test.rb +0 -31
  69. data/test/simple_cartesian/multi_line_string_test.rb +0 -28
  70. data/test/simple_cartesian/multi_point_test.rb +0 -31
  71. data/test/simple_cartesian/multi_polygon_test.rb +0 -31
  72. data/test/simple_cartesian/point_test.rb +0 -50
  73. data/test/simple_cartesian/polygon_test.rb +0 -28
  74. data/test/simple_mercator/factory_test.rb +0 -25
  75. data/test/simple_mercator/geometry_collection_test.rb +0 -24
  76. data/test/simple_mercator/line_string_test.rb +0 -24
  77. data/test/simple_mercator/multi_line_string_test.rb +0 -26
  78. data/test/simple_mercator/multi_point_test.rb +0 -29
  79. data/test/simple_mercator/multi_polygon_test.rb +0 -25
  80. data/test/simple_mercator/point_test.rb +0 -55
  81. data/test/simple_mercator/polygon_test.rb +0 -24
  82. data/test/simple_mercator/window_test.rb +0 -173
  83. data/test/spherical_geographic/calculations_test.rb +0 -167
  84. data/test/spherical_geographic/factory_test.rb +0 -27
  85. data/test/spherical_geographic/geometry_collection_test.rb +0 -31
  86. data/test/spherical_geographic/line_string_test.rb +0 -31
  87. data/test/spherical_geographic/multi_line_string_test.rb +0 -29
  88. data/test/spherical_geographic/multi_point_test.rb +0 -31
  89. data/test/spherical_geographic/multi_polygon_test.rb +0 -31
  90. data/test/spherical_geographic/point_test.rb +0 -78
  91. data/test/spherical_geographic/polygon_test.rb +0 -28
  92. data/test/types_test.rb +0 -42
  93. data/test/wkrep/wkb_generator_test.rb +0 -185
  94. data/test/wkrep/wkb_parser_test.rb +0 -293
  95. data/test/wkrep/wkt_generator_test.rb +0 -294
  96. data/test/wkrep/wkt_parser_test.rb +0 -412
@@ -1,24 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the GEOS geometry collection implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/geometry_collection_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module GeosFFI # :nodoc:
15
- class TestGeometryCollection < ::Test::Unit::TestCase # :nodoc:
16
- def create_factory
17
- ::RGeo::Geos.factory(native_interface: :ffi)
18
- end
19
-
20
- include ::RGeo::Tests::Common::GeometryCollectionTests
21
- end
22
- end
23
- end
24
- end if ::RGeo::Geos.ffi_supported?
@@ -1,24 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the GEOS line string implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/line_string_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module GeosFFI # :nodoc:
15
- class TestLineString < ::Test::Unit::TestCase # :nodoc:
16
- def setup
17
- @factory = ::RGeo::Geos.factory(native_interface: :ffi)
18
- end
19
-
20
- include ::RGeo::Tests::Common::LineStringTests
21
- end
22
- end
23
- end
24
- end if ::RGeo::Geos.ffi_supported?
@@ -1,63 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for miscellaneous GEOS stuff
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- module RGeo
11
- module Tests # :nodoc:
12
- module GeosFFI # :nodoc:
13
- class TestMisc < ::Test::Unit::TestCase # :nodoc:
14
- def setup
15
- @factory = ::RGeo::Geos.factory(srid: 4326, native_interface: :ffi)
16
- end
17
-
18
- def test_empty_geometries_equal
19
- geom1_ = @factory.collection([])
20
- geom2_ = @factory.line_string([])
21
- assert(!geom1_.eql?(geom2_))
22
- assert(geom1_.equals?(geom2_))
23
- end
24
-
25
- def test_prepare
26
- p1_ = @factory.point(1, 2)
27
- p2_ = @factory.point(3, 4)
28
- p3_ = @factory.point(5, 2)
29
- polygon_ = @factory.polygon(@factory.linear_ring([p1_, p2_, p3_, p1_]))
30
- assert_equal(false, polygon_.prepared?)
31
- polygon_.prepare!
32
- assert_equal(true, polygon_.prepared?)
33
- end
34
-
35
- def test_auto_prepare
36
- p1_ = @factory.point(1, 2)
37
- p2_ = @factory.point(3, 4)
38
- p3_ = @factory.point(5, 2)
39
- polygon_ = @factory.polygon(@factory.linear_ring([p1_, p2_, p3_, p1_]))
40
- assert_equal(false, polygon_.prepared?)
41
- polygon_.intersects?(p1_)
42
- assert_equal(false, polygon_.prepared?)
43
- polygon_.intersects?(p2_)
44
- assert_equal(true, polygon_.prepared?)
45
-
46
- factory_no_auto_prepare_ = ::RGeo::Geos.factory(srid: 4326,
47
- native_interface: :ffi, auto_prepare: :disabled)
48
- polygon2_ = factory_no_auto_prepare_.polygon(
49
- factory_no_auto_prepare_.linear_ring([p1_, p2_, p3_, p1_]))
50
- assert_equal(false, polygon2_.prepared?)
51
- polygon2_.intersects?(p1_)
52
- assert_equal(false, polygon2_.prepared?)
53
- polygon2_.intersects?(p2_)
54
- assert_equal(false, polygon2_.prepared?)
55
- end
56
- end
57
- end
58
- end
59
- end if ::RGeo::Geos.ffi_supported?
60
-
61
- unless ::RGeo::Geos.ffi_supported?
62
- puts "WARNING: FFI-GEOS support not available. Related tests skipped."
63
- end
@@ -1,24 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the GEOS multi line string implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/multi_line_string_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module GeosFFI # :nodoc:
15
- class TestMultiLineString < ::Test::Unit::TestCase # :nodoc:
16
- def create_factory
17
- ::RGeo::Geos.factory(native_interface: :ffi)
18
- end
19
-
20
- include ::RGeo::Tests::Common::MultiLineStringTests
21
- end
22
- end
23
- end
24
- end if ::RGeo::Geos.ffi_supported?
@@ -1,24 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the GEOS multi point implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/multi_point_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module GeosFFI # :nodoc:
15
- class TestMultiPoint < ::Test::Unit::TestCase # :nodoc:
16
- def create_factory(opts_ = {})
17
- ::RGeo::Geos.factory(opts_.merge(native_interface: :ffi))
18
- end
19
-
20
- include ::RGeo::Tests::Common::MultiPointTests
21
- end
22
- end
23
- end
24
- end if ::RGeo::Geos.ffi_supported?
@@ -1,33 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the GEOS multi polygon implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/multi_polygon_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module GeosFFI # :nodoc:
15
- class TestMultiPolygon < ::Test::Unit::TestCase # :nodoc:
16
- def create_factories
17
- @factory = ::RGeo::Geos.factory(native_interface: :ffi)
18
- @lenient_factory = ::RGeo::Geos.factory(lenient_multi_polygon_assertions: true,
19
- native_interface: :ffi)
20
- end
21
-
22
- include ::RGeo::Tests::Common::MultiPolygonTests
23
-
24
- # Centroid of an empty should return an empty collection
25
- # rather than throw a weird exception out of ffi-geos
26
-
27
- def test_empty_centroid
28
- assert_equal(@factory.collection([]), @factory.multi_polygon([]).centroid)
29
- end
30
- end
31
- end
32
- end
33
- end if ::RGeo::Geos.ffi_supported?
@@ -1,41 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the GEOS point implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- module RGeo
11
- module Tests # :nodoc:
12
- module GeosFFI # :nodoc:
13
- class TestParsingUnparsing < ::Test::Unit::TestCase # :nodoc:
14
- def test_wkt_generator_default_floating_point
15
- # Bug report GH-4
16
- factory_ = ::RGeo::Geos.factory(native_interface: :ffi)
17
- point_ = factory_.point(111.99, -40.37)
18
- assert_equal("POINT (111.99 -40.37)", point_.as_text)
19
- end
20
-
21
- def test_wkt_generator_downcase
22
- factory_ = ::RGeo::Geos.factory(wkt_generator: { convert_case: :lower },
23
- native_interface: :ffi)
24
- point_ = factory_.point(1, 1)
25
- assert_equal("point (1.0 1.0)", point_.as_text)
26
- end
27
-
28
- def test_wkt_generator_geos
29
- factory_ = ::RGeo::Geos.factory(wkt_generator: :geos, native_interface: :ffi)
30
- point_ = factory_.point(1, 1)
31
- assert_equal("POINT (1.0000000000000000 1.0000000000000000)", point_.as_text)
32
- end
33
-
34
- def test_wkt_parser_default_with_non_geosable_input
35
- factory_ = ::RGeo::Geos.factory(native_interface: :ffi)
36
- assert_not_nil(factory_.parse_wkt("Point (1 1)"))
37
- end
38
- end
39
- end
40
- end
41
- end if ::RGeo::Geos.ffi_supported?
@@ -1,77 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the GEOS point implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/point_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module GeosFFI # :nodoc:
15
- class TestPoint < ::Test::Unit::TestCase # :nodoc:
16
- def setup
17
- @factory = ::RGeo::Geos.factory(native_interface: :ffi, buffer_resolution: 8)
18
- @zfactory = ::RGeo::Geos.factory(has_z_coordinate: true, native_interface: :ffi)
19
- @mfactory = ::RGeo::Geos.factory(has_m_coordinate: true, native_interface: :ffi)
20
- @zmfactory = ::RGeo::Geos.factory(has_z_coordinate: true, has_m_coordinate: true,
21
- native_interface: :ffi)
22
- end
23
-
24
- include ::RGeo::Tests::Common::PointTests
25
-
26
- # TEMP until ffi-geos 0.0.5 is released
27
- undef_method :test_buffer
28
- # END_TEMP
29
-
30
- def test_is_geos
31
- point_ = @factory.point(21, -22)
32
- assert_equal(true, ::RGeo::Geos.is_geos?(point_))
33
- assert_equal(false, ::RGeo::Geos.is_capi_geos?(point_))
34
- assert_equal(true, ::RGeo::Geos.is_ffi_geos?(point_))
35
- point2_ = @zmfactory.point(21, -22, 0, 0)
36
- assert_equal(true, ::RGeo::Geos.is_geos?(point2_))
37
- assert_equal(false, ::RGeo::Geos.is_capi_geos?(point2_))
38
- assert_equal(true, ::RGeo::Geos.is_ffi_geos?(point2_))
39
- end
40
-
41
- def test_has_no_projection
42
- point_ = @factory.point(21, -22)
43
- assert(!point_.respond_to?(:projection))
44
- end
45
-
46
- def test_srid
47
- point_ = @factory.point(11, 12)
48
- assert_equal(0, point_.srid)
49
- end
50
-
51
- def test_distance
52
- point1_ = @factory.point(11, 12)
53
- point2_ = @factory.point(11, 12)
54
- point3_ = @factory.point(13, 12)
55
- assert_equal(0, point1_.distance(point2_))
56
- assert_equal(2, point1_.distance(point3_))
57
- end
58
-
59
- if defined?(::Encoding)
60
-
61
- def test_as_text_encoding
62
- factory_ = ::RGeo::Geos.factory(native_interface: :ffi, wkt_generator: :geos)
63
- point_ = factory_.point(11, 12)
64
- assert_equal(::Encoding::US_ASCII, point_.as_text.encoding)
65
- end
66
-
67
- def test_as_binary_encoding
68
- factory_ = ::RGeo::Geos.factory(native_interface: :ffi, wkb_generator: :geos)
69
- point_ = factory_.point(11, 12)
70
- assert_equal(::Encoding::ASCII_8BIT, point_.as_binary.encoding)
71
- end
72
-
73
- end
74
- end
75
- end
76
- end
77
- end if ::RGeo::Geos.ffi_supported?
@@ -1,46 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the GEOS polygon implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/polygon_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module GeosFFI # :nodoc:
15
- class TestPolygon < ::Test::Unit::TestCase # :nodoc:
16
- def setup
17
- @factory = ::RGeo::Geos.factory(native_interface: :ffi)
18
- end
19
-
20
- include ::RGeo::Tests::Common::PolygonTests
21
-
22
- def test_intersection
23
- point1_ = @factory.point(0, 0)
24
- point2_ = @factory.point(0, 2)
25
- point3_ = @factory.point(2, 2)
26
- point4_ = @factory.point(2, 0)
27
- poly1_ = @factory.polygon(@factory.linear_ring([point1_, point2_, point3_, point4_]))
28
- poly2_ = @factory.polygon(@factory.linear_ring([point1_, point2_, point4_]))
29
- poly3_ = poly1_.intersection(poly2_)
30
- assert_equal(poly2_, poly3_)
31
- end
32
-
33
- def test_union
34
- point1_ = @factory.point(0, 0)
35
- point2_ = @factory.point(0, 2)
36
- point3_ = @factory.point(2, 2)
37
- point4_ = @factory.point(2, 0)
38
- poly1_ = @factory.polygon(@factory.linear_ring([point1_, point2_, point3_, point4_]))
39
- poly2_ = @factory.polygon(@factory.linear_ring([point1_, point2_, point4_]))
40
- poly3_ = poly1_.union(poly2_)
41
- assert_equal(poly1_, poly3_)
42
- end
43
- end
44
- end
45
- end
46
- end if ::RGeo::Geos.ffi_supported?
@@ -1,58 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for the GEOS point implementation
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- require ::File.expand_path("../common/factory_tests.rb", ::File.dirname(__FILE__))
11
-
12
- module RGeo
13
- module Tests # :nodoc:
14
- module GeosFFI # :nodoc:
15
- class TestZMFactory < ::Test::Unit::TestCase # :nodoc:
16
- def setup
17
- @factory = ::RGeo::Geos.factory(has_z_coordinate: true, has_m_coordinate: true,
18
- srid: 1000, buffer_resolution: 2, native_interface: :ffi)
19
- @srid = 1000
20
- end
21
-
22
- include ::RGeo::Tests::Common::FactoryTests
23
-
24
- def test_is_geos_factory
25
- assert_equal(true, ::RGeo::Geos.is_geos?(@factory))
26
- assert_equal(false, ::RGeo::Geos.is_capi_geos?(@factory))
27
- assert_equal(true, ::RGeo::Geos.is_ffi_geos?(@factory))
28
- end
29
-
30
- def test_factory_parts
31
- assert_equal(1000, @factory.srid)
32
- assert_equal(1000, @factory.z_factory.srid)
33
- assert_equal(1000, @factory.m_factory.srid)
34
- assert_equal(2, @factory.buffer_resolution)
35
- assert_equal(2, @factory.z_factory.buffer_resolution)
36
- assert_equal(2, @factory.m_factory.buffer_resolution)
37
- assert(@factory.property(:has_z_coordinate))
38
- assert(@factory.property(:has_m_coordinate))
39
- assert(@factory.z_factory.property(:has_z_coordinate))
40
- assert(!@factory.z_factory.property(:has_m_coordinate))
41
- assert(!@factory.m_factory.property(:has_z_coordinate))
42
- assert(@factory.m_factory.property(:has_m_coordinate))
43
- end
44
-
45
- def test_4d_point
46
- point_ = @factory.point(1, 2, 3, 4)
47
- assert_equal(Feature::Point, point_.geometry_type)
48
- assert_equal(3, point_.z)
49
- assert_equal(4, point_.m)
50
- assert_equal(3, point_.z_geometry.z)
51
- assert_nil(point_.z_geometry.m)
52
- assert_nil(point_.m_geometry.z)
53
- assert_equal(4, point_.m_geometry.m)
54
- end
55
- end
56
- end
57
- end
58
- end if ::RGeo::Geos.ffi_supported?
data/test/mixins_test.rb DELETED
@@ -1,141 +0,0 @@
1
- # -----------------------------------------------------------------------------
2
- #
3
- # Tests for mixin system
4
- #
5
- # -----------------------------------------------------------------------------
6
-
7
- require "test/unit"
8
- require "rgeo"
9
-
10
- module RGeo
11
- module Tests # :nodoc:
12
- class TestMixins < ::Test::Unit::TestCase # :nodoc:
13
- module Mixin1 # :nodoc:
14
- def mixin1_method
15
- end
16
- end
17
-
18
- module Mixin2 # :nodoc:
19
- def mixin2_method
20
- end
21
- end
22
-
23
- ::RGeo::Feature::MixinCollection::GLOBAL.for_type(::RGeo::Feature::Point).add(Mixin1)
24
- ::RGeo::Feature::MixinCollection::GLOBAL.for_type(::RGeo::Feature::GeometryCollection).add(Mixin1)
25
- ::RGeo::Feature::MixinCollection::GLOBAL.for_type(::RGeo::Feature::MultiCurve).add(Mixin2)
26
-
27
- def test_basic_mixin_cartesian
28
- factory_ = ::RGeo::Cartesian.simple_factory
29
- assert_equal(::RGeo::Cartesian::PointImpl, factory_.point(1, 1).class)
30
- assert(factory_.point(1, 1).class.include?(Mixin1))
31
- assert(!factory_.point(1, 1).class.include?(Mixin2))
32
- assert(factory_.point(1, 1).respond_to?(:mixin1_method))
33
- assert(!factory_.point(1, 1).respond_to?(:mixin2_method))
34
- end
35
-
36
- def test_inherited_mixin_cartesian
37
- factory_ = ::RGeo::Cartesian.simple_factory
38
- assert(factory_.collection([]).class.include?(Mixin1))
39
- assert(!factory_.collection([]).class.include?(Mixin2))
40
- assert(factory_.collection([]).respond_to?(:mixin1_method))
41
- assert(!factory_.collection([]).respond_to?(:mixin2_method))
42
- assert(factory_.multi_line_string([]).class.include?(Mixin1))
43
- assert(factory_.multi_line_string([]).class.include?(Mixin2))
44
- assert(factory_.multi_line_string([]).respond_to?(:mixin1_method))
45
- assert(factory_.multi_line_string([]).respond_to?(:mixin2_method))
46
- end
47
-
48
- if ::RGeo::Geos.capi_supported?
49
-
50
- def test_basic_mixin_geos_capi
51
- factory_ = ::RGeo::Geos.factory(native_interface: :capi)
52
- assert_equal(::RGeo::Geos::CAPIPointImpl, factory_.point(1, 1).class)
53
- assert(factory_.point(1, 1).class.include?(Mixin1))
54
- assert(!factory_.point(1, 1).class.include?(Mixin2))
55
- assert(factory_.point(1, 1).respond_to?(:mixin1_method))
56
- assert(!factory_.point(1, 1).respond_to?(:mixin2_method))
57
- end
58
-
59
- def test_inherited_mixin_geos_capi
60
- factory_ = ::RGeo::Geos.factory(native_interface: :capi)
61
- assert(factory_.collection([]).class.include?(Mixin1))
62
- assert(!factory_.collection([]).class.include?(Mixin2))
63
- assert(factory_.collection([]).respond_to?(:mixin1_method))
64
- assert(!factory_.collection([]).respond_to?(:mixin2_method))
65
- assert(factory_.multi_line_string([]).class.include?(Mixin1))
66
- assert(factory_.multi_line_string([]).class.include?(Mixin2))
67
- assert(factory_.multi_line_string([]).respond_to?(:mixin1_method))
68
- assert(factory_.multi_line_string([]).respond_to?(:mixin2_method))
69
- end
70
-
71
- end
72
-
73
- if ::RGeo::Geos.ffi_supported?
74
-
75
- def test_basic_mixin_geos_ffi
76
- factory_ = ::RGeo::Geos.factory(native_interface: :ffi)
77
- assert_equal(::RGeo::Geos::FFIPointImpl, factory_.point(1, 1).class)
78
- assert(factory_.point(1, 1).class.include?(Mixin1))
79
- assert(!factory_.point(1, 1).class.include?(Mixin2))
80
- assert(factory_.point(1, 1).respond_to?(:mixin1_method))
81
- assert(!factory_.point(1, 1).respond_to?(:mixin2_method))
82
- end
83
-
84
- def test_inherited_mixin_geos_ffi
85
- factory_ = ::RGeo::Geos.factory(native_interface: :ffi)
86
- assert(factory_.collection([]).class.include?(Mixin1))
87
- assert(!factory_.collection([]).class.include?(Mixin2))
88
- assert(factory_.collection([]).respond_to?(:mixin1_method))
89
- assert(!factory_.collection([]).respond_to?(:mixin2_method))
90
- assert(factory_.multi_line_string([]).class.include?(Mixin1))
91
- assert(factory_.multi_line_string([]).class.include?(Mixin2))
92
- assert(factory_.multi_line_string([]).respond_to?(:mixin1_method))
93
- assert(factory_.multi_line_string([]).respond_to?(:mixin2_method))
94
- end
95
-
96
- end
97
-
98
- def test_basic_mixin_spherical
99
- factory_ = ::RGeo::Geographic.spherical_factory
100
- assert_equal(::RGeo::Geographic::SphericalPointImpl, factory_.point(1, 1).class)
101
- assert(factory_.point(1, 1).class.include?(Mixin1))
102
- assert(!factory_.point(1, 1).class.include?(Mixin2))
103
- assert(factory_.point(1, 1).respond_to?(:mixin1_method))
104
- assert(!factory_.point(1, 1).respond_to?(:mixin2_method))
105
- end
106
-
107
- def test_inherited_mixin_spherical
108
- factory_ = ::RGeo::Geographic.spherical_factory
109
- assert(factory_.collection([]).class.include?(Mixin1))
110
- assert(!factory_.collection([]).class.include?(Mixin2))
111
- assert(factory_.collection([]).respond_to?(:mixin1_method))
112
- assert(!factory_.collection([]).respond_to?(:mixin2_method))
113
- assert(factory_.multi_line_string([]).class.include?(Mixin1))
114
- assert(factory_.multi_line_string([]).class.include?(Mixin2))
115
- assert(factory_.multi_line_string([]).respond_to?(:mixin1_method))
116
- assert(factory_.multi_line_string([]).respond_to?(:mixin2_method))
117
- end
118
-
119
- def test_basic_mixin_simple_mercator
120
- factory_ = ::RGeo::Geographic.simple_mercator_factory
121
- assert_equal(::RGeo::Geographic::ProjectedPointImpl, factory_.point(1, 1).class)
122
- assert(factory_.point(1, 1).class.include?(Mixin1))
123
- assert(!factory_.point(1, 1).class.include?(Mixin2))
124
- assert(factory_.point(1, 1).respond_to?(:mixin1_method))
125
- assert(!factory_.point(1, 1).respond_to?(:mixin2_method))
126
- end
127
-
128
- def test_inherited_mixin_simple_mercator
129
- factory_ = ::RGeo::Geographic.simple_mercator_factory
130
- assert(factory_.collection([]).class.include?(Mixin1))
131
- assert(!factory_.collection([]).class.include?(Mixin2))
132
- assert(factory_.collection([]).respond_to?(:mixin1_method))
133
- assert(!factory_.collection([]).respond_to?(:mixin2_method))
134
- assert(factory_.multi_line_string([]).class.include?(Mixin1))
135
- assert(factory_.multi_line_string([]).class.include?(Mixin2))
136
- assert(factory_.multi_line_string([]).respond_to?(:mixin1_method))
137
- assert(factory_.multi_line_string([]).respond_to?(:mixin2_method))
138
- end
139
- end
140
- end
141
- end