-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcursor.rs
50 lines (36 loc) · 1.02 KB
/
cursor.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
pub mod common;
use crate::common::*;
use wiper::app::App;
mod cursor {
use wiper::fs::DataStoreType;
use super::*;
#[test]
fn updates_cursor_position() {
let mut app: App<DataStoreType> = setup_app_view();
handle_tasks_synchronously(&mut app);
assert_cursor_index(&app, 0);
app.on_cursor_down();
assert_cursor_index(&app, 1);
app.on_cursor_up();
assert_cursor_index(&app, 0);
}
#[test]
fn stops_cursor_at_very_top() {
let mut app: App<DataStoreType> = setup_app_view();
handle_tasks_synchronously(&mut app);
assert_cursor_index(&app, 0);
for _ in 0..10 {
app.on_cursor_up();
}
assert_cursor_index(&app, 0);
}
#[test]
fn stops_cursor_at_very_bottom() {
let mut app: App<DataStoreType> = setup_app_view();
handle_tasks_synchronously(&mut app);
for _ in 0..20 {
app.on_cursor_down();
}
assert_cursor_index(&app, 6);
}
}