Skip to content

Commit

Permalink
updated tests to reflect recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
16EAGLE committed Apr 16, 2024
1 parent fe59658 commit 25c6232
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Title: Accessing Spatial Basemaps in R
Version: 0.0.7
Depends:
R (>= 3.5.0)
Date: 2024-04-05
Date: 2024-04-16
Authors@R: person("Jakob", "Schwalb-Willmann", email = "[email protected]",
role = c("aut", "cre"), comment = c(ORCID = "0000-0003-2665-1509"))
Description: A lightweight package to access spatial basemaps from open sources such as 'OpenStreetMap', 'Carto', 'Mapbox' and others in R.
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
***

## basemaps 0.0.6
## basemaps 0.0.7
Minor improvements

**Changes:**
Expand Down
2 changes: 1 addition & 1 deletion man/basemap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions tests/testthat/test-basemap.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,24 @@ test_that("basemap()", {

# test hiddena arguments
expect_is(basemap(ext, no_transform = T, no_crop = T, verbose = F, class = "terra"), "SpatRaster")
expect_is(basemap(ext, no_transform = T, no_crop = T, verbose = F, class = "terra", col = topo.colors(22)), "SpatRaster")
expect_is(basemap(ext, no_transform = T, no_crop = T, verbose = F, class = "png", dpi = 100, browse = F), "character")

# test warning with false map_dir
expect_warning(basemap_plot(ext, map_dir = "/this/is/nonsense/", verbose = F))

# test ext error
expect_error(basemap())

# test no map_token error mapbox
expect_error(basemap(ext, map_service = "mapbox", map_type = "streets", verbose = F))
expect_error(basemap(ext, map_service = "osm_thunderforest", map_type = "cycle", verbose = F))
expect_error(basemap(ext, map_service = "osm_stamen", map_type = "toner", verbose = F))
expect_error(basemap(ext, map_service = "osm_stadia", map_type = "alidade_smooth", verbose = F))

# test false map_token error mapbox
expect_error(basemap(ext, map_service = "mapbox", map_type = "streets", map_token = "this_is_nonsense", verbose = F))

# test ext warning on different CRS
expect_warning(basemap(ext_eur, map_dir = map_dir, verbose = T))

Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ context("plot")
test_that("gg_raster()", {
map <- basemap_raster(ext, map_dir = map_dir, verbose = F)
expect_is(gg_raster(map, r_type = "RGB"), "gg")
expect_is(gg_raster(map, r_type = "RGB", maxpixels = 500000, alpha = 0.5, interpolate = FALSE, add_coord = F), "gg")

expect_is(gg_raster(map, r_type = "RGB", gglayer = F), "gg")

map <- basemap_stars(ext, map_dir = map_dir, verbose = F)
Expand Down

0 comments on commit 25c6232

Please sign in to comment.