tests/testthat/test-qr.R

pos <- get_positions("CLQ", c(10, 50, 40))

test_that("we can create a QR matrix", {
  qr <- ggtrack:::make_qr('minimal test of QR')

  expect_type(qr, 'character')
  expect_equal(unique(qr[1,]), c('black','white'))
  expect_equal(dim(qr), c(25,25))

})


test_that("we can add a QR to a plot", {

  # this should only ever occur in ggtrack function
  qr <- ggplot(mapping = aes(x = 0:1, y = 1)) %>%
    add_qr('add to qr', justification = 1, height_tracker = 2, position = pos)

  expect_type(qr, 'list')
  expect_s3_class(qr, 'gg')
  expect_s3_class(qr, 'ggplot')

})




test_that("we can add a QR to a tracker", {
  qr <- make_tracker(add_git = FALSE) %>%
    add_qr('add to qr', justification = 1)

  expect_type(qr, 'list')
  expect_s3_class(qr, 'tracker')

})
mrjoh3/ggtrack documentation built on Dec. 21, 2021, 10:08 p.m.