tests: update port test with new colour

This commit is contained in:
Jack Wills
2024-02-14 10:25:32 +00:00
parent fe5ec4f5dd
commit f74ae3f5c3
2 changed files with 22 additions and 24 deletions
Generated
+7 -4
View File
@@ -218,9 +218,12 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.85" version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b918671670962b48bc23753aef0c51d072dca6f52f01f800854ada6ddb7f7d3" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@@ -503,9 +506,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.3.5" version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd"
[[package]] [[package]]
name = "hex" name = "hex"
+15 -20
View File
@@ -46,7 +46,6 @@ const CIRCLE: &str = "⚪ ";
const CONSTRAINT_50_50: [Constraint; 2] = [Constraint::Percentage(50), Constraint::Percentage(50)]; const CONSTRAINT_50_50: [Constraint; 2] = [Constraint::Percentage(50), Constraint::Percentage(50)];
const CONSTRAINT_100: [Constraint; 1] = [Constraint::Percentage(100)]; const CONSTRAINT_100: [Constraint; 1] = [Constraint::Percentage(100)];
// TODO FIX THIS
const CONSTRAINT_POPUP: [Constraint; 5] = [ const CONSTRAINT_POPUP: [Constraint; 5] = [
Constraint::Min(2), Constraint::Min(2),
Constraint::Max(1), Constraint::Max(1),
@@ -764,8 +763,6 @@ pub fn help_box(f: &mut Frame) {
BoxLocation::MiddleCentre, BoxLocation::MiddleCentre,
); );
// This is wrong!
// TODO
let split_popup = Layout::default() let split_popup = Layout::default()
.direction(Direction::Vertical) .direction(Direction::Vertical)
.constraints([ .constraints([
@@ -928,7 +925,7 @@ pub fn error(f: &mut Frame, error: AppError, seconds: Option<u8>) {
.block(block) .block(block)
.alignment(Alignment::Center); .alignment(Alignment::Center);
let area = popup(lines, max_line_width, f.size(), BoxLocation::MiddleCentre); let area = popup(lines, max_line_width, f.size(), BoxLocation::TopLeft);
// let (paragraph, area) = gen_error(f, error, seconds); // let (paragraph, area) = gen_error(f, error, seconds);
f.render_widget(Clear, area); f.render_widget(Clear, area);
@@ -936,6 +933,7 @@ pub fn error(f: &mut Frame, error: AppError, seconds: Option<u8>) {
} }
/// Draw info box in one of the 9 BoxLocations /// Draw info box in one of the 9 BoxLocations
// TODO is this broken?
pub fn info(f: &mut Frame, text: &str, instant: Instant, gui_state: &Arc<Mutex<GuiState>>) { pub fn info(f: &mut Frame, text: &str, instant: Instant, gui_state: &Arc<Mutex<GuiState>>) {
let block = Block::default() let block = Block::default()
.title("") .title("")
@@ -2580,16 +2578,16 @@ mod tests {
setup.app_data.lock().containers.items[0].name = name.clone(); setup.app_data.lock().containers.items[0].name = name.clone();
let expected = [ let expected = [
" ", " ",
" ╭──────────────────────────────────── Confirm Delete ────────────────────────────────────╮ ", " ╭──────────────────────────────────── Confirm Delete ────────────────────────────────────╮ ",
" │ │ ", " │ │ ",
" │ Are you sure you want to delete container: container_1_container_1_container_1 │ ", " │ Are you sure you want to delete container: container_1_container_1_container_1 │ ",
" │ │ ", " │ │ ",
" │ ╭──────────────────────────────╮ ╭─────────────────────────────╮ │ ", " │ ╭──────────────────────────────╮ ╭─────────────────────────────╮ │ ",
" │ │ (N)o │ │ (Y)es │ │ ", " │ │ (N)o │ │ (Y)es │ │ ",
" │ ╰──────────────────────────────╯ ╰─────────────────────────────╯ │ ", " │ ╰──────────────────────────────╯ ╰─────────────────────────────╯ │ ",
" ╰────────────────────────────────────────────────────────────────────────────────────────╯ ", " ╰────────────────────────────────────────────────────────────────────────────────────────╯ ",
" ", " ",
]; ];
setup setup
@@ -2931,12 +2929,9 @@ mod tests {
if row_index == 1 && result_cell_as_char { if row_index == 1 && result_cell_as_char {
assert_eq!(result_cell.fg, Color::Yellow); assert_eq!(result_cell.fg, Color::Yellow);
} }
if row_index == 2 && result_cell_as_char { if (2..=3).contains(&row_index) && result_cell_as_char {
assert_eq!(result_cell.fg, Color::White); assert_eq!(result_cell.fg, Color::White);
} }
if row_index == 3 && result_cell_as_char {
assert_eq!(result_cell.fg, Color::Magenta);
}
if row_index == 4 && result_cell_as_char { if row_index == 4 && result_cell_as_char {
assert_eq!(result_cell.fg, Color::White); assert_eq!(result_cell.fg, Color::White);
} }
@@ -3124,10 +3119,10 @@ mod tests {
ContainerImage::from("a_long_image_name_for_the_purposes_of_this_test"); ContainerImage::from("a_long_image_name_for_the_purposes_of_this_test");
let expected = [ let expected = [
" name state status cpu memory/limit id image ↓ rx ↑ tx ( h ) show help ", " name state status cpu memory/limit id image ↓ rx ↑ tx ( h ) show help ",
"╭ Containers 1/3 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮╭─────────────────╮", "╭ Containers 1/3 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮╭─────────────────╮",
"│⚪ a_long_container_name_for_the… ✓ running Up 1 hour 03.00% 30.00 kB / 30.00 kB 1 a_long_image_name_for_the_pur… 0.00 kB 0.00 kB ││▶ pause │", "│⚪ a_long_container_name_for_the… ✓ running Up 1 hour 03.00% 30.00 kB / 30.00 kB 1 a_long_image_name_for_the_pur… 0.00 kB 0.00 kB ││▶ pause │",
"│ container_2 ✓ running Up 2 hour 00.00% 0.00 kB / 0.00 kB 2 image_2 0.00 kB 0.00 kB ││ restart │", "│ container_2 ✓ running Up 2 hour 00.00% 0.00 kB / 0.00 kB 2 image_2 0.00 kB 0.00 kB ││ restart │",
"│ container_3 ✓ running Up 3 hour 00.00% 0.00 kB / 0.00 kB 3 image_3 0.00 kB 0.00 kB ││ stop │", "│ container_3 ✓ running Up 3 hour 00.00% 0.00 kB / 0.00 kB 3 image_3 0.00 kB 0.00 kB ││ stop │",
"│ ││ delete │", "│ ││ delete │",
"│ ││ │", "│ ││ │",