init
This commit is contained in:
commit
116abafc09
58 changed files with 5749 additions and 0 deletions
37
tests/testthat/test-rules.R
Normal file
37
tests/testthat/test-rules.R
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
test_that("pmPaintRule creates correct structure", {
|
||||
sym <- pmPolygonSymbolizer(fill = "blue")
|
||||
rule <- pmPaintRule("water", sym)
|
||||
|
||||
expect_equal(rule$dataLayer, "water")
|
||||
expect_equal(rule$symbolizer$type, "polygon")
|
||||
})
|
||||
|
||||
test_that("pmPaintRule handles zoom constraints", {
|
||||
sym <- pmPolygonSymbolizer(fill = "gray")
|
||||
rule <- pmPaintRule("buildings", sym, minzoom = 14, maxzoom = 18)
|
||||
|
||||
expect_equal(rule$minzoom, 14)
|
||||
expect_equal(rule$maxzoom, 18)
|
||||
})
|
||||
|
||||
test_that("pmPaintRule handles filters", {
|
||||
sym <- pmLineSymbolizer(color = "orange")
|
||||
rule <- pmPaintRule("roads", sym, filter = "feature.props.kind === 'highway'")
|
||||
|
||||
expect_equal(rule$filter, "feature.props.kind === 'highway'")
|
||||
})
|
||||
|
||||
test_that("pmLabelRule creates correct structure", {
|
||||
sym <- pmCenteredTextSymbolizer(font = "14px Arial", fill = "black")
|
||||
rule <- pmLabelRule("places", sym)
|
||||
|
||||
expect_equal(rule$dataLayer, "places")
|
||||
expect_equal(rule$symbolizer$type, "centeredText")
|
||||
})
|
||||
|
||||
test_that("pmLabelRule handles filters", {
|
||||
sym <- pmCenteredTextSymbolizer(font = "14px Arial", fill = "black")
|
||||
rule <- pmLabelRule("places", sym, filter = "feature.props.kind === 'locality'")
|
||||
|
||||
expect_equal(rule$filter, "feature.props.kind === 'locality'")
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue