From b165fcd97cc5a6ea1aed4e0ac6b3bcb23913edd6 Mon Sep 17 00:00:00 2001 From: Giuliano Bellini s294739 Date: Fri, 4 Aug 2023 11:41:17 +0200 Subject: [PATCH] fix tests --- src/chart/manage_chart_data.rs | 9 ++-- src/gui/types/sniffer.rs | 86 +--------------------------------- 2 files changed, 5 insertions(+), 90 deletions(-) diff --git a/src/chart/manage_chart_data.rs b/src/chart/manage_chart_data.rs index e8daf53a..ccab5960 100644 --- a/src/chart/manage_chart_data.rs +++ b/src/chart/manage_chart_data.rs @@ -84,7 +84,7 @@ mod tests { use std::collections::VecDeque; use crate::chart::manage_chart_data::{get_max, get_min, update_charts_data}; - use crate::{ChartType, RunTimeData, TrafficChart}; + use crate::{ChartType, Language, RunTimeData, StyleType, TrafficChart}; #[test] fn test_chart_data_updates() { @@ -162,12 +162,9 @@ mod tests { max_received_bytes: 21000, min_sent_packets: -1000, max_received_packets: 21000, - color_mix: 0.0, - color_incoming: Default::default(), - color_outgoing: Default::default(), - color_font: Default::default(), + language: Language::default(), chart_type: ChartType::Packets, - language: Default::default(), + style: StyleType::default(), }; let mut runtime_data = RunTimeData { all_bytes: 0, diff --git a/src/gui/types/sniffer.rs b/src/gui/types/sniffer.rs index cd310a11..8a84c8c6 100644 --- a/src/gui/types/sniffer.rs +++ b/src/gui/types/sniffer.rs @@ -522,8 +522,6 @@ mod tests { use crate::countries::types::country::Country; use crate::gui::components::types::my_modal::MyModal; use crate::gui::pages::types::settings_page::SettingsPage; - use crate::gui::styles::style_constants::get_color_mix_chart; - use crate::gui::styles::types::palette::to_rgb_color; use crate::gui::types::message::Message; use crate::networking::types::host::Host; use crate::notifications::types::logged_notification::{ @@ -534,8 +532,8 @@ mod tests { }; use crate::notifications::types::sound::Sound; use crate::{ - get_colors, AppProtocol, ByteMultiple, ChartType, InfoTraffic, IpVersion, Language, - ReportSortType, RunningPage, Sniffer, Status, StyleType, TransProtocol, + AppProtocol, ByteMultiple, ChartType, InfoTraffic, IpVersion, Language, ReportSortType, + RunningPage, Sniffer, Status, StyleType, TransProtocol, }; #[test] @@ -659,94 +657,14 @@ mod tests { sniffer.update(Message::Style(StyleType::MonAmour)); assert_eq!(sniffer.style, StyleType::MonAmour); - assert_eq!( - sniffer.traffic_chart.color_font, - to_rgb_color(get_colors(StyleType::MonAmour).text_body) - ); - assert_eq!( - sniffer.traffic_chart.color_outgoing, - to_rgb_color(get_colors(StyleType::MonAmour).outgoing) - ); - assert_eq!( - sniffer.traffic_chart.color_incoming, - to_rgb_color(get_colors(StyleType::MonAmour).secondary) - ); - assert_eq!( - sniffer.traffic_chart.color_mix, - get_color_mix_chart(StyleType::MonAmour) - ); sniffer.update(Message::Style(StyleType::Day)); assert_eq!(sniffer.style, StyleType::Day); - assert_eq!( - sniffer.traffic_chart.color_font, - to_rgb_color(get_colors(StyleType::Day).text_body) - ); - assert_eq!( - sniffer.traffic_chart.color_outgoing, - to_rgb_color(get_colors(StyleType::Day).outgoing) - ); - assert_eq!( - sniffer.traffic_chart.color_incoming, - to_rgb_color(get_colors(StyleType::Day).secondary) - ); - assert_eq!( - sniffer.traffic_chart.color_mix, - get_color_mix_chart(StyleType::Day) - ); sniffer.update(Message::Style(StyleType::Night)); assert_eq!(sniffer.style, StyleType::Night); - assert_eq!( - sniffer.traffic_chart.color_font, - to_rgb_color(get_colors(StyleType::Night).text_body) - ); - assert_eq!( - sniffer.traffic_chart.color_outgoing, - to_rgb_color(get_colors(StyleType::Night).outgoing) - ); - assert_eq!( - sniffer.traffic_chart.color_incoming, - to_rgb_color(get_colors(StyleType::Night).secondary) - ); - assert_eq!( - sniffer.traffic_chart.color_mix, - get_color_mix_chart(StyleType::Night) - ); sniffer.update(Message::Style(StyleType::DeepSea)); assert_eq!(sniffer.style, StyleType::DeepSea); - assert_eq!( - sniffer.traffic_chart.color_font, - to_rgb_color(get_colors(StyleType::DeepSea).text_body) - ); - assert_eq!( - sniffer.traffic_chart.color_outgoing, - to_rgb_color(get_colors(StyleType::DeepSea).outgoing) - ); - assert_eq!( - sniffer.traffic_chart.color_incoming, - to_rgb_color(get_colors(StyleType::DeepSea).secondary) - ); - assert_eq!( - sniffer.traffic_chart.color_mix, - get_color_mix_chart(StyleType::DeepSea) - ); sniffer.update(Message::Style(StyleType::DeepSea)); assert_eq!(sniffer.style, StyleType::DeepSea); - assert_eq!( - sniffer.traffic_chart.color_font, - to_rgb_color(get_colors(StyleType::DeepSea).text_body) - ); - assert_eq!( - sniffer.traffic_chart.color_outgoing, - to_rgb_color(get_colors(StyleType::DeepSea).outgoing) - ); - assert_eq!( - sniffer.traffic_chart.color_incoming, - to_rgb_color(get_colors(StyleType::DeepSea).secondary) - ); - assert_eq!( - sniffer.traffic_chart.color_mix, - get_color_mix_chart(StyleType::DeepSea) - ); } #[test]