Fix tests
This commit is contained in:
parent
354bfce670
commit
0ff34d0cbe
@ -310,22 +310,21 @@ pub trait CursorRedrawCb {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cursor_rect_horizontal() {
|
fn test_cursor_rect_horizontal() {
|
||||||
let mut mode = mode::Mode::new();
|
let mut mode_data = HashMap::new();
|
||||||
let mode_info = nvim::ModeInfo::new(&vec![
|
mode_data.insert("cursor_shape".to_owned(), From::from("horizontal"));
|
||||||
(From::from("cursor_shape"), From::from("horizontal")),
|
mode_data.insert("cell_percentage".to_owned(), From::from(25));
|
||||||
(From::from("cell_percentage"), From::from(25)),
|
|
||||||
]);
|
let mode_info = mode::ModeInfo::new(&mode_data).ok();
|
||||||
mode.update("insert", 0);
|
|
||||||
mode.set_info(true, vec![mode_info.unwrap()]);
|
|
||||||
let char_width = 50.0;
|
let char_width = 50.0;
|
||||||
let line_height = 30.0;
|
let line_height = 30.0;
|
||||||
let line_y = 0.0;
|
let line_y = 0.0;
|
||||||
|
|
||||||
let (y, width, height) = cursor_rect(
|
let (y, width, height) = cursor_rect(
|
||||||
&mode,
|
mode_info.as_ref(),
|
||||||
&CellMetrics::new_hw(line_height, char_width),
|
&CellMetrics::new_hw(line_height, char_width),
|
||||||
line_y,
|
line_y,
|
||||||
false,
|
false,
|
||||||
@ -337,19 +336,17 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cursor_rect_horizontal_doublewidth() {
|
fn test_cursor_rect_horizontal_doublewidth() {
|
||||||
let mut mode = mode::Mode::new();
|
let mut mode_data = HashMap::new();
|
||||||
let mode_info = nvim::ModeInfo::new(&vec![
|
mode_data.insert("cursor_shape".to_owned(), From::from("horizontal"));
|
||||||
(From::from("cursor_shape"), From::from("horizontal")),
|
mode_data.insert("cell_percentage".to_owned(), From::from(25));
|
||||||
(From::from("cell_percentage"), From::from(25)),
|
|
||||||
]);
|
let mode_info = mode::ModeInfo::new(&mode_data).ok();
|
||||||
mode.update("insert", 0);
|
|
||||||
mode.set_info(true, vec![mode_info.unwrap()]);
|
|
||||||
let char_width = 50.0;
|
let char_width = 50.0;
|
||||||
let line_height = 30.0;
|
let line_height = 30.0;
|
||||||
let line_y = 0.0;
|
let line_y = 0.0;
|
||||||
|
|
||||||
let (y, width, height) = cursor_rect(
|
let (y, width, height) = cursor_rect(
|
||||||
&mode,
|
mode_info.as_ref(),
|
||||||
&CellMetrics::new_hw(line_height, char_width),
|
&CellMetrics::new_hw(line_height, char_width),
|
||||||
line_y,
|
line_y,
|
||||||
true,
|
true,
|
||||||
@ -361,19 +358,17 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cursor_rect_vertical() {
|
fn test_cursor_rect_vertical() {
|
||||||
let mut mode = mode::Mode::new();
|
let mut mode_data = HashMap::new();
|
||||||
let mode_info = nvim::ModeInfo::new(&vec![
|
mode_data.insert("cursor_shape".to_owned(), From::from("vertical"));
|
||||||
(From::from("cursor_shape"), From::from("vertical")),
|
mode_data.insert("cell_percentage".to_owned(), From::from(25));
|
||||||
(From::from("cell_percentage"), From::from(25)),
|
|
||||||
]);
|
let mode_info = mode::ModeInfo::new(&mode_data).ok();
|
||||||
mode.update("insert", 0);
|
|
||||||
mode.set_info(true, vec![mode_info.unwrap()]);
|
|
||||||
let char_width = 50.0;
|
let char_width = 50.0;
|
||||||
let line_height = 30.0;
|
let line_height = 30.0;
|
||||||
let line_y = 0.0;
|
let line_y = 0.0;
|
||||||
|
|
||||||
let (y, width, height) = cursor_rect(
|
let (y, width, height) = cursor_rect(
|
||||||
&mode,
|
mode_info.as_ref(),
|
||||||
&CellMetrics::new_hw(line_height, char_width),
|
&CellMetrics::new_hw(line_height, char_width),
|
||||||
line_y,
|
line_y,
|
||||||
false,
|
false,
|
||||||
|
Loading…
Reference in New Issue
Block a user