56 lines
2 KiB
R
56 lines
2 KiB
R
test_that("pmPolygonSymbolizer creates correct structure", {
|
|
sym <- pmPolygonSymbolizer(fill = "blue")
|
|
expect_equal(sym$type, "polygon")
|
|
expect_equal(sym$options$fill, "blue")
|
|
})
|
|
|
|
test_that("pmPolygonSymbolizer handles optional parameters", {
|
|
sym <- pmPolygonSymbolizer(fill = "red", stroke = "black", width = 2, opacity = 0.5)
|
|
expect_equal(sym$options$fill, "red")
|
|
expect_equal(sym$options$stroke, "black")
|
|
expect_equal(sym$options$width, 2)
|
|
expect_equal(sym$options$opacity, 0.5)
|
|
})
|
|
|
|
test_that("pmLineSymbolizer creates correct structure", {
|
|
sym <- pmLineSymbolizer(color = "gray", width = 3)
|
|
expect_equal(sym$type, "line")
|
|
expect_equal(sym$options$color, "gray")
|
|
expect_equal(sym$options$width, 3)
|
|
})
|
|
|
|
test_that("pmLineSymbolizer handles dash patterns", {
|
|
sym <- pmLineSymbolizer(color = "black", dash = c(4, 2))
|
|
expect_equal(sym$options$dash, c(4, 2))
|
|
})
|
|
|
|
test_that("pmCircleSymbolizer creates correct structure", {
|
|
sym <- pmCircleSymbolizer(radius = 8, fill = "red")
|
|
expect_equal(sym$type, "circle")
|
|
expect_equal(sym$options$radius, 8)
|
|
expect_equal(sym$options$fill, "red")
|
|
})
|
|
|
|
test_that("pmCenteredTextSymbolizer creates correct structure", {
|
|
sym <- pmCenteredTextSymbolizer(font = "14px Arial", fill = "black")
|
|
expect_equal(sym$type, "centeredText")
|
|
expect_equal(sym$options$font, "14px Arial")
|
|
expect_equal(sym$options$fill, "black")
|
|
})
|
|
|
|
test_that("pmCenteredTextSymbolizer handles lineHeight", {
|
|
sym <- pmCenteredTextSymbolizer(font = "12px sans-serif", lineHeight = 1.5)
|
|
expect_equal(sym$options$lineHeight, 1.5)
|
|
})
|
|
|
|
test_that("pmLineLabelSymbolizer creates correct structure", {
|
|
sym <- pmLineLabelSymbolizer(font = "11px Arial", fill = "#333")
|
|
expect_equal(sym$type, "lineLabel")
|
|
expect_equal(sym$options$font, "11px Arial")
|
|
})
|
|
|
|
test_that("pmShieldSymbolizer creates correct structure", {
|
|
sym <- pmShieldSymbolizer(font = "10px Arial", background = "yellow")
|
|
expect_equal(sym$type, "shield")
|
|
expect_equal(sym$options$background, "yellow")
|
|
})
|