Commit bc19ad5e authored by Jordan Williams's avatar Jordan Williams Committed by Jordan Petridis
Browse files

Annotate which functions still need to be unit tested

parent af2e5894
......@@ -90,6 +90,7 @@ impl Show {
}
/// Update the hash of the image's URI.
/// todo Unit test.
pub fn update_image_uri_hash(&self) -> Result<(), DataError> {
use crate::schema::shows::dsl::*;
let db = connection();
......@@ -104,6 +105,7 @@ impl Show {
}
/// Update the timestamp when the image has been cached.
/// todo Unit test.
pub fn update_image_cached(&self) -> Result<(), DataError> {
use crate::schema::shows::dsl::*;
let db = connection();
......@@ -121,6 +123,7 @@ impl Show {
}
/// Update the image's timestamp and URI hash value.
/// todo Unit test.
pub fn update_image_cache_values(&self) -> Result<(), DataError> {
match self.image_uri_hash() {
None => self.update_image_uri_hash()?,
......@@ -192,6 +195,7 @@ impl ShowCoverModel {
///
/// A cached image is valid from the time of its previous download for the given length of time.
/// Otherwise, a cached image is invalidated when the hash of its URI has changed.
/// todo Unit test.
pub fn is_cached_image_valid(&self, valid: &Duration) -> bool {
if Utc::now()
.naive_utc()
......
......@@ -33,6 +33,7 @@ use std::fs;
use std::path::Path;
/// Hash a given value.
/// todo Unit test.
pub fn calculate_hash<T: Hash>(t: &T) -> i64 {
let mut s = DefaultHasher::new();
t.hash(&mut s);
......
......@@ -315,6 +315,7 @@ lazy_static! {
// GObjects do not implement Send trait, so SendCell is a way around that.
// Also lazy_static requires Sync trait, so that's what the mutexes are.
// TODO: maybe use something that would just scale to requested size?
// todo Unit test.
pub(crate) fn set_image_from_path(image: &gtk::Image, show_id: i32, size: u32) -> Result<()> {
if let Ok(hashmap) = CACHED_PIXBUFS.read() {
if let Ok(pd) = dbqueries::get_podcast_cover_from_id(show_id) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment