diff --git a/Cargo.lock b/Cargo.lock index df9aff3..b03c17f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -659,7 +659,7 @@ checksum = "453440c271cf5577fd2a40e4942540cb7d0d2f85e27c8d07dd0023c925a67541" [[package]] name = "eframe" version = "0.18.0" -source = "git+https://github.com/Titaniumtown/egui.git#537c879b1c5a40384188dcc731a6d55c04deb99f" +source = "git+https://github.com/Titaniumtown/egui.git#1825430debaf048e821d3a41426a3e15b8343b24" dependencies = [ "bytemuck", "egui", @@ -679,7 +679,7 @@ dependencies = [ [[package]] name = "egui" version = "0.18.1" -source = "git+https://github.com/Titaniumtown/egui.git#537c879b1c5a40384188dcc731a6d55c04deb99f" +source = "git+https://github.com/Titaniumtown/egui.git#1825430debaf048e821d3a41426a3e15b8343b24" dependencies = [ "ahash", "epaint", @@ -691,7 +691,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.18.0" -source = "git+https://github.com/Titaniumtown/egui.git#537c879b1c5a40384188dcc731a6d55c04deb99f" +source = "git+https://github.com/Titaniumtown/egui.git#1825430debaf048e821d3a41426a3e15b8343b24" dependencies = [ "arboard", "egui", @@ -705,7 +705,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.18.1" -source = "git+https://github.com/Titaniumtown/egui.git#537c879b1c5a40384188dcc731a6d55c04deb99f" +source = "git+https://github.com/Titaniumtown/egui.git#1825430debaf048e821d3a41426a3e15b8343b24" dependencies = [ "bytemuck", "egui", @@ -725,7 +725,7 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "emath" version = "0.18.0" -source = "git+https://github.com/Titaniumtown/egui.git#537c879b1c5a40384188dcc731a6d55c04deb99f" +source = "git+https://github.com/Titaniumtown/egui.git#1825430debaf048e821d3a41426a3e15b8343b24" dependencies = [ "bytemuck", "serde", @@ -734,7 +734,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.18.1" -source = "git+https://github.com/Titaniumtown/egui.git#537c879b1c5a40384188dcc731a6d55c04deb99f" +source = "git+https://github.com/Titaniumtown/egui.git#1825430debaf048e821d3a41426a3e15b8343b24" dependencies = [ "ab_glyph", "ahash", diff --git a/src/lib.rs b/src/lib.rs index 53c3934..b7c0950 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,6 +33,7 @@ pub use crate::{ hashed_storage_read, option_vec_printer, step_helper, + EguiHelper, SteppedVector, }, }; diff --git a/src/misc.rs b/src/misc.rs index f9bc965..9b17435 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -1,6 +1,6 @@ use std::intrinsics::assume; -use eframe::egui::plot::{Line, Points, Value, Values}; +use egui::plot::{Line, Points, Value, Values}; use itertools::Itertools; #[cfg(not(threading))] diff --git a/tests/misc.rs b/tests/misc.rs index facc9ce..474f78e 100644 --- a/tests/misc.rs +++ b/tests/misc.rs @@ -114,3 +114,40 @@ fn invalid_hashed_storage() { use ytbn_graphing_software::hashed_storage_read; assert_eq!(hashed_storage_read("aaaa"), None); } + +#[test] +fn to_tuple() { + use egui::plot::Value; + use ytbn_graphing_software::EguiHelper; + let data_raw = vec![(0.0, 1.0), (1.0, 3.0), (2.0, 4.0)]; + let data: Vec = data_raw.iter().map(|(x, y)| Value::new(*x, *y)).collect(); + let tupled_data = data.to_tuple(); + + assert_eq!(tupled_data, data_raw); +} + +#[test] +fn to_line() { + use egui::plot::{Line, Value}; + use ytbn_graphing_software::EguiHelper; + let data_raw: Vec = vec![(0.0, 1.0), (1.0, 3.0), (2.0, 4.0)] + .iter() + .map(|(x, y)| Value::new(*x, *y)) + .collect(); + let data: Line = data_raw.clone().to_line(); + + assert_eq!(*data.get_series().get_values(), data_raw); +} + +#[test] +fn to_points() { + use egui::plot::{Points, Value}; + use ytbn_graphing_software::EguiHelper; + let data_raw: Vec = vec![(0.0, 1.0), (1.0, 3.0), (2.0, 4.0)] + .iter() + .map(|(x, y)| Value::new(*x, *y)) + .collect(); + let data: Points = data_raw.clone().to_points(); + + assert_eq!(*data.get_series().get_values(), data_raw); +}