Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonbrad committed Aug 25, 2023
1 parent 98b5340 commit ed09dd4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
15 changes: 12 additions & 3 deletions clafrica/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,20 @@ impl Frontend for Console {

#[test]
fn test_console() {
let mut console = Console::default();
let mut none = None;
none.set_input("hello");
none.update_screen((64, 64));
none.update_position((64.0, 64.0));
none.set_input("input");
none.set_page_size(10);
none.add_predicate("hey", "y", "hello");
none.display();
none.clear_predicates();
none.previous_predicate();
none.next_predicate();
none.get_selected_predicate();

let mut console = Console::default();
console.set_page_size(10);
console.update_screen((0, 0));
console.update_position((0.0, 0.0));
Expand All @@ -128,6 +139,4 @@ fn test_console() {
console.previous_predicate();
console.next_predicate();
assert!(console.get_selected_predicate().is_none());

none.set_input("hello");
}
3 changes: 1 addition & 2 deletions clafrica/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,11 @@ impl Processor {
self.pause();
rdev::simulate(&EventType::KeyRelease(E_Key::ControlLeft)).unwrap();
rdev::simulate(&EventType::KeyRelease(E_Key::ControlRight)).unwrap();
dbg!(0..code.len() - remaining_code.len());

(0..code.len() - remaining_code.len())
.for_each(|_| self.keyboard.key_click(Key::Backspace));
self.keyboard.key_sequence(text);
self.resume();

// We clear the buffer
self.cursor.clear();
}
Expand Down

0 comments on commit ed09dd4

Please sign in to comment.