Skip to content

Commit

Permalink
tests: update port test with new colour
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjackwills committed Feb 14, 2024
1 parent fe5ec4f commit f74ae3f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
11 changes: 7 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 15 additions & 20 deletions src/ui/draw_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const CIRCLE: &str = "⚪ ";

const CONSTRAINT_50_50: [Constraint; 2] = [Constraint::Percentage(50), Constraint::Percentage(50)];
const CONSTRAINT_100: [Constraint; 1] = [Constraint::Percentage(100)];
// TODO FIX THIS
const CONSTRAINT_POPUP: [Constraint; 5] = [
Constraint::Min(2),
Constraint::Max(1),
Expand Down Expand Up @@ -764,8 +763,6 @@ pub fn help_box(f: &mut Frame) {
BoxLocation::MiddleCentre,
);

// This is wrong!
// TODO
let split_popup = Layout::default()
.direction(Direction::Vertical)
.constraints([
Expand Down Expand Up @@ -928,14 +925,15 @@ pub fn error(f: &mut Frame, error: AppError, seconds: Option<u8>) {
.block(block)
.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);
f.render_widget(Clear, area);
f.render_widget(paragraph, area);
}

/// 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>>) {
let block = Block::default()
.title("")
Expand Down Expand Up @@ -2580,16 +2578,16 @@ mod tests {
setup.app_data.lock().containers.items[0].name = name.clone();

let expected = [
" ",
" ╭──────────────────────────────────── Confirm Delete ────────────────────────────────────╮ ",
" │ │ ",
" │ Are you sure you want to delete container: container_1_container_1_container_1 │ ",
" │ │ ",
" │ ╭──────────────────────────────╮ ╭─────────────────────────────╮ │ ",
" │ │ (N)o │ │ (Y)es │ │ ",
" │ ╰──────────────────────────────╯ ╰─────────────────────────────╯ │ ",
" ╰────────────────────────────────────────────────────────────────────────────────────────╯ ",
" ",
" ",
" ╭──────────────────────────────────── Confirm Delete ────────────────────────────────────╮ ",
" │ │ ",
" │ Are you sure you want to delete container: container_1_container_1_container_1 │ ",
" │ │ ",
" │ ╭──────────────────────────────╮ ╭─────────────────────────────╮ │ ",
" │ │ (N)o │ │ (Y)es │ │ ",
" │ ╰──────────────────────────────╯ ╰─────────────────────────────╯ │ ",
" ╰────────────────────────────────────────────────────────────────────────────────────────╯ ",
" ",
];

setup
Expand Down Expand Up @@ -2931,12 +2929,9 @@ mod tests {
if row_index == 1 && result_cell_as_char {
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);
}
if row_index == 3 && result_cell_as_char {
assert_eq!(result_cell.fg, Color::Magenta);
}
if row_index == 4 && result_cell_as_char {
assert_eq!(result_cell.fg, Color::White);
}
Expand Down Expand Up @@ -3124,10 +3119,10 @@ mod tests {
ContainerImage::from("a_long_image_name_for_the_purposes_of_this_test");

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 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮╭─────────────────╮",
"│⚪ 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 │",
"│ ││ delete │",
"│ ││ │",
Expand Down

0 comments on commit f74ae3f

Please sign in to comment.