Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e99cde3
fix: repaint called every 50 ms
lklimek Jun 10, 2025
17ee27b
chore: clippy
lklimek Jun 10, 2025
0d6efb0
chore: animated repaint refactor
lklimek Jun 10, 2025
605005e
refactor(components): remove dead code
lklimek Jun 10, 2025
6bd828c
chore: fix repaint of connection indicator
lklimek Jun 10, 2025
8ee3b74
chore: ability to disable animations
lklimek Jun 10, 2025
910aa11
chore: fmt
lklimek Jun 10, 2025
8d081aa
chore: disable animations in developer_mode
lklimek Jun 10, 2025
d2b7fab
chore: minor refactor of developer mode
lklimek Jun 10, 2025
8fe804a
Merge remote-tracking branch 'origin/v0.9-dev' into fix/repaint-50ms
lklimek Jun 11, 2025
b2e53d8
chore: rabbit feedback
lklimek Jun 11, 2025
582cc43
Merge remote-tracking branch 'origin/v0.9-dev' into fix/repaint-50ms
lklimek Jun 12, 2025
3348099
fix: Error loading identities from local DB on token creation screen
lklimek Jun 12, 2025
ff9f9cb
Merge remote-tracking branch 'origin/v0.9-dev' into fix/repaint-50ms
lklimek Jun 16, 2025
c3267c8
chore: fix clippy
lklimek Jun 16, 2025
729af92
Merge remote-tracking branch 'origin/v0.9-dev' into fix/repaint-50ms
lklimek Jun 26, 2025
a90176b
chore: fix clippy warnings
lklimek Jun 26, 2025
9c2cd3e
Merge remote-tracking branch 'origin/v0.9-dev' into fix/repaint-50ms
lklimek Jun 26, 2025
5c5d039
chore: fix after merge
lklimek Jun 26, 2025
c11be2a
test: snapshot
lklimek Jun 26, 2025
7beff76
test: implement kittest tests for left panel
lklimek Jun 26, 2025
615ef1a
Merge remote-tracking branch 'origin/v0.9-dev' into test/egui-kittest
lklimek Jun 26, 2025
6ebb0db
chore: remove obsolete startup tests
lklimek Jun 26, 2025
11f954a
chore: wip
lklimek Jun 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ test_db
**/.DS_Store
explorer.log
.gitaipconfig

# Ignore egui kittest snapshots
tests/snapshots/
77 changes: 76 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ raw-cpuid = "11.5.0"
[dev-dependencies]

tempfile = { version = "3.20.0" }
egui_kittest = { version = "0.31.1", features = ["eframe"] }
egui_kittest = { version = "0.31.1", features = ["eframe", "snapshot", "wgpu"] }
6 changes: 5 additions & 1 deletion src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
let log_file_path = app_user_data_file_path("det.log").expect("should create log file path");
let log_file = match std::fs::File::create(&log_file_path) {
Ok(file) => file,
Err(e) => panic!("Failed to create log file: {:?}", e),

Check failure on line 11 in src/logging.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/logging.rs:11:19 | 11 | Err(e) => panic!("Failed to create log file: {:?}", e), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 11 - Err(e) => panic!("Failed to create log file: {:?}", e), 11 + Err(e) => panic!("Failed to create log file: {e:?}"), |

Check failure on line 11 in src/logging.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/logging.rs:11:19 | 11 | Err(e) => panic!("Failed to create log file: {:?}", e), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 11 - Err(e) => panic!("Failed to create log file: {:?}", e), 11 + Err(e) => panic!("Failed to create log file: {e:?}"), |
};

let filter = EnvFilter::try_new(
"info,dash_evo_tool=trace,dash_sdk=debug,tenderdash_abci=debug,drive=debug,drive_proof_verifier=debug,rs_dapi_client=debug,h2=warn",
)
.unwrap_or_else(|e| panic!("Failed to create EnvFilter: {:?}", e));

Check failure on line 17 in src/logging.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/logging.rs:17:29 | 17 | .unwrap_or_else(|e| panic!("Failed to create EnvFilter: {:?}", e)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 17 - .unwrap_or_else(|e| panic!("Failed to create EnvFilter: {:?}", e)); 17 + .unwrap_or_else(|e| panic!("Failed to create EnvFilter: {e:?}")); |

Check failure on line 17 in src/logging.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/logging.rs:17:29 | 17 | .unwrap_or_else(|e| panic!("Failed to create EnvFilter: {:?}", e)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 17 - .unwrap_or_else(|e| panic!("Failed to create EnvFilter: {:?}", e)); 17 + .unwrap_or_else(|e| panic!("Failed to create EnvFilter: {e:?}")); |

let subscriber = tracing_subscriber::fmt()
.with_env_filter(filter)
Expand All @@ -24,7 +24,11 @@

// Set global subscriber with proper error handling
if let Err(e) = tracing::subscriber::set_global_default(subscriber) {
panic!("Unable to set global default subscriber: {:?}", e);
// log to stderr and ignore the error
eprintln!(
"WARNING: cannot initialize logging, logging might not work correctly: {:?}",
e
);

Check failure on line 31 in src/logging.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/logging.rs:28:9 | 28 | / eprintln!( 29 | | "WARNING: cannot initialize logging, logging might not work correctly: {:?}", 30 | | e 31 | | ); | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args

Check failure on line 31 in src/logging.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/logging.rs:28:9 | 28 | / eprintln!( 29 | | "WARNING: cannot initialize logging, logging might not work correctly: {:?}", 30 | | e 31 | | ); | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
}

// Log panic events
Expand Down
11 changes: 8 additions & 3 deletions src/ui/components/left_panel.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::app::AppAction;
use crate::context::AppContext;
use crate::ui::components::styled::GradientButton;
use crate::ui::components::test_label::TestableWidget;
use crate::ui::theme::{DashColors, Shadow, Shape, Spacing};
use crate::ui::RootScreenType;
use dash_sdk::dashcore_rpc::dashcore::Network;
Expand Down Expand Up @@ -38,11 +39,11 @@

Some(texture)
} else {
eprintln!("Failed to load image from embedded data at path: {}", path);

Check failure on line 42 in src/ui/components/left_panel.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/ui/components/left_panel.rs:42:21 | 42 | eprintln!("Failed to load image from embedded data at path: {}", path); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 42 - eprintln!("Failed to load image from embedded data at path: {}", path); 42 + eprintln!("Failed to load image from embedded data at path: {path}"); |

Check failure on line 42 in src/ui/components/left_panel.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/ui/components/left_panel.rs:42:21 | 42 | eprintln!("Failed to load image from embedded data at path: {}", path); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 42 - eprintln!("Failed to load image from embedded data at path: {}", path); 42 + eprintln!("Failed to load image from embedded data at path: {path}"); |
None
}
} else {
eprintln!("Image not found in embedded assets at path: {}", path);

Check failure on line 46 in src/ui/components/left_panel.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/ui/components/left_panel.rs:46:17 | 46 | eprintln!("Image not found in embedded assets at path: {}", path); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 46 - eprintln!("Image not found in embedded assets at path: {}", path); 46 + eprintln!("Image not found in embedded assets at path: {path}"); |

Check failure on line 46 in src/ui/components/left_panel.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/ui/components/left_panel.rs:46:17 | 46 | eprintln!("Image not found in embedded assets at path: {}", path); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 46 - eprintln!("Image not found in embedded assets at path: {}", path); 46 + eprintln!("Image not found in embedded assets at path: {path}"); |
None
}
})
Expand All @@ -56,7 +57,8 @@
let mut action = AppAction::None;

// Define the button details directly in this function
let buttons = [
// Contains (label, screen type, icon path)
let buttons: [(&'static str, RootScreenType, &'static str); 7] = [
("I", RootScreenType::RootScreenIdentities, "identity.png"),
("Q", RootScreenType::RootScreenDocumentQuery, "doc.png"),
("O", RootScreenType::RootScreenMyTokenBalances, "tokens.png"),
Expand Down Expand Up @@ -112,10 +114,13 @@

// Add icon-based button if texture is loaded
if let Some(ref texture) = texture {
let button =
ImageButton::new(texture).frame(false).tint(button_color);
let button = ImageButton::new(texture)
.frame(false)
.tint(button_color)
.test_label(label);

let added = ui.add(button);

if added.clicked() {
action =
AppAction::SetMainScreenThenGoToMainScreen(*screen_type);
Expand Down
1 change: 1 addition & 0 deletions src/ui/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub mod entropy_grid;
pub mod left_panel;
pub mod left_wallet_panel;
pub mod styled;
pub mod test_label;
pub mod tokens_subscreen_chooser_panel;
pub mod tools_subscreen_chooser_panel;
pub mod top_panel;
Expand Down
8 changes: 7 additions & 1 deletion src/ui/components/styled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
};
use egui::{
Button, CentralPanel, Color32, Context, Frame, Margin, Response, RichText, Stroke, TextEdit,
Ui, Vec2,
Ui, Vec2, Widget,
};

/// Styled button variants
Expand Down Expand Up @@ -217,6 +217,12 @@ impl<'a> StyledCheckbox<'a> {
}
}

impl Widget for StyledCheckbox<'_> {
fn ui(self, ui: &mut Ui) -> Response {
self.show(ui)
}
}

/// Gradient button with animated effects
pub(crate) struct GradientButton {
text: String,
Expand Down
60 changes: 60 additions & 0 deletions src/ui/components/test_label.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
use egui::{Sense, Widget, WidgetInfo};

/// A wrapper widget that adds a label to any `egui::Widget` for testing purposes.
///
/// This widget allows you to attach a label to any widget, which can be used in tests
/// to identify and interact with the widget from egui_kittest.
/// Only use when there is no other way to identify the widget in tests.
///
/// ## Example usage:
///
/// ```rust
/// use egui::Widget;
/// use dash_evo_tool::ui::components::test_label::{TestLabel, TestableWidget};
/// fn my_widget(ui: &mut egui::Ui) {
/// let my_button = egui::Button::new("Click me");
/// ui.add(my_button.test_label("my_button"));
/// }
/// ```
pub struct TestLabel<T: Widget> {
pub label: String,
pub inner: T,
}

impl<T: Widget> TestLabel<T> {
pub fn new(inner: T, label: &str) -> Self {
Self {
label: label.to_string(),
inner,
}
}
}

impl<T: Widget> egui::Widget for TestLabel<T> {
fn ui(self, ui: &mut egui::Ui) -> egui::Response {
let scope = ui.scope(|ui| self.inner.ui(ui));
let response = scope.response.interact(Sense::click());

response.widget_info(move || {
let label = self.label.clone();
WidgetInfo::labeled(egui::WidgetType::Other, ui.is_enabled(), label)
});

// Pass all interactions from the inner widget
scope.inner.union(response)
}
}
/// Trait to allow any widget to be tested with a label
///
/// This trait provides a method to attach a test label to any widget.
/// The label can be used to identify the widget in tests, making it easier to interact with
/// and assert conditions on the widget during testing.
pub trait TestableWidget<T: Widget> {
fn test_label(self, label: &str) -> TestLabel<T>;
}

impl<T: Widget> TestableWidget<T> for T {
fn test_label(self, label: &str) -> TestLabel<T> {
TestLabel::new(self, label)
}
}
8 changes: 7 additions & 1 deletion src/ui/network_chooser_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
use crate::context::AppContext;
use crate::ui::components::left_panel::add_left_panel;
use crate::ui::components::styled::{island_central_panel, StyledCard, StyledCheckbox};
use crate::ui::components::test_label::TestableWidget;
use crate::ui::components::top_panel::add_top_panel;
use crate::ui::theme::{DashColors, ThemeMode};
use crate::ui::{RootScreenType, ScreenLike};
use dash_sdk::dpp::dashcore::Network;
use dash_sdk::dpp::identity::TimestampMillis;
use eframe::egui::{self, Context, Ui};
use egui::Widget;
use std::path::PathBuf;
use std::sync::Arc;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
Expand Down Expand Up @@ -257,10 +259,10 @@
.expect("Expected to save db settings");
} else {
self.custom_dash_qt_error_message =
Some(format!(
"Invalid file: Please select a valid '{}'.",
required_file_name
));

Check failure on line 265 in src/ui/network_chooser_screen.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/ui/network_chooser_screen.rs:262:62 | 262 | ... Some(format!( | ____________________________________^ 263 | | ... "Invalid file: Please select a valid '{}'.", 264 | | ... required_file_name 265 | | ... )); | |_______________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
}
}
}
Expand Down Expand Up @@ -456,10 +458,10 @@
};

ui.label(
egui::RichText::new(format!(
"Add these lines to your {} dash.conf:",
network_name
))

Check failure on line 464 in src/ui/network_chooser_screen.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/ui/network_chooser_screen.rs:461:61 | 461 | ... egui::RichText::new(format!( | ___________________________________________^ 462 | | ... "Add these lines to your {} dash.conf:", 463 | | ... network_name 464 | | ... )) | |_______________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args

Check failure on line 464 in src/ui/network_chooser_screen.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/ui/network_chooser_screen.rs:461:61 | 461 | ... egui::RichText::new(format!( | ___________________________________________^ 462 | | ... "Add these lines to your {} dash.conf:", 463 | | ... network_name 464 | | ... )) | |_______________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
.color(DashColors::TEXT_PRIMARY),
);

Expand Down Expand Up @@ -538,7 +540,11 @@

// Network selection
let mut is_selected = self.current_network == network;
if StyledCheckbox::new(&mut is_selected, "").show(ui).clicked() && is_selected {

let checkbox = StyledCheckbox::new(&mut is_selected, "")
.test_label(&format!("select_network_{}", network.magic()));

if checkbox.ui(ui).clicked() && is_selected {
self.current_network = network;
app_action = AppAction::SwitchNetwork(network);
// Recheck in 1 second
Expand Down Expand Up @@ -609,7 +615,7 @@
if let Err(e) =
Arc::clone(local_app_context).reinit_core_client_and_sdk()
{
eprintln!("Failed to re-init local RPC client and sdk: {}", e);

Check failure on line 618 in src/ui/network_chooser_screen.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/ui/network_chooser_screen.rs:618:33 | 618 | ... eprintln!("Failed to re-init local RPC client and sdk: {}", e); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 618 - eprintln!("Failed to re-init local RPC client and sdk: {}", e); 618 + eprintln!("Failed to re-init local RPC client and sdk: {e}"); |

Check failure on line 618 in src/ui/network_chooser_screen.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

variables can be used directly in the `format!` string

error: variables can be used directly in the `format!` string --> src/ui/network_chooser_screen.rs:618:33 | 618 | ... eprintln!("Failed to re-init local RPC client and sdk: {}", e); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args help: change this to | 618 - eprintln!("Failed to re-init local RPC client and sdk: {}", e); 618 + eprintln!("Failed to re-init local RPC client and sdk: {e}"); |
} else {
// Trigger SwitchNetworks
app_action = AppAction::SwitchNetwork(Network::Regtest);
Expand Down
Loading
Loading