|
1 | 1 | context("test-geom-osm.R")
|
2 | 2 |
|
3 |
| -test_that("geom_osm works as intended", { |
4 |
| - load_longlake_data() |
| 3 | +# max test length was exceeded on CRAN, so these tests are skipped |
| 4 | +if (identical(Sys.getenv("NOT_CRAN"), "true")) { |
5 | 5 |
|
6 |
| - expect_message( |
7 |
| - print( |
8 |
| - ggplot() + |
9 |
| - annotation_map_tile(zoom = 13, cachedir = system.file("rosm.cache", package = "ggspatial")) + |
10 |
| - geom_sf(data = longlake_waterdf, fill = NA, col = "grey50") + |
11 |
| - labs("This plot sould have they grey outlines line up with the OSM map beneath") |
12 |
| - ), |
13 |
| - "Zoom: 13" |
14 |
| - ) |
| 6 | + test_that("geom_osm works as intended", { |
| 7 | + load_longlake_data() |
15 | 8 |
|
16 |
| - expect_message( |
17 |
| - print( |
18 |
| - ggplot() + |
19 |
| - annotation_map_tile(zoom = 13, cachedir = system.file("rosm.cache", package = "ggspatial")) + |
20 |
| - geom_sf(data = longlake_waterdf, fill = NA, col = "grey50") + |
21 |
| - coord_sf(crs = 26920) + |
22 |
| - labs("This plot sould have they grey outlines line up with the OSM map beneath") |
23 |
| - ), |
24 |
| - "Zoom: 13" |
25 |
| - ) |
| 9 | + expect_message( |
| 10 | + print( |
| 11 | + ggplot() + |
| 12 | + annotation_map_tile(zoom = 13, cachedir = system.file("rosm.cache", package = "ggspatial")) + |
| 13 | + geom_sf(data = longlake_waterdf, fill = NA, col = "grey50") + |
| 14 | + labs("This plot sould have they grey outlines line up with the OSM map beneath") |
| 15 | + ), |
| 16 | + "Zoom: 13" |
| 17 | + ) |
26 | 18 |
|
27 |
| - expect_message( |
28 |
| - print( |
29 |
| - ggplot() + |
30 |
| - annotation_map_tile(zoom = 13, cachedir = system.file("rosm.cache", package = "ggspatial")) + |
31 |
| - geom_sf(data = longlake_waterdf, fill = NA, col = "grey50") + |
32 |
| - coord_sf(crs = 3857) + |
33 |
| - labs("This plot sould have they grey outlines line up with the OSM map beneath") |
34 |
| - ), |
35 |
| - "Zoom: 13" |
36 |
| - ) |
| 19 | + expect_message( |
| 20 | + print( |
| 21 | + ggplot() + |
| 22 | + annotation_map_tile(zoom = 13, cachedir = system.file("rosm.cache", package = "ggspatial")) + |
| 23 | + geom_sf(data = longlake_waterdf, fill = NA, col = "grey50") + |
| 24 | + coord_sf(crs = 26920) + |
| 25 | + labs("This plot sould have they grey outlines line up with the OSM map beneath") |
| 26 | + ), |
| 27 | + "Zoom: 13" |
| 28 | + ) |
37 | 29 |
|
38 |
| - expect_message( |
39 |
| - print( |
40 |
| - ggplot() + |
41 |
| - annotation_map_tile(zoom = 13, cachedir = system.file("rosm.cache", package = "ggspatial")) + |
42 |
| - geom_sf(data = longlake_waterdf, fill = NA, col = "grey50") + |
43 |
| - coord_sf(crs = 3978) + |
44 |
| - labs("This plot sould have they grey outlines line up with the OSM map beneath") |
45 |
| - ), |
46 |
| - "Zoom: 13" |
47 |
| - ) |
| 30 | + expect_message( |
| 31 | + print( |
| 32 | + ggplot() + |
| 33 | + annotation_map_tile(zoom = 13, cachedir = system.file("rosm.cache", package = "ggspatial")) + |
| 34 | + geom_sf(data = longlake_waterdf, fill = NA, col = "grey50") + |
| 35 | + coord_sf(crs = 3857) + |
| 36 | + labs("This plot sould have they grey outlines line up with the OSM map beneath") |
| 37 | + ), |
| 38 | + "Zoom: 13" |
| 39 | + ) |
48 | 40 |
|
49 |
| - expect_message( |
50 |
| - print( |
51 |
| - ggplot() + |
52 |
| - annotation_map_tile( |
53 |
| - data = tibble::tibble( |
54 |
| - type = c("osm", "stamenbw", "cartolight", "cartodark"), |
55 |
| - zoom = 13 |
56 |
| - ), |
57 |
| - cachedir = system.file("rosm.cache", package = "ggspatial"), |
58 |
| - mapping = aes(type = type, zoom = zoom) |
59 |
| - ) + |
60 |
| - geom_sf(data = longlake_waterdf, fill = NA, col = "grey50") + |
61 |
| - coord_sf(crs = 3857) + |
62 |
| - facet_wrap(~type) + |
63 |
| - labs(caption = "this should have the maptypes correspond to the backdrop") |
64 |
| - ), |
65 |
| - "Zoom: 13" |
66 |
| - ) |
| 41 | + expect_message( |
| 42 | + print( |
| 43 | + ggplot() + |
| 44 | + annotation_map_tile(zoom = 13, cachedir = system.file("rosm.cache", package = "ggspatial")) + |
| 45 | + geom_sf(data = longlake_waterdf, fill = NA, col = "grey50") + |
| 46 | + coord_sf(crs = 3978) + |
| 47 | + labs("This plot sould have they grey outlines line up with the OSM map beneath") |
| 48 | + ), |
| 49 | + "Zoom: 13" |
| 50 | + ) |
67 | 51 |
|
68 |
| -}) |
| 52 | + expect_message( |
| 53 | + print( |
| 54 | + ggplot() + |
| 55 | + annotation_map_tile( |
| 56 | + data = tibble::tibble( |
| 57 | + type = c("osm", "stamenbw", "cartolight", "cartodark"), |
| 58 | + zoom = 13 |
| 59 | + ), |
| 60 | + cachedir = system.file("rosm.cache", package = "ggspatial"), |
| 61 | + mapping = aes(type = type, zoom = zoom) |
| 62 | + ) + |
| 63 | + geom_sf(data = longlake_waterdf, fill = NA, col = "grey50") + |
| 64 | + coord_sf(crs = 3857) + |
| 65 | + facet_wrap(~type) + |
| 66 | + labs(caption = "this should have the maptypes correspond to the backdrop") |
| 67 | + ), |
| 68 | + "Zoom: 13" |
| 69 | + ) |
| 70 | + |
| 71 | + }) |
| 72 | + |
| 73 | +} |
0 commit comments