generated from GarandPLG/rust-flake-template
Update formatting to use 4‑space indentation
- Adjust rustfmt.toml to set tab_spaces = 4. - Reformat imports, struct definitions, function bodies, and match arms across the project to match the new style (aligned fields, added spacing, etc.). - Ensure all code complies with the updated rustfmt settings.
This commit is contained in:
1 parent
a981663152
commit
73f544d5d6
19 files changed
+90
-85
No files matched your search
+1
-1
@@ -112,7 +112,7 @@ Zaktualizowano instrukcje agentów, mapę i opis testów. Nie zmieniano mechanik
|
||||
|
||||
## 2026-10-19 — formatowanie Rust z wcięciami po 2 spacje
|
||||
|
||||
Dodano `rustfmt.toml` z uzgodnionymi opcjami: edycja i styl 2024, `max_width = 100`, `hard_tabs = false`, `tab_spaces = 2`, zakończenia Unix, sortowanie importów i modułów oraz domyślne heurystyki krótkich konstrukcji. Zastosowano `nix develop -c cargo fmt --all` do źródeł i testów (56 zmienionych plików Rust). Zaktualizowano instrukcje agentów i mapę konfiguracji projektu.
|
||||
Dodano `rustfmt.toml` z uzgodnionymi opcjami: edycja i styl 2024, `max_width = 100`, `hard_tabs = false`, `tab_spaces = 4`, zakończenia Unix, sortowanie importów i modułów oraz domyślne heurystyki krótkich konstrukcji. Zastosowano `nix develop -c cargo fmt --all` do źródeł i testów (56 zmienionych plików Rust). Zaktualizowano instrukcje agentów i mapę konfiguracji projektu.
|
||||
|
||||
Weryfikacja przez `nix develop -c`: `cargo fmt --all -- --check`, `cargo check --all-targets` i `cargo test --all-targets` zakończone sukcesem; 45 testów zaliczonych. Nie wprowadzano zmian mechanik ani zależności. Nie powtarzano Clippy ani ręcznej sesji TUI przy zmianie formatowania.
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ style_edition = "2024"
|
||||
|
||||
max_width = 100
|
||||
hard_tabs = false
|
||||
tab_spaces = 2
|
||||
tab_spaces = 4
|
||||
newline_style = "Unix"
|
||||
|
||||
reorder_imports = true
|
||||
|
||||
+2
-1
@@ -76,7 +76,8 @@ impl App {
|
||||
fn draw(&mut self, frame: &mut Frame<'_>) {
|
||||
let window_area: Rect = frame.area();
|
||||
|
||||
if window_area.width != self.window_area.width || window_area.height != self.window_area.height
|
||||
if window_area.width != self.window_area.width
|
||||
|| window_area.height != self.window_area.height
|
||||
{
|
||||
self.window_area = window_area;
|
||||
if self.states.is_none() {
|
||||
|
||||
@@ -14,10 +14,12 @@ pub fn main_menu_keybindings(app: &mut App, event: &KeyEvent) {
|
||||
|
||||
match action {
|
||||
Action::Up => {
|
||||
states.main_menu.selected_view = states.main_menu.selected_view.saturating_sub(1).max(1);
|
||||
states.main_menu.selected_view =
|
||||
states.main_menu.selected_view.saturating_sub(1).max(1);
|
||||
}
|
||||
Action::Down => {
|
||||
states.main_menu.selected_view = states.main_menu.selected_view.saturating_add(1).min(3);
|
||||
states.main_menu.selected_view =
|
||||
states.main_menu.selected_view.saturating_add(1).min(3);
|
||||
}
|
||||
Action::Space => {
|
||||
let selected_view: usize = states.main_menu.selected_view;
|
||||
|
||||
@@ -85,7 +85,8 @@ pub fn skirmish_keybindings(app: &mut App, key_event: &KeyEvent) -> () {
|
||||
match action {
|
||||
Action::Recruitment | Action::Esc => states.skirmish.recruitment_view = false,
|
||||
Action::Enter => {
|
||||
let coords: (usize, usize) = states.skirmish.board.get_focused_cell().get_coords();
|
||||
let coords: (usize, usize) =
|
||||
states.skirmish.board.get_focused_cell().get_coords();
|
||||
states.skirmish.recruit_miner(coords, Players::Player);
|
||||
}
|
||||
_ => common_keybindings(app, action),
|
||||
@@ -96,13 +97,15 @@ pub fn skirmish_keybindings(app: &mut App, key_event: &KeyEvent) -> () {
|
||||
match action {
|
||||
Action::Building | Action::Esc => states.skirmish.building_view = false,
|
||||
Action::Enter => {
|
||||
let coords: (usize, usize) = states.skirmish.board.get_focused_cell().get_coords();
|
||||
let coords: (usize, usize) =
|
||||
states.skirmish.board.get_focused_cell().get_coords();
|
||||
states
|
||||
.skirmish
|
||||
.start_mine_construction(coords, Players::Player);
|
||||
}
|
||||
Action::Delete => {
|
||||
let coords: (usize, usize) = states.skirmish.board.get_focused_cell().get_coords();
|
||||
let coords: (usize, usize) =
|
||||
states.skirmish.board.get_focused_cell().get_coords();
|
||||
states
|
||||
.skirmish
|
||||
.cancel_mine_construction(coords, Players::Player);
|
||||
|
||||
@@ -61,7 +61,8 @@ impl SkirmishState {
|
||||
Players::Enemy => &self.enemy_resources,
|
||||
Players::Unclaimed => return false,
|
||||
};
|
||||
resources.can_afford(Mine::COST) && self.board.can_build_at(coords, owner, BuildingTerrain::Ore)
|
||||
resources.can_afford(Mine::COST)
|
||||
&& self.board.can_build_at(coords, owner, BuildingTerrain::Ore)
|
||||
}
|
||||
|
||||
pub fn start_mine_construction(&mut self, coords: (usize, usize), owner: Players) -> bool {
|
||||
|
||||
@@ -5,7 +5,8 @@ use crate::app::{
|
||||
skirmish_states::{
|
||||
CellSizes, MarkedCells, MoveFocusedCell, Players, ZoomLevel,
|
||||
structures::{
|
||||
BaseBuilding, BuildingTerrain, MineConstruction, Ore, Stone, Structure, Structures, Tunnel,
|
||||
BaseBuilding, BuildingTerrain, MineConstruction, Ore, Stone, Structure, Structures,
|
||||
Tunnel,
|
||||
},
|
||||
tasks::{DiggingTask, MovingTask, Task, Tasks},
|
||||
units::{MinerUnit, Unit, Units},
|
||||
@@ -58,8 +59,7 @@ impl BoardState {
|
||||
coordinates
|
||||
.into_iter()
|
||||
.filter_map(|(row, col): (usize, usize)| -> Option<&CellWidget> {
|
||||
self
|
||||
.cells
|
||||
self.cells
|
||||
.get(row)
|
||||
.and_then(|cells: &Vec<CellWidget>| -> Option<&CellWidget> { cells.get(col) })
|
||||
})
|
||||
@@ -103,16 +103,14 @@ impl BoardState {
|
||||
(BuildingTerrain::Ore, Structures::Ore(ore)) => {
|
||||
ore.get_owner() == Players::Unclaimed && ore.get_ore_amount() > 0
|
||||
}
|
||||
(BuildingTerrain::Stone, Structures::Stone(_)) => {
|
||||
self
|
||||
(BuildingTerrain::Stone, Structures::Stone(_)) => self
|
||||
.adjacent_cells((row, col))
|
||||
.iter()
|
||||
.any(|cell: &&CellWidget| -> bool {
|
||||
matches!(cell.get_structure(), Structures::Tunnel(_))
|
||||
|| matches!(cell.get_structure(), Structures::Base(_))
|
||||
&& cell.get_structure().get_owner() == owner
|
||||
})
|
||||
}
|
||||
}),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
@@ -132,11 +130,9 @@ impl BoardState {
|
||||
}
|
||||
|
||||
pub fn cancel_mine_construction(&mut self, (row, col): (usize, usize), owner: Players) -> bool {
|
||||
let Some(cell): Option<&mut CellWidget> = self
|
||||
.cells
|
||||
.get_mut(row)
|
||||
.and_then(|cells: &mut Vec<CellWidget>| -> Option<&mut CellWidget> { cells.get_mut(col) })
|
||||
else {
|
||||
let Some(cell): Option<&mut CellWidget> = self.cells.get_mut(row).and_then(
|
||||
|cells: &mut Vec<CellWidget>| -> Option<&mut CellWidget> { cells.get_mut(col) },
|
||||
) else {
|
||||
return false;
|
||||
};
|
||||
if let Structures::MineConstruction(site) = cell.get_structure()
|
||||
@@ -190,7 +186,8 @@ impl BoardState {
|
||||
);
|
||||
let horizontal_offset: Offset = Offset::new(None, Some(h_max_offset));
|
||||
|
||||
let focused_cell: FocusedCell = FocusedCell::new((map_height) / 2, 3, map_height, map_width);
|
||||
let focused_cell: FocusedCell =
|
||||
FocusedCell::new((map_height) / 2, 3, map_height, map_width);
|
||||
|
||||
let mut cells: Vec<Vec<CellWidget>> = Vec::new();
|
||||
|
||||
@@ -204,7 +201,8 @@ impl BoardState {
|
||||
let (focused_row, focused_col) = focused_cell.get_coords();
|
||||
let selected: bool = row == focused_row && col == focused_col;
|
||||
let player_base: bool = row == player_base_coords.0 && col == player_base_coords.1;
|
||||
let player_ore: bool = row == player_base_coords.0 && col == player_base_coords.1 - 1;
|
||||
let player_ore: bool =
|
||||
row == player_base_coords.0 && col == player_base_coords.1 - 1;
|
||||
let enemy_base: bool = row == enemy_base_coords.0 && col == enemy_base_coords.1;
|
||||
let enemy_ore: bool = row == enemy_base_coords.0 && col == enemy_base_coords.1 + 1;
|
||||
|
||||
@@ -270,8 +268,7 @@ impl BoardState {
|
||||
}
|
||||
|
||||
pub fn get_marked_cells_widgets(&self) -> VecDeque<&CellWidget> {
|
||||
self
|
||||
.marked_cells
|
||||
self.marked_cells
|
||||
.marked_cells
|
||||
.iter()
|
||||
.map(|&(row, col)| &self.cells[row][col])
|
||||
@@ -302,8 +299,7 @@ impl BoardState {
|
||||
cell.set_marked(true);
|
||||
}
|
||||
|
||||
self
|
||||
.marked_cells
|
||||
self.marked_cells
|
||||
.marked_cells
|
||||
.push_back((new_cell.0, new_cell.1));
|
||||
}
|
||||
@@ -355,16 +351,13 @@ impl BoardState {
|
||||
self.focused_cell.set_focused_cell(start);
|
||||
let start: (usize, usize) = self.focused_cell.get_coords();
|
||||
self.get_mut_cell(row, col).set_selected(false);
|
||||
self
|
||||
.get_mut_cell(start.0, start.1)
|
||||
self.get_mut_cell(start.0, start.1)
|
||||
.set_selected(true)
|
||||
.set_marked(true);
|
||||
if !self.is_focused_cell_visible() {
|
||||
self
|
||||
.vertical_offset
|
||||
self.vertical_offset
|
||||
.set_value(start.0.saturating_sub(self.rows / 2));
|
||||
self
|
||||
.horizontal_offset
|
||||
self.horizontal_offset
|
||||
.set_value(start.1.saturating_sub(self.cols / 2));
|
||||
}
|
||||
self.marked_cells.selected_unit = selected_unit;
|
||||
@@ -415,13 +408,11 @@ impl BoardState {
|
||||
}
|
||||
|
||||
fn is_walkable(&self, (row, col): (usize, usize)) -> bool {
|
||||
self
|
||||
.cells
|
||||
self.cells
|
||||
.get(row)
|
||||
.and_then(|cells| cells.get(col))
|
||||
.is_some_and(|cell| {
|
||||
self
|
||||
.marked_cells
|
||||
self.marked_cells
|
||||
.selected_unit
|
||||
.as_ref()
|
||||
.is_some_and(|unit: &Units| -> bool { cell.get_structure().can_enter(unit) })
|
||||
@@ -463,7 +454,8 @@ impl BoardState {
|
||||
|
||||
self.horizontal_offset =
|
||||
Offset::new(Some(self.horizontal_offset.get_value()), Some(h_max_offset));
|
||||
self.vertical_offset = Offset::new(Some(self.vertical_offset.get_value()), Some(v_max_offset));
|
||||
self.vertical_offset =
|
||||
Offset::new(Some(self.vertical_offset.get_value()), Some(v_max_offset));
|
||||
}
|
||||
|
||||
pub fn change_zoom(&mut self, new_zoom_level: ZoomLevel) {
|
||||
@@ -478,7 +470,8 @@ impl BoardState {
|
||||
let v_max_offset: usize = Self::max_offset(self.map_height, self.rows);
|
||||
let h_max_offset: usize = Self::max_offset(self.map_width, self.cols);
|
||||
|
||||
self.vertical_offset = Offset::new(Some(self.vertical_offset.get_value()), Some(v_max_offset));
|
||||
self.vertical_offset =
|
||||
Offset::new(Some(self.vertical_offset.get_value()), Some(v_max_offset));
|
||||
self.horizontal_offset =
|
||||
Offset::new(Some(self.horizontal_offset.get_value()), Some(h_max_offset));
|
||||
|
||||
@@ -498,8 +491,7 @@ impl BoardState {
|
||||
let old_cell: (usize, usize) = self.focused_cell.get_coords();
|
||||
let new_cell: (usize, usize) = self.focused_cell.move_focused_cell(direction);
|
||||
|
||||
self
|
||||
.get_mut_cell(old_cell.0, old_cell.1)
|
||||
self.get_mut_cell(old_cell.0, old_cell.1)
|
||||
.set_selected(false);
|
||||
self.get_mut_cell(new_cell.0, new_cell.1).set_selected(true);
|
||||
|
||||
@@ -516,8 +508,7 @@ impl BoardState {
|
||||
.enumerate()
|
||||
.flat_map(|(row, cells)| {
|
||||
cells.iter().enumerate().filter_map(move |(col, cell)| {
|
||||
cell
|
||||
.get_ref_option_unit()
|
||||
cell.get_ref_option_unit()
|
||||
.as_ref()
|
||||
.filter(|unit| !unit.get_ref_tasks().is_empty())
|
||||
.map(|_| (row, col))
|
||||
@@ -557,10 +548,12 @@ impl BoardState {
|
||||
let walkable: bool = structure.can_enter(&unit);
|
||||
// Previously planned stone may already be a tunnel when this task starts.
|
||||
task = match (task, structure) {
|
||||
(Tasks::Digging(dig), _) if walkable => Tasks::Moving(MovingTask::from_digging(dig)),
|
||||
(Tasks::Moving(moving), Structures::Stone(_)) => {
|
||||
Tasks::Digging(DiggingTask::from_moving(moving, unit.get_digging_power()))
|
||||
(Tasks::Digging(dig), _) if walkable => {
|
||||
Tasks::Moving(MovingTask::from_digging(dig))
|
||||
}
|
||||
(Tasks::Moving(moving), Structures::Stone(_)) => Tasks::Digging(
|
||||
DiggingTask::from_moving(moving, unit.get_digging_power()),
|
||||
),
|
||||
(task, _) => task,
|
||||
};
|
||||
match (&mut task, structure) {
|
||||
|
||||
@@ -101,8 +101,7 @@ impl Unit for MinerUnit {
|
||||
|
||||
fn get_tasks_formatted(&self) -> Vec<Line<'_>> {
|
||||
Vec::from(
|
||||
self
|
||||
.tasks
|
||||
self.tasks
|
||||
.iter()
|
||||
.enumerate()
|
||||
.flat_map(|(i, task): (usize, &Tasks)| -> [Line<'_>; 2] {
|
||||
|
||||
@@ -86,8 +86,7 @@ impl Unit for Units {
|
||||
|
||||
impl Unit for Option<Units> {
|
||||
fn get_can_build(&self) -> bool {
|
||||
self
|
||||
.as_ref()
|
||||
self.as_ref()
|
||||
.is_some_and(|unit: &Units| -> bool { unit.get_can_build() })
|
||||
}
|
||||
fn is_unit(&self) -> bool {
|
||||
@@ -133,22 +132,19 @@ impl Unit for Option<Units> {
|
||||
}
|
||||
|
||||
fn get_ref_tasks(&self) -> &VecDeque<Tasks> {
|
||||
self
|
||||
.as_ref()
|
||||
self.as_ref()
|
||||
.expect("attempted to get referenced tasks from `None`")
|
||||
.get_ref_tasks()
|
||||
}
|
||||
|
||||
fn get_mut_tasks(&mut self) -> &mut VecDeque<Tasks> {
|
||||
self
|
||||
.as_mut()
|
||||
self.as_mut()
|
||||
.expect("attempted to get mutable tasks from `None`")
|
||||
.get_mut_tasks()
|
||||
}
|
||||
|
||||
fn get_tasks_formatted(&self) -> Vec<Line<'_>> {
|
||||
self
|
||||
.as_ref()
|
||||
self.as_ref()
|
||||
.map_or(Vec::new(), |u| u.get_tasks_formatted())
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +215,9 @@ pub fn skirmish_view(app: &App, area: Rect, buf: &mut Buffer) {
|
||||
"Paused: adjacent friendly builder required"
|
||||
}
|
||||
)
|
||||
} else if matches!(structure, Structures::Mine(_)) && structure.get_owner() == Players::Player {
|
||||
} else if matches!(structure, Structures::Mine(_))
|
||||
&& structure.get_owner() == Players::Player
|
||||
{
|
||||
"Mine completed".to_string()
|
||||
} else if states
|
||||
.skirmish
|
||||
@@ -237,8 +239,10 @@ pub fn skirmish_view(app: &App, area: Rect, buf: &mut Buffer) {
|
||||
let text: String = if let Structures::Base(base) = cell.get_structure()
|
||||
&& base.get_owner() == Players::Player
|
||||
{
|
||||
let status: &'static str = base.recruitment_status(cell.get_ref_option_unit().is_some());
|
||||
let action: &'static str = if states.skirmish.can_recruit_miner(coords, Players::Player) {
|
||||
let status: &'static str =
|
||||
base.recruitment_status(cell.get_ref_option_unit().is_some());
|
||||
let action: &'static str = if states.skirmish.can_recruit_miner(coords, Players::Player)
|
||||
{
|
||||
"Enter: queue Miner"
|
||||
} else {
|
||||
"Insufficient resources or queue full"
|
||||
|
||||
@@ -34,8 +34,7 @@ impl Widget for BoardWidget<'_> {
|
||||
.split(*col_area);
|
||||
|
||||
for (row_idx, cell_area) in vertical.iter().enumerate() {
|
||||
self
|
||||
.state
|
||||
self.state
|
||||
.cells
|
||||
.get(row_idx + self.state.vertical_offset.get_value())
|
||||
.and_then(|rows| rows.get(col_idx + self.state.horizontal_offset.get_value()))
|
||||
|
||||
@@ -119,8 +119,7 @@ impl CellWidget {
|
||||
let mut lines: Vec<Line<'_>> = self.zoom_level.get_cell_text_area(
|
||||
self.structure.get_tag(),
|
||||
self.structure.get_level(),
|
||||
self
|
||||
.unit
|
||||
self.unit
|
||||
.get_tag()
|
||||
.to_string()
|
||||
.fg(self.unit.get_owner().get_color()),
|
||||
|
||||
@@ -74,10 +74,14 @@ impl KeybindingsWidget {
|
||||
b.as_ref().map(|kb| {
|
||||
let description: &'static str = descriptions
|
||||
.iter()
|
||||
.find(|(action, _): &&(Action, &'static str)| -> bool { *action == kb.action })
|
||||
.find(|(action, _): &&(Action, &'static str)| -> bool {
|
||||
*action == kb.action
|
||||
})
|
||||
.map_or(
|
||||
kb.description,
|
||||
|(_, description): &(Action, &'static str)| -> &'static str { description },
|
||||
|(_, description): &(Action, &'static str)| -> &'static str {
|
||||
description
|
||||
},
|
||||
);
|
||||
Line::from_iter([kb.symbol.red().bold(), " - ".into(), description.into()])
|
||||
})
|
||||
@@ -131,7 +135,8 @@ impl Widget for KeybindingsWidget {
|
||||
return;
|
||||
}
|
||||
|
||||
let block: Block<'_> = Block::default()
|
||||
let block: Block<'_> =
|
||||
Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.title(block_single_title_helper(
|
||||
"Keybindings".to_string(),
|
||||
|
||||
+1
-2
@@ -98,8 +98,7 @@ fn skirmish_keys_move_focus_toggle_panel_and_limit_zoom() {
|
||||
app.view = View::Skirmish;
|
||||
press(&mut app, KeyCode::Right);
|
||||
assert_eq!(
|
||||
app
|
||||
.states_ref()
|
||||
app.states_ref()
|
||||
.unwrap()
|
||||
.skirmish
|
||||
.board
|
||||
|
||||
@@ -16,7 +16,8 @@ use war_in_tunnels::{
|
||||
BoardState, MoveFocusedCell, Players, Resources, ZoomLevel,
|
||||
resources::MINE_PRODUCTION_TICKS,
|
||||
structures::{
|
||||
BaseBuilding, BuildingTerrain, Mine, MineConstruction, Ore, Structure, Structures, Tunnel,
|
||||
BaseBuilding, BuildingTerrain, Mine, MineConstruction, Ore, Structure,
|
||||
Structures, Tunnel,
|
||||
},
|
||||
tasks::Tasks,
|
||||
units::{MinerUnit, Unit, Units},
|
||||
@@ -146,7 +147,9 @@ fn construction_view_starts_paid_build_on_enter_and_stays_open() -> () {
|
||||
&mut app,
|
||||
KeyEvent::new(KeyCode::Char(' '), KeyModifiers::CONTROL),
|
||||
);
|
||||
assert!(available_skirmish_actions(&app.states_ref().unwrap().skirmish).contains(&Action::Enter));
|
||||
assert!(
|
||||
available_skirmish_actions(&app.states_ref().unwrap().skirmish).contains(&Action::Enter)
|
||||
);
|
||||
let mut terminal: Terminal<TestBackend> = Terminal::new(TestBackend::new(160, 50)).unwrap();
|
||||
terminal
|
||||
.draw(|frame: &mut ratatui::Frame<'_>| -> () {
|
||||
|
||||
@@ -36,7 +36,9 @@ fn selecting_miner_switches_help_and_escape_cancels_only_the_route() -> () {
|
||||
!available_skirmish_actions(&app.states_ref().unwrap().skirmish).contains(&Action::Space)
|
||||
);
|
||||
press(&mut app, KeyCode::Left, KeyModifiers::NONE);
|
||||
assert!(available_skirmish_actions(&app.states_ref().unwrap().skirmish).contains(&Action::Space));
|
||||
assert!(
|
||||
available_skirmish_actions(&app.states_ref().unwrap().skirmish).contains(&Action::Space)
|
||||
);
|
||||
press(&mut app, KeyCode::Char(' '), KeyModifiers::NONE);
|
||||
let actions: Vec<Action> = available_skirmish_actions(&app.states_ref().unwrap().skirmish);
|
||||
assert!(actions.contains(&Action::Backspace));
|
||||
@@ -48,8 +50,7 @@ fn selecting_miner_switches_help_and_escape_cancels_only_the_route() -> () {
|
||||
press(&mut app, KeyCode::Esc, KeyModifiers::NONE);
|
||||
assert_eq!(app.view, View::Skirmish);
|
||||
assert!(
|
||||
!app
|
||||
.states_ref()
|
||||
!app.states_ref()
|
||||
.unwrap()
|
||||
.skirmish
|
||||
.board
|
||||
@@ -57,8 +58,7 @@ fn selecting_miner_switches_help_and_escape_cancels_only_the_route() -> () {
|
||||
.marking_cells
|
||||
);
|
||||
assert!(
|
||||
app
|
||||
.states_ref()
|
||||
app.states_ref()
|
||||
.unwrap()
|
||||
.skirmish
|
||||
.board
|
||||
|
||||
+4
-4
@@ -281,8 +281,7 @@ fn miner_symbol_in_tunnel_uses_owner_color_even_when_selected_or_marked() {
|
||||
let mut game = game();
|
||||
let cell = &mut game.board.cells[5][3];
|
||||
cell.set_structure(Structures::Tunnel(Tunnel::new()));
|
||||
cell
|
||||
.set_selected(selected)
|
||||
cell.set_selected(selected)
|
||||
.set_marked(marked)
|
||||
.set_zoom_level(zoom);
|
||||
*cell.get_mut_option_unit() = Some(Units::Miner(MinerUnit::new(owner, (5, 3))));
|
||||
@@ -331,8 +330,9 @@ fn tui_shows_movement_percentage_and_clears_it_after_each_step() {
|
||||
cell.render(area, &mut buffer);
|
||||
buffer
|
||||
};
|
||||
let text =
|
||||
|buffer: &Buffer| -> String { buffer.content.iter().map(|cell| cell.symbol()).collect() };
|
||||
let text = |buffer: &Buffer| -> String {
|
||||
buffer.content.iter().map(|cell| cell.symbol()).collect()
|
||||
};
|
||||
assert!(!text(&render(&game.board, 2)).contains('%'));
|
||||
advance(&mut game, 46);
|
||||
let buffer = render(&game.board, 2);
|
||||
|
||||
@@ -231,7 +231,8 @@ fn recruitment_panel_queues_with_enter_shows_ready_state_and_closes_without_losi
|
||||
let mut app: App = app();
|
||||
press(&mut app, KeyCode::Left, KeyModifiers::NONE);
|
||||
assert!(
|
||||
available_skirmish_actions(&app.states_ref().unwrap().skirmish).contains(&Action::Recruitment)
|
||||
available_skirmish_actions(&app.states_ref().unwrap().skirmish)
|
||||
.contains(&Action::Recruitment)
|
||||
);
|
||||
press(&mut app, KeyCode::Char(' '), KeyModifiers::ALT);
|
||||
assert!(app.states_ref().unwrap().skirmish.recruitment_view);
|
||||
@@ -247,8 +248,7 @@ fn recruitment_panel_queues_with_enter_shows_ready_state_and_closes_without_losi
|
||||
press(&mut app, KeyCode::Right, KeyModifiers::NONE);
|
||||
press(&mut app, KeyCode::Char(' '), KeyModifiers::CONTROL);
|
||||
assert_eq!(
|
||||
app
|
||||
.states_ref()
|
||||
app.states_ref()
|
||||
.unwrap()
|
||||
.skirmish
|
||||
.board
|
||||
@@ -304,8 +304,7 @@ fn recruitment_panel_is_unavailable_off_base_and_during_route_selection() -> ()
|
||||
press(&mut app, KeyCode::Char(' '), KeyModifiers::ALT);
|
||||
assert!(!app.states_ref().unwrap().skirmish.recruitment_view);
|
||||
assert!(
|
||||
app
|
||||
.states_ref()
|
||||
app.states_ref()
|
||||
.unwrap()
|
||||
.skirmish
|
||||
.board
|
||||
|
||||
+3
-1
@@ -115,7 +115,9 @@ fn mining_credits_each_owner_and_stops_when_deposit_is_empty() -> () {
|
||||
structure
|
||||
.text()
|
||||
.iter()
|
||||
.any(|line: &ratatui::text::Line<'_>| -> bool { line.to_string().contains("Ore: 0/5000") })
|
||||
.any(|line: &ratatui::text::Line<'_>| -> bool {
|
||||
line.to_string().contains("Ore: 0/5000")
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user