Browse Source

switch to tinytest

master
boB Rudis 1 year ago
parent
commit
822c3de6a5
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
5 changed files with 34 additions and 48 deletions
  1. +9
    -20
      DESCRIPTION
  2. +20
    -0
      inst/tinytest/test_ggchicklet.R
  3. +0
    -3
      tests/test-all.R
  4. +0
    -25
      tests/testthat/test-ggchicklet.R
  5. +5
    -0
      tests/tinytest.R

+ 9
- 20
DESCRIPTION View File

@ -3,32 +3,21 @@ Type: Package
Title: Create 'Chicklet' (Rounded Segmented Column) Charts
Version: 0.1.0
Date: 2019-06-28
Authors@R: c(
person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-5670-2640")),
person("Antoine", "Bichat", role = "ctb")
)
Authors@R: c( person("Bob", "Rudis", email = "bob@rud.is", role =
c("aut", "cre"), comment = c(ORCID = "0000-0001-5670-2640")),
person("Antoine", "Bichat", role = "ctb") )
Maintainer: Bob Rudis <bob@rud.is>
Description: Sometimes it is useful to stylize column charts a bit more
than just bland rectangles. Methods are provided to create rounded
rectangle segmented column charts (i.e. 'chicklets').
than just bland rectangles. Methods are provided to create
rounded rectangle segmented column charts (i.e. 'chicklets').
URL: https://gitlab.com/hrbrmstr/ggchicklet
BugReports: https://gitlab.com/hrbrmstr/ggchicklet/issues
Encoding: UTF-8
License: MIT + file LICENSE
Suggests:
testthat,
covr,
hrbrthemes,
dplyr,
forcats,
knitr,
rmarkdown
Depends:
R (>= 3.2.0)
Imports:
ggplot2,
grid
Suggests: covr, hrbrthemes, dplyr, forcats, knitr, rmarkdown,
tinytest
Depends: R (>= 3.2.0)
Imports: ggplot2, grid
Roxygen: list(markdown = TRUE)
RoxygenNote: 6.1.1
VignetteBuilder: knitr

+ 20
- 0
inst/tinytest/test_ggchicklet.R View File

@ -0,0 +1,20 @@
library(ggplot2)
data("debates2019")
spkr_ordr <- aggregate(elapsed ~ speaker, data = debates2019, sum)
spkr_ordr <- spkr_ordr[order(spkr_ordr[["elapsed"]]),]
debates2019$speaker <- factor(debates2019$speaker, spkr_ordr$speaker)
ggplot(debates2019) +
geom_chicklet(aes(speaker, elapsed, group = timestamp, fill = topic)) -> gg
print(gg)
ggplot_build(gg) -> gb
ggplot_gtable(gb) -> gt
expect_true(all(c("GeomChicklet", "GeomRrect") %in% class(gb$plot$layers[[1]]$geom)))

+ 0
- 3
tests/test-all.R View File

@ -1,3 +0,0 @@
library(testthat)
test_check("ggchicklet")

+ 0
- 25
tests/testthat/test-ggchicklet.R View File

@ -1,25 +0,0 @@
library(ggplot2)
context("chicklet geoms are created properly")
test_that("chicklet geoms are created properly", {
data("debates2019")
spkr_ordr <- aggregate(elapsed ~ speaker, data = debates2019, sum)
spkr_ordr <- spkr_ordr[order(spkr_ordr[["elapsed"]]),]
debates2019$speaker <- factor(debates2019$speaker, spkr_ordr$speaker)
ggplot(debates2019) +
geom_chicklet(aes(speaker, elapsed, group = timestamp, fill = topic)) -> gg
print(gg)
ggplot_build(gg) -> gb
ggplot_gtable(gb) -> gt
expect_true(all(c("GeomChicklet", "GeomRrect") %in% class(gb$plot$layers[[1]]$geom)))
})

+ 5
- 0
tests/tinytest.R View File

@ -0,0 +1,5 @@
if ( requireNamespace("tinytest", quietly=TRUE) ){
tinytest::test_package("ggchicklet")
}

Loading…
Cancel
Save