add tests for EguiHelper trait
This commit is contained in:
parent
6258b0ac16
commit
3ef1feedb1
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -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",
|
||||
|
||||
@ -33,6 +33,7 @@ pub use crate::{
|
||||
hashed_storage_read,
|
||||
option_vec_printer,
|
||||
step_helper,
|
||||
EguiHelper,
|
||||
SteppedVector,
|
||||
},
|
||||
};
|
||||
|
||||
@ -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))]
|
||||
|
||||
@ -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<Value> = 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<Value> = 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<Value> = 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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user