From 7e2b883d9068bdf1456b9b31c47fc2ac0d7bd4a1 Mon Sep 17 00:00:00 2001 From: chrisholbrook Date: Fri, 19 Jan 2024 18:07:00 -0500 Subject: [PATCH] update expected vals in test-make_frames.r and doc in NEWS.md --- NEWS.md | 6 ++++-- tests/testthat/test-make_frames.r | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/NEWS.md b/NEWS.md index 74c2b51a..f42b5b85 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,9 +5,11 @@ ### Bug fixes and minor changes -- Add test for various inputs of `background_xlim`, `background_ylim`, and - `bg_map` to function `make_frames`. +- Fix bug introduced in glatos 0.7.0 where x and y limits were switched + when `bg_map` was supplied. + - Add test for various inputs of `background_xlim`, `background_ylim`, and + `bg_map` to function `make_frames`. ---- diff --git a/tests/testthat/test-make_frames.r b/tests/testthat/test-make_frames.r index fbb6dd2f..9de97f57 100644 --- a/tests/testthat/test-make_frames.r +++ b/tests/testthat/test-make_frames.r @@ -9,15 +9,14 @@ pos1 <- structure(list(animal_id = c("153", "153", "153", "153"), -83.8442607462938), record_type = c("detection", "detection", "interpolated", "interpolated")), row.names = 4:7, class = "data.frame") - -# Expected file size -size_should_be <- 30919 - # Check output with default background_ylim, background_xlim, and bg_map # make a preview image temp_dir <- tempdir() make_frames(pos1, out_dir=temp_dir, preview = TRUE) +# Expected file size +size_should_be1 <- 30919 + # Actual file sizes img_file1 <- file.path(temp_dir, "1.png") img_size1 <- file.info(img_file1)$size @@ -34,6 +33,9 @@ temp_dir <- tempdir() make_frames(pos1, out_dir=temp_dir, preview = TRUE, bg_map = great_lakes_polygon) +# Expected file size +size_should_be2 <- 23832 + # Actual file sizes img_file2 <- file.path(temp_dir, "1.png") img_size2 <- file.info(img_file2)$size @@ -54,6 +56,9 @@ make_frames(pos1, preview = TRUE, bg_map = great_lakes_polygon) +# Expected file size +size_should_be3 <- 32220 + # Actual file sizes img_file3 <- file.path(temp_dir, "1.png") img_size3 <- file.info(img_file3)$size @@ -66,16 +71,16 @@ unlink(list.files(temp_dir, full.names = TRUE, recursive = TRUE, # Testing file size results test_that("Expected result when background lims and map not supplied", { # Check if expected and actual file sizes - expect_equal(img_size1, size_should_be) + expect_equal(img_size1, size_should_be1) }) test_that("Expected result when map but not background lims supplied", { # Check if expected and actual file sizes - expect_equal(img_size2, size_should_be) + expect_equal(img_size2, size_should_be2) }) test_that("Expected result when map and background lims supplied", { # Check if expected and actual file sizes - expect_equal(img_size3, size_should_be) + expect_equal(img_size3, size_should_be3) })