Skip to content

Commit

Permalink
Move TestErrorReporter to view::helpers::test
Browse files Browse the repository at this point in the history
  • Loading branch information
misson20000 committed Aug 4, 2024
1 parent c246f12 commit cd03449
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/view/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ use gtk::pango;

use crate::catch_panic;
use crate::model::versioned;
use crate::view::error;
use crate::view::window::ErrorReporter;

pub fn create_simple_action_strong<T, F>(obj: rc::Rc<T>, id: &str, cb: F) -> gio::SimpleAction
where F: Fn(&rc::Rc<T>) + 'static,
Expand Down Expand Up @@ -107,10 +105,16 @@ pub fn pango_unscale(value: i32) -> f32 {
value as f32 / pango::SCALE as f32
}

pub struct TestErrorReporter;
#[cfg(test)]
pub mod test {
use crate::view::error;
use crate::view::window::ErrorReporter;

pub struct TestErrorReporter;

impl ErrorReporter for TestErrorReporter {
fn report_error(&self, error: error::Error) {
panic!("got error: {}\n{}", error.message(), error.detail());
impl ErrorReporter for TestErrorReporter {
fn report_error(&self, error: error::Error) {
panic!("got error: {}\n{}", error.message(), error.detail());
}
}
}

0 comments on commit cd03449

Please sign in to comment.