aKode: rebranding visibile (nome aKode, v0.1.0, fantasmino nell'intestazione, logo AKODE ANSI Shadow con benvenuto, attribuzione open-bot-avatar in NOTICE)
Some checks failed
blocking-ci / Bazel (push) Has been cancelled
blocking-ci / Blob size policy (push) Has been cancelled
blocking-ci / cargo-deny (push) Has been cancelled
blocking-ci / Codespell (push) Has been cancelled
blocking-ci / repo-checks (push) Has been cancelled
blocking-ci / rust-ci (push) Has been cancelled
blocking-ci / sdk (push) Has been cancelled
blocking-ci / CI required (push) Has been cancelled
postmerge-ci / rust-ci-full (push) Has been cancelled
postmerge-ci / v8-canary (push) Has been cancelled
postmerge-ci / Postmerge CI results (push) Has been cancelled
Some checks failed
blocking-ci / Bazel (push) Has been cancelled
blocking-ci / Blob size policy (push) Has been cancelled
blocking-ci / cargo-deny (push) Has been cancelled
blocking-ci / Codespell (push) Has been cancelled
blocking-ci / repo-checks (push) Has been cancelled
blocking-ci / rust-ci (push) Has been cancelled
blocking-ci / sdk (push) Has been cancelled
blocking-ci / CI required (push) Has been cancelled
postmerge-ci / rust-ci-full (push) Has been cancelled
postmerge-ci / v8-canary (push) Has been cancelled
postmerge-ci / Postmerge CI results (push) Has been cancelled
Testi verso il modello e istruzioni di sistema invariati. Nomi interni (crate, binario codex, ~/.codex, CODEX_*) invariati fino alla fase 5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -369,9 +369,9 @@ impl AuthModeWidget {
|
||||
fn render_pick_mode(&self, area: Rect, buf: &mut Buffer) {
|
||||
let mut lines: Vec<Line> =
|
||||
if self.bedrock_setup_enabled || self.gcp_setup_enabled || self.gateway_setup_enabled {
|
||||
vec![" Choose how you want to use Codex.".into(), "".into()]
|
||||
vec![" Choose how you want to use aKode.".into(), "".into()]
|
||||
} else {
|
||||
vec![" Connect an API key to use Codex.".into(), "".into()]
|
||||
vec![" Connect an API key to use aKode.".into(), "".into()]
|
||||
};
|
||||
|
||||
let options_start = lines.len();
|
||||
@@ -480,7 +480,7 @@ impl AuthModeWidget {
|
||||
let lines = vec![
|
||||
"✓ API key configured".fg(Color::Green).into(),
|
||||
"".into(),
|
||||
" Codex will use usage-based billing with your API key.".into(),
|
||||
" aKode will use usage-based billing with your API key.".into(),
|
||||
];
|
||||
|
||||
Paragraph::new(lines)
|
||||
@@ -983,7 +983,7 @@ mod tests {
|
||||
rows.pop();
|
||||
}
|
||||
insta::assert_snapshot!(rows.join("\n"), @r###"
|
||||
Choose how you want to use Codex.
|
||||
Choose how you want to use aKode.
|
||||
|
||||
1. Use an OpenAI API key
|
||||
Pay for what you use
|
||||
|
||||
@@ -358,9 +358,9 @@ impl BedrockState {
|
||||
let mut footer = Vec::new();
|
||||
match &self.view {
|
||||
BedrockView::GovCloudWarning(_) => {
|
||||
lines = vec!["Using Codex with AWS GovCloud".bold().into(), "".into()];
|
||||
lines = vec!["Using aKode with AWS GovCloud".bold().into(), "".into()];
|
||||
lines.push(Line::from(vec![
|
||||
"You are using Codex with AWS GovCloud. Please ensure you or your administrator have read the ".into(),
|
||||
"You are using aKode with AWS GovCloud. Please ensure you or your administrator have read the ".into(),
|
||||
"application configuration and security guidance"
|
||||
.cyan()
|
||||
.underlined(),
|
||||
|
||||
@@ -44,14 +44,14 @@ fn gov_cloud_guidance_scrolls_in_short_panes() {
|
||||
!state.handle_guidance_key_event(&KeyEvent::new(KeyCode::Down, KeyModifiers::NONE))
|
||||
);
|
||||
}
|
||||
assert!(seen.contains("Using Codex with AWS"));
|
||||
assert!(seen.contains("Using aKode with AWS"));
|
||||
assert!(seen.contains("proceeding."));
|
||||
assert!(seen.contains(GOV_CLOUD_GUIDANCE_URL));
|
||||
for _ in 0..20 {
|
||||
state.handle_guidance_key_event(&KeyEvent::new(KeyCode::Up, KeyModifiers::NONE));
|
||||
render_visible_at(&state, area);
|
||||
}
|
||||
assert!(render_visible_at(&state, area).starts_with("Using Codex with AWS"));
|
||||
assert!(render_visible_at(&state, area).starts_with("Using aKode with AWS"));
|
||||
}
|
||||
assert_eq!(render_visible_at(&state, area), initial);
|
||||
state.handle_guidance_key_event(&KeyEvent::new(KeyCode::Down, KeyModifiers::NONE));
|
||||
|
||||
@@ -71,7 +71,7 @@ impl GcpState {
|
||||
Some((&self.location, " Location (optional): ", "global")),
|
||||
),
|
||||
GcpView::Credentials => (
|
||||
"Enter an absolute file path on the host running Codex, or press Enter to use Application Default Credentials (ADC).",
|
||||
"Enter an absolute file path on the host running aKode, or press Enter to use Application Default Credentials (ADC).",
|
||||
Some((&self.credential_file, " Credential file (optional): ", "")),
|
||||
),
|
||||
GcpView::Configuring(_) => ("Validating credentials and saving configuration…", None),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
//! Fixed shortcuts used before users have had a chance to configure Codex.
|
||||
|
||||
use crossterm::event::KeyCode;
|
||||
use crossterm::event::KeyModifiers;
|
||||
|
||||
use crate::key_hint;
|
||||
use crate::key_hint::KeyBinding;
|
||||
@@ -31,10 +30,3 @@ pub(crate) const QUIT: [KeyBinding; 3] = [
|
||||
key_hint::ctrl(KeyCode::Char('c')),
|
||||
key_hint::ctrl(KeyCode::Char('d')),
|
||||
];
|
||||
pub(crate) const TOGGLE_ANIMATION: [KeyBinding; 2] = [
|
||||
key_hint::ctrl(KeyCode::Char('.')),
|
||||
KeyBinding::new(
|
||||
KeyCode::Char('.'),
|
||||
KeyModifiers::CONTROL.union(KeyModifiers::SHIFT),
|
||||
),
|
||||
];
|
||||
|
||||
@@ -148,7 +148,6 @@ impl OnboardingScreen {
|
||||
let mut steps: Vec<Step> = Vec::new();
|
||||
steps.push(Step::Welcome(WelcomeWidget::new(
|
||||
!matches!(login_status, LoginStatus::NotAuthenticated),
|
||||
tui.frame_requester(),
|
||||
local_settings.tui.animations && local_settings.tui.effects.welcome,
|
||||
)));
|
||||
#[cfg(target_os = "windows")]
|
||||
|
||||
@@ -3,7 +3,7 @@ source: tui/src/onboarding/gateway_tests.rs
|
||||
assertion_line: 40
|
||||
expression: "screen(&widget, 8)"
|
||||
---
|
||||
Choose how you want to use Codex.
|
||||
Choose how you want to use aKode.
|
||||
|
||||
> 1. Use an OpenAI API key
|
||||
2. Use Amazon Bedrock
|
||||
|
||||
@@ -4,7 +4,7 @@ expression: terminal.backend().to_string()
|
||||
---
|
||||
> Set up Google Cloud Vertex AI
|
||||
|
||||
Enter an absolute file path on the host running Codex, or press Enter to
|
||||
Enter an absolute file path on the host running aKode, or press Enter to
|
||||
use Application Default Credentials (ADC).
|
||||
|
||||
Credential file (optional):
|
||||
|
||||
@@ -5,7 +5,7 @@ expression: terminal.backend().to_string()
|
||||
> Set up Google Cloud Vertex AI
|
||||
|
||||
Enter an absolute file path on the
|
||||
host running Codex, or press Enter to
|
||||
host running aKode, or press Enter to
|
||||
use Application Default Credentials
|
||||
(ADC).
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ source: tui/src/onboarding/gcp_tests.rs
|
||||
assertion_line: 34
|
||||
expression: terminal.backend().to_string()
|
||||
---
|
||||
Choose how you want to use Codex.
|
||||
Choose how you want to use aKode.
|
||||
|
||||
> 1. Use an OpenAI API key
|
||||
Pay for what you use
|
||||
|
||||
@@ -3,7 +3,7 @@ source: tui/src/onboarding/gcp_tests.rs
|
||||
assertion_line: 34
|
||||
expression: terminal.backend().to_string()
|
||||
---
|
||||
Choose how you want to use Codex.
|
||||
Choose how you want to use aKode.
|
||||
|
||||
1. Use an OpenAI API key
|
||||
2. Use Amazon Bedrock
|
||||
|
||||
@@ -3,7 +3,7 @@ source: tui/src/onboarding/gcp_tests.rs
|
||||
assertion_line: 34
|
||||
expression: terminal.backend().to_string()
|
||||
---
|
||||
Connect an API key to use Codex.
|
||||
Connect an API key to use aKode.
|
||||
|
||||
> 1. Use an OpenAI API key
|
||||
Pay for what you use
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
source: tui/src/onboarding/bedrock_tests.rs
|
||||
expression: render_visible(&state)
|
||||
---
|
||||
Using Codex with AWS GovCloud
|
||||
Using aKode with AWS GovCloud
|
||||
|
||||
You are using Codex with AWS GovCloud. Please ensure you or your
|
||||
You are using aKode with AWS GovCloud. Please ensure you or your
|
||||
administrator have read the application configuration and security
|
||||
guidance before proceeding.
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
source: tui/src/onboarding/bedrock_tests.rs
|
||||
expression: initial
|
||||
---
|
||||
Using Codex with AWS
|
||||
Using aKode with AWS
|
||||
GovCloud
|
||||
|
||||
You are using Codex with
|
||||
You are using aKode with
|
||||
> Acknowledge
|
||||
↑/↓ scroll · enter
|
||||
|
||||
@@ -7,7 +7,7 @@ expression: terminal.backend()
|
||||
Folder access
|
||||
/workspace/project
|
||||
|
||||
Trust this folder? Codex can read, edit, and run files here,
|
||||
Trust this folder? aKode can read, edit, and run files here,
|
||||
subject to your permission settings. Folder settings can run code
|
||||
automatically, even without a model request. Continue only if you
|
||||
trust these files. Your trust decision will be saved.
|
||||
|
||||
@@ -4,7 +4,7 @@ expression: "terminal.backend().to_string().replace('\\\\', \"/\")"
|
||||
---
|
||||
Folder access
|
||||
workspace/…/repository
|
||||
Trust this folder? Codex can read,
|
||||
Trust this folder? aKode can read,
|
||||
edit, and run files here, subject to
|
||||
your permission settings. Folder
|
||||
settings can run code automatically,
|
||||
|
||||
@@ -8,7 +8,7 @@ expression: "terminal.backend().to_string().replace('\\\\', \"/\")"
|
||||
Git project. Trusting will apply to
|
||||
the repository root:
|
||||
workspace/…/repository
|
||||
Trust this folder? Codex can read,
|
||||
Trust this folder? aKode can read,
|
||||
edit, and run files here, subject to
|
||||
your permission settings. Folder
|
||||
settings can run code automatically,
|
||||
|
||||
@@ -7,7 +7,7 @@ expression: "terminal.backend().to_string().replace('\\\\', \"/\")"
|
||||
Git project. Trusting will apply to
|
||||
the repository root:
|
||||
workspace/…/repository
|
||||
Trust this folder? Codex can read,
|
||||
Trust this folder? aKode can read,
|
||||
edit, and run files here, subject to
|
||||
your permission settings. Folder
|
||||
settings can run code automatically,
|
||||
|
||||
@@ -6,7 +6,7 @@ expression: terminal.backend()
|
||||
Folder access
|
||||
/workspace/project
|
||||
|
||||
Trust this folder? Codex can read, edit, and run files here,
|
||||
Trust this folder? aKode can read, edit, and run files here,
|
||||
subject to your permission settings. Folder settings can run code
|
||||
automatically, even without a model request. Continue only if you
|
||||
trust these files. Your trust decision will be saved.
|
||||
|
||||
@@ -10,7 +10,7 @@ expression: "terminal.backend().to_string().lines().map(str::trim_end).collect::
|
||||
apply to the repository root:
|
||||
/srv/remote/project
|
||||
|
||||
Trust this folder? Codex can read, edit, and run files here,
|
||||
Trust this folder? aKode can read, edit, and run files here,
|
||||
subject to your permission settings. Folder settings can run code
|
||||
automatically, even without a model request. Continue only if you
|
||||
trust these files. Your trust decision will be saved.
|
||||
|
||||
@@ -6,7 +6,7 @@ expression: terminal.backend()
|
||||
Folder access
|
||||
/workspace/project
|
||||
|
||||
Trust this folder? Codex can read, edit, and run files here,
|
||||
Trust this folder? aKode can read, edit, and run files here,
|
||||
subject to your permission settings. Folder settings can run code
|
||||
automatically, even without a model request. Continue only if you
|
||||
trust these files. Your trust decision will be saved.
|
||||
|
||||
@@ -2,24 +2,11 @@
|
||||
source: tui/src/onboarding/welcome.rs
|
||||
expression: visible.trim_end()
|
||||
---
|
||||
⢀⣀⣠⣤⣤⣤⣤⣤⣤⣀⣀
|
||||
⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⡀
|
||||
⢀⣠⣾⣿⣿⣿⣿⡿⠟⠛⠋⠉⠉⠙⠛⠛⠿⣿⣿⣿⣿⣿⣷⡄
|
||||
⣠⣾⣿⣿⣿⠿⠋ ⠉⠛⣿⣿⣿⣿⣷⡀
|
||||
⣰⣿⣿⣿⡟⠁ ⠹⣿⣿⣿⣿⡄
|
||||
⣼⣿⣿⣿⠟ ⣀⣤⡀ ⠈⢿⣿⣿⣷⡀
|
||||
⢠⣿⣿⣿⡟ ⣿⣿⣿⣄ ⠘⣿⣿⣿⣧
|
||||
⢸⣿⣿⣿⠁ ⠙⣿⣿⣿⣆ ⢿⣿⣿⣿
|
||||
⢾⣿⣿⣿ ⢸⣿⣿⣿⠆ ⢸⣿⣿⣿⠆
|
||||
⣾⣿⣿⣿ ⣠⣿⣿⣿⠏ ⢀⣀⣀⣀⣀⣀⣀⡀ ⢸⣿⣿⣿
|
||||
⠸⣿⣿⣿⡆ ⢰⣿⣿⣿⠇ ⣿⣿⣿⣿⣿⣿⣿⣿⡆ ⢀⣿⣿⣿⡟
|
||||
⢻⣿⣿⣿⣄ ⠉⠛⠁ ⠙⠛⠛⠛⠛⠛⠛⠋ ⢀⣼⣿⣿⣿⠃
|
||||
⠈⢻⣿⣿⣿⣦⡀ ⣠⣾⣿⣿⣿⠇
|
||||
⠻⣿⣿⣿⣿⣤⣀ ⢀⣠⣾⣿⣿⣿⡿⠃
|
||||
⠈⠻⣿⣿⣿⣿⣷⣶⣤⣄⣀⣀⣀⢀⣀⣠⣤⣴⣿⣿⣿⣿⣿⠛
|
||||
⠙⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋
|
||||
⠉⠙⠛⠿⠿⠿⠿⠿⠿⠿⠛⠋⠁
|
||||
█████╗ ██╗ ██╗ ██████╗ ██████╗ ███████╗
|
||||
▄▄████▄▄ ██╔══██╗██║ ██╔╝██╔═══██╗██╔══██╗██╔════╝
|
||||
██▀▀██▀▀██ ███████║█████╔╝ ██║ ██║██║ ██║█████╗
|
||||
██▄▄██▄▄██ ██╔══██║██╔═██╗ ██║ ██║██║ ██║██╔══╝
|
||||
██▀████▀██ ██║ ██║██║ ██╗╚██████╔╝██████╔╝███████╗
|
||||
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝
|
||||
|
||||
|
||||
|
||||
Welcome to Codex, OpenAI's command-line coding agent
|
||||
Benvenuto in aKode · il tuo agente di coding locale
|
||||
|
||||
@@ -67,7 +67,7 @@ impl WidgetRef for &TrustDirectoryWidget {
|
||||
Trusted project folders can still contribute settings. Skills still load, \
|
||||
and tools follow your permission settings. Opening will not change saved trust."
|
||||
} else {
|
||||
"Trust this folder? Codex can read, edit, and run files here, subject to \
|
||||
"Trust this folder? aKode can read, edit, and run files here, subject to \
|
||||
your permission settings. Folder settings can run code automatically, \
|
||||
even without a model request. Continue only if you trust these files. \
|
||||
Your trust decision will be saved."
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
//! Shared welcome header for the existing sign-in and Bedrock onboarding pickers.
|
||||
//! The logo occupies a fixed stage so its motion never shifts the choices below it.
|
||||
//! The static aKode splash sits above the choices; small viewports show only the welcome line.
|
||||
|
||||
use crossterm::event::KeyEvent;
|
||||
use crossterm::event::KeyEventKind;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::layout::Rect;
|
||||
use ratatui::prelude::Widget;
|
||||
@@ -13,62 +12,36 @@ use ratatui::widgets::Paragraph;
|
||||
use ratatui::widgets::WidgetRef;
|
||||
use ratatui::widgets::Wrap;
|
||||
use std::cell::Cell;
|
||||
use std::cell::RefCell;
|
||||
|
||||
use crate::empty_state_animation::EmptyStateAnimation;
|
||||
use crate::branding;
|
||||
use crate::empty_state_animation::Presentation;
|
||||
use crate::key_hint::KeyBindingListExt;
|
||||
use crate::onboarding::keys;
|
||||
use crate::onboarding::onboarding_screen::KeyboardHandler;
|
||||
use crate::onboarding::onboarding_screen::StepStateProvider;
|
||||
use crate::tui::FrameRequester;
|
||||
|
||||
use super::onboarding_screen::StepState;
|
||||
|
||||
const MIN_ANIMATION_HEIGHT: u16 = 41;
|
||||
const MIN_ANIMATION_WIDTH: u16 = 64;
|
||||
const ANIMATION_WIDTH: u16 = 60;
|
||||
const ANIMATION_HEIGHT: u16 = 21;
|
||||
/// Below this viewport the splash would crowd out the onboarding choices.
|
||||
const MIN_LOGO_HEIGHT: u16 = 24;
|
||||
const INDENT: &str = " ";
|
||||
|
||||
pub(crate) struct WelcomeWidget {
|
||||
pub is_logged_in: bool,
|
||||
animation: RefCell<EmptyStateAnimation>,
|
||||
request_frame: FrameRequester,
|
||||
animations_enabled: bool,
|
||||
show_logo: bool,
|
||||
presentation: Cell<Presentation>,
|
||||
focused: Cell<bool>,
|
||||
layout_area: Cell<Option<Rect>>,
|
||||
}
|
||||
|
||||
impl KeyboardHandler for WelcomeWidget {
|
||||
/// Replay the welcome animation when the existing logo shortcut fires.
|
||||
///
|
||||
/// The key list includes compatibility variants for terminals that report
|
||||
/// modifier bits differently.
|
||||
fn handle_key_event(&mut self, key_event: KeyEvent) {
|
||||
if !self.animations_enabled {
|
||||
return;
|
||||
}
|
||||
if key_event.kind == KeyEventKind::Press && keys::TOGGLE_ANIMATION.is_pressed(key_event) {
|
||||
self.animation.get_mut().start_fresh();
|
||||
self.request_frame.schedule_frame();
|
||||
}
|
||||
}
|
||||
/// The splash is static, so the welcome step has no keys of its own.
|
||||
fn handle_key_event(&mut self, _key_event: KeyEvent) {}
|
||||
}
|
||||
|
||||
impl WelcomeWidget {
|
||||
pub(crate) fn new(
|
||||
is_logged_in: bool,
|
||||
request_frame: FrameRequester,
|
||||
animations_enabled: bool,
|
||||
) -> Self {
|
||||
let mut animation = EmptyStateAnimation::default();
|
||||
animation.start_fresh();
|
||||
pub(crate) fn new(is_logged_in: bool, show_logo: bool) -> Self {
|
||||
Self {
|
||||
is_logged_in,
|
||||
animation: RefCell::new(animation),
|
||||
request_frame,
|
||||
animations_enabled,
|
||||
show_logo,
|
||||
presentation: Cell::new(Presentation::Animated),
|
||||
focused: Cell::new(/*value*/ true),
|
||||
layout_area: Cell::new(None),
|
||||
@@ -80,9 +53,6 @@ impl WelcomeWidget {
|
||||
}
|
||||
|
||||
pub(crate) fn set_presentation(&self, presentation: Presentation) {
|
||||
if presentation == Presentation::Hidden {
|
||||
self.animation.borrow_mut().pause_clock();
|
||||
}
|
||||
self.presentation.set(presentation);
|
||||
}
|
||||
|
||||
@@ -95,40 +65,28 @@ impl WidgetRef for &WelcomeWidget {
|
||||
fn render_ref(&self, area: Rect, buf: &mut Buffer) {
|
||||
Clear.render(area, buf);
|
||||
let layout_area = self.layout_area.get().unwrap_or(area);
|
||||
// Skip the animation entirely when the viewport is too small so we don't clip frames.
|
||||
let show_animation = self.animations_enabled
|
||||
let show_logo = self.show_logo
|
||||
&& self.presentation.get() != Presentation::Hidden
|
||||
&& layout_area.height >= MIN_ANIMATION_HEIGHT
|
||||
&& layout_area.width >= MIN_ANIMATION_WIDTH;
|
||||
&& layout_area.height >= MIN_LOGO_HEIGHT;
|
||||
let faded = !self.focused.get() || self.presentation.get() == Presentation::Faded;
|
||||
|
||||
let presentation = if !show_animation {
|
||||
Presentation::Hidden
|
||||
} else if !self.focused.get() {
|
||||
Presentation::Faded
|
||||
let lines: Vec<Line> = if show_logo {
|
||||
let width = usize::from(area.width).saturating_sub(INDENT.len());
|
||||
branding::splash_lines(width, /*compact*/ true)
|
||||
.into_iter()
|
||||
.map(|line| {
|
||||
let mut spans = vec![INDENT.into()];
|
||||
spans.extend(line.spans);
|
||||
let line = Line::from(spans);
|
||||
if faded { line.dim() } else { line }
|
||||
})
|
||||
.collect()
|
||||
} else {
|
||||
self.presentation.get()
|
||||
vec![Line::from(vec![
|
||||
INDENT.into(),
|
||||
branding::WELCOME_LINE.into(),
|
||||
])]
|
||||
};
|
||||
let stage = Rect::new(area.x, area.y, ANIMATION_WIDTH, ANIMATION_HEIGHT);
|
||||
if let Some(delay) = self
|
||||
.animation
|
||||
.borrow_mut()
|
||||
.render_in(stage, buf, presentation)
|
||||
{
|
||||
self.request_frame.schedule_frame_in(delay);
|
||||
}
|
||||
|
||||
let logo_rows = if show_animation {
|
||||
ANIMATION_HEIGHT + 1
|
||||
} else {
|
||||
0
|
||||
};
|
||||
let mut lines: Vec<Line> = vec![Line::default(); usize::from(logo_rows)];
|
||||
lines.push(Line::from(vec![
|
||||
" ".into(),
|
||||
"Welcome to ".into(),
|
||||
"Codex".bold(),
|
||||
", OpenAI's command-line coding agent".into(),
|
||||
]));
|
||||
|
||||
Paragraph::new(lines)
|
||||
.wrap(Wrap { trim: false })
|
||||
@@ -163,47 +121,36 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn welcome_renders_animation_on_first_draw() {
|
||||
let widget = WelcomeWidget::new(
|
||||
/*is_logged_in*/ false,
|
||||
FrameRequester::test_dummy(),
|
||||
/*animations_enabled*/ true,
|
||||
);
|
||||
let area = Rect::new(0, 0, MIN_ANIMATION_WIDTH, MIN_ANIMATION_HEIGHT);
|
||||
fn welcome_renders_logo_on_first_draw() {
|
||||
let widget = WelcomeWidget::new(/*is_logged_in*/ false, /*show_logo*/ true);
|
||||
let area = Rect::new(0, 0, /*width*/ 64, MIN_LOGO_HEIGHT);
|
||||
let mut buf = Buffer::empty(area);
|
||||
(&widget).render_ref(area, &mut buf);
|
||||
|
||||
let welcome_row = row_containing(&buf, "Welcome");
|
||||
assert_eq!(welcome_row, Some(ANIMATION_HEIGHT + 1));
|
||||
// Six banner rows and a spacer precede the welcome line.
|
||||
let welcome_row = row_containing(&buf, "Benvenuto");
|
||||
assert_eq!(welcome_row, Some(7));
|
||||
assert_eq!(row_containing(&buf, "╚═╝"), Some(5));
|
||||
widget.set_focused(/*focused*/ false);
|
||||
(&widget).render_ref(area, &mut buf);
|
||||
assert_eq!(row_containing(&buf, "Welcome"), welcome_row);
|
||||
assert_eq!(row_containing(&buf, "Benvenuto"), welcome_row);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn welcome_skips_animation_below_height_breakpoint() {
|
||||
let widget = WelcomeWidget::new(
|
||||
/*is_logged_in*/ false,
|
||||
FrameRequester::test_dummy(),
|
||||
/*animations_enabled*/ true,
|
||||
);
|
||||
let area = Rect::new(0, 0, MIN_ANIMATION_WIDTH, MIN_ANIMATION_HEIGHT - 1);
|
||||
fn welcome_skips_logo_below_height_breakpoint() {
|
||||
let widget = WelcomeWidget::new(/*is_logged_in*/ false, /*show_logo*/ true);
|
||||
let area = Rect::new(0, 0, /*width*/ 64, MIN_LOGO_HEIGHT - 1);
|
||||
let mut buf = Buffer::empty(area);
|
||||
(&widget).render_ref(area, &mut buf);
|
||||
|
||||
let welcome_row = row_containing(&buf, "Welcome");
|
||||
let welcome_row = row_containing(&buf, "Benvenuto");
|
||||
assert_eq!(welcome_row, Some(0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn welcome_logo_layout() {
|
||||
let (width, height) = (160, 48);
|
||||
let widget = WelcomeWidget::new(
|
||||
/*is_logged_in*/ false,
|
||||
FrameRequester::test_dummy(),
|
||||
/*animations_enabled*/ true,
|
||||
);
|
||||
// The first focused draw shows the intact logo at exactly zero elapsed time.
|
||||
let widget = WelcomeWidget::new(/*is_logged_in*/ false, /*show_logo*/ true);
|
||||
let area = Rect::new(/*x*/ 0, /*y*/ 0, width, height);
|
||||
let mut buf = Buffer::empty(area);
|
||||
(&widget).render_ref(area, &mut buf);
|
||||
|
||||
Reference in New Issue
Block a user