Skip to content
Snippets Groups Projects
Commit 2d595043 authored by Ruben Heinrich's avatar Ruben Heinrich
Browse files

[tests] Added a test for gml export

parent b8fad216
No related branches found
No related tags found
1 merge request!6Merge branch 7 fixed functionality into master
# test_that("export_gml works", {
#
# test_gml <- r2ogs6_gml(
# name = "test_geometry",
# points = tibble::tibble(
# x = c(0, 0, 0, 0, 1, 1, 1, 1),
# y = c(0, 0, 1, 1, 0, 0, 1, 1),
# z = c(0, 1, 1, 0, 0, 1, 1, 0),
# name = c("origin", "", "", "", "", "", "", "")
# ),
# polylines = list(list(name = "test", c(1, 2, 3, 4, 1))),
# surfaces = list(list(name = "test", c(1, 2, 3), c(2, 3, 4)))
# )
#
# path <- validate_is_dir_path(system.file("extdata/", package = "r2ogs6"))
#
# filename <- paste0(path, "test_geometry.gml")
#
# export_gml(test_gml, path)
#
# expect_equal(file.exists(filename), TRUE)
#
# #unlink(filename)
# })
test_that("export_gml works", {
# Get extdata directory and create folder for the test
extdata_path <- system.file("extdata/", package = "r2ogs6")
test_path <- paste0(extdata_path, "/export_gml_test")
dir.create(test_path)
# Define gml object
test_gml <- r2ogs6_gml(
name = "test_geometry",
points = tibble::tibble(
x = c(0, 0, 0, 0, 1, 1, 1, 1),
y = c(0, 0, 1, 1, 0, 0, 1, 1),
z = c(0, 1, 1, 0, 0, 1, 1, 0),
name = c("origin", "", "", "", "", "", "", "")
),
polylines = list(list(name = "test", c(1, 2, 3, 4, 1))),
surfaces = list(list(name = "test", c(1, 2, 3), c(2, 3, 4)))
)
gml_path <- paste0(test_path, "/test_geometry.gml")
# Now export it
export_gml(test_gml, gml_path)
expect_equal(file.exists(gml_path),
TRUE)
# Tidy up by deleting the folder we created
unlink(test_path, recursive = TRUE)
})
test_that("converting tibble to list works", {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment