feat: add some benches to compare with linicon

This commit is contained in:
Paul Delafosse 2022-05-12 15:34:02 +02:00
parent 6515a02881
commit e40fbfa916
6 changed files with 124 additions and 62 deletions

View file

@ -5,15 +5,7 @@ use ini::Ini;
use once_cell::sync::Lazy;
use std::path::PathBuf;
pub(crate) static BASE_PATHS: Lazy<Vec<PathBuf>> = Lazy::new(|| icon_theme_base_paths());
pub(crate) static FALLBACK_PATHS: Lazy<Vec<PathBuf>> = Lazy::new(|| {
vec![
data_dir()
.expect("Failed to get DATA_DIR")
.join("icons/hicolor"),
PathBuf::from("usr/share/icons/hicolor"),
]
});
pub(crate) static BASE_PATHS: Lazy<Vec<PathBuf>> = Lazy::new(icon_theme_base_paths);
/// Look in $HOME/.icons (for backwards compatibility), in $XDG_DATA_DIRS/icons and in /usr/share/pixmaps (in that order).
/// Paths that are not found are filtered out.
@ -56,6 +48,12 @@ mod test {
use anyhow::Result;
use speculoos::prelude::*;
#[test]
fn should_get_all_themes() {
let themes = get_all_themes().unwrap();
assert_that!(themes.get("hicolor")).is_some();
}
#[test]
fn should_get_theme_paths_ordered() {
let base_paths = icon_theme_base_paths();