diff options
| author | denis <denismaximov98@gmail.com> | 2021-05-01 14:44:43 +0300 |
|---|---|---|
| committer | denis <denismaximov98@gmail.com> | 2021-05-01 14:44:43 +0300 |
| commit | f85822972ad6ed19f94bc1b30a7120bcd4b091e0 (patch) | |
| tree | 7b65e9da4d56a9c87ab5829a6389ac28133cf940 /src/tests | |
| parent | chore: painless merge this time (diff) | |
| download | sl0ppij-f85822972ad6ed19f94bc1b30a7120bcd4b091e0.tar.gz sl0ppij-f85822972ad6ed19f94bc1b30a7120bcd4b091e0.tar.xz sl0ppij-f85822972ad6ed19f94bc1b30a7120bcd4b091e0.zip | |
chore: cleanup, fix: the tests finally pass
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/fakes.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/tests/fakes.rs b/src/tests/fakes.rs index c9504a98..e00de017 100644 --- a/src/tests/fakes.rs +++ b/src/tests/fakes.rs @@ -8,6 +8,8 @@ use std::time::{Duration, Instant}; use crate::os_input_output::OsApi; use crate::tests::possible_tty_inputs::{get_possible_tty_inputs, Bytes}; +use crate::utils::shared::colors; +use zellij_tile::data::{Palette, PaletteSource, Theme}; use crate::tests::utils::commands::{QUIT, SLEEP}; @@ -73,6 +75,7 @@ pub struct FakeInputOutput { last_snapshot_time: Arc<Mutex<Instant>>, should_trigger_sigwinch: Arc<(Mutex<bool>, Condvar)>, sigwinch_event: Option<PositionAndSize>, + palette: Arc<Mutex<Palette>>, } impl FakeInputOutput { @@ -81,6 +84,21 @@ impl FakeInputOutput { let last_snapshot_time = Arc::new(Mutex::new(Instant::now())); let stdout_writer = FakeStdoutWriter::new(last_snapshot_time.clone()); win_sizes.insert(0, winsize); // 0 is the current terminal + let palette: Palette = Palette { + source: PaletteSource::Default, + theme: Theme::Dark, + fg: colors::BRIGHT_GRAY, + bg: colors::GRAY, + black: colors::BLACK, + red: colors::RED, + green: colors::GREEN, + yellow: colors::GRAY, + blue: colors::GRAY, + magenta: colors::GRAY, + cyan: colors::GRAY, + white: colors::WHITE, + orange: colors::ORANGE, + }; FakeInputOutput { read_buffers: Arc::new(Mutex::new(HashMap::new())), stdin_writes: Arc::new(Mutex::new(HashMap::new())), @@ -93,6 +111,7 @@ impl FakeInputOutput { possible_tty_inputs: get_possible_tty_inputs(), should_trigger_sigwinch: Arc::new((Mutex::new(false), Condvar::new())), sigwinch_event: None, + palette: Arc::new(Mutex::new(palette)), } } pub fn with_tty_inputs(mut self, tty_inputs: HashMap<u16, Bytes>) -> Self { @@ -235,4 +254,22 @@ impl OsApi for FakeInputOutput { cb(); } } + fn load_palette(&self) -> Palette { + let palette: Palette = Palette { + source: PaletteSource::Default, + theme: Theme::Dark, + fg: colors::BRIGHT_GRAY, + bg: colors::GRAY, + black: colors::BLACK, + red: colors::RED, + green: colors::GREEN, + yellow: colors::GRAY, + blue: colors::GRAY, + magenta: colors::GRAY, + cyan: colors::GRAY, + white: colors::WHITE, + orange: colors::ORANGE, + }; + palette + } } |
