Merge Android clipboard into opening training

# Conflicts:
#	CHANGELOG.md
#	docs/decisions.md
#	docs/dev/tasks.md
This commit is contained in:
vrubelroman 2026-11-05 21:22:52 +03:00
commit a4521d94ed
32 changed files with 1905 additions and 113 deletions

View file

@ -18738,6 +18738,259 @@ const ROWS: &[[&str; 9]] = &[
"Diapazon −2…2. Moslashuvchan tezlik = koeffitsiyent × (1 + o‘rganilgan ulush), 0,25×–4× bilan cheklangan: to‘liq o‘rganilgan yurishda 1,5 3× beradi; 0 yoki undan kam 0,25× beradi.",
"Ауқым −2…2. Бейімделгіш жылдамдық = коэффициент × (1 + үйренілген үлес), 0,25×–4× шегінде: толық үйренілген жүрісте 1,5 — 3×; 0 немесе одан аз — 0,25×.",
],
[
"plies",
"полуходов",
"demi-coups",
"Halbzüge",
"semimovimientos",
"semimosse",
"meios lances",
"yarim yurishlar",
"жарты жүрістер",
],
[
"Select a move in the PGN tree",
"Выберите ход в дереве PGN",
"Sélectionnez un coup dans l’arbre PGN",
"Wählen Sie einen Zug im PGN-Baum",
"Selecciona una jugada en el árbol PGN",
"Seleziona una mossa nell’albero PGN",
"Selecione um lance na árvore PGN",
"PGN daraxtidan yurishni tanlang",
"PGN ағашынан жүрісті таңдаңыз",
],
[
"Main answer",
"Основной ответ",
"Réponse principale",
"Hauptzug",
"Respuesta principal",
"Risposta principale",
"Resposta principal",
"Asosiy javob",
"Негізгі жауап",
],
[
"Make main answer",
"Сделать основным ответом",
"Définir comme réponse principale",
"Als Hauptzug festlegen",
"Establecer como respuesta principal",
"Imposta come risposta principale",
"Definir como resposta principal",
"Asosiy javob qilib belgilash",
"Негізгі жауап етіп белгілеу",
],
[
"Clear override",
"Убрать переопределение",
"Supprimer la surcharge",
"Überschreibung aufheben",
"Quitar anulación",
"Rimuovi sostituzione",
"Remover substituição",
"Almashtirishni bekor qilish",
"Қайта анықтауды жою",
],
[
"Enable",
"Включить",
"Activer",
"Aktivieren",
"Activar",
"Attiva",
"Ativar",
"Yoqish",
"Қосу",
],
[
"Disable",
"Отключить",
"Désactiver",
"Deaktivieren",
"Desactivar",
"Disattiva",
"Desativar",
"O‘chirish",
"Өшіру",
],
[
"Disabled for training",
"Отключено для тренировки",
"Désactivé pour l’entraînement",
"Für das Training deaktiviert",
"Desactivado para el entrenamiento",
"Disattivato per l’allenamento",
"Desativado para treinamento",
"Mashg‘ulot uchun o‘chirilgan",
"Жаттығу үшін өшірілген",
],
[
"PGN tree",
"Дерево PGN",
"Arbre PGN",
"PGN-Baum",
"Árbol PGN",
"Albero PGN",
"Árvore PGN",
"PGN daraxti",
"PGN ағашы",
],
[
"Initial position",
"Начальная позиция",
"Position initiale",
"Anfangsstellung",
"Posición inicial",
"Posizione iniziale",
"Posição inicial",
"Boshlang‘ich pozitsiya",
"Бастапқы позиция",
],
[
"main",
"основной",
"principal",
"Hauptzug",
"principal",
"principale",
"principal",
"asosiy",
"негізгі",
],
[
"disabled",
"отключено",
"désactivé",
"deaktiviert",
"desactivado",
"disattivato",
"desativado",
"o‘chirilgan",
"өшірілген",
],
[
"Move analytics",
"Аналитика хода",
"Statistiques du coup",
"Zugstatistik",
"Estadísticas de la jugada",
"Statistiche della mossa",
"Estatísticas do lance",
"Yurish statistikasi",
"Жүріс статистикасы",
],
[
"Select a move to see its learning analytics",
"Выберите ход, чтобы увидеть аналитику его обучения",
"Sélectionnez un coup pour voir ses statistiques d’apprentissage",
"Wählen Sie einen Zug, um seine Lernstatistik zu sehen",
"Selecciona una jugada para ver sus estadísticas de aprendizaje",
"Seleziona una mossa per vedere le sue statistiche di apprendimento",
"Selecione um lance para ver suas estatísticas de aprendizagem",
"O‘rganish statistikasini ko‘rish uchun yurishni tanlang",
"Үйрену статистикасын көру үшін жүрісті таңдаңыз",
],
[
"Shared learning data is not connected",
"Общие данные обучения не подключены",
"Les données d’apprentissage partagées ne sont pas connectées",
"Gemeinsame Lerndaten sind nicht verbunden",
"Los datos de aprendizaje compartidos no están conectados",
"I dati di apprendimento condivisi non sono collegati",
"Os dados de aprendizagem compartilhados não estão conectados",
"Umumiy o‘rganish ma’lumotlari ulanmagan",
"Ортақ үйрену деректері қосылмаған",
],
[
"Learning analytics is kept for the current main answer",
"Аналитика обучения ведётся для текущего основного ответа",
"Les statistiques d’apprentissage sont conservées pour la réponse principale actuelle",
"Lernstatistik wird für den aktuellen Hauptzug geführt",
"Las estadísticas de aprendizaje se guardan para la respuesta principal actual",
"Le statistiche di apprendimento sono conservate per la risposta principale attuale",
"As estatísticas de aprendizagem são mantidas para a resposta principal atual",
"O‘rganish statistikasi joriy asosiy javob uchun saqlanadi",
"Үйрену статистикасы ағымдағы негізгі жауап үшін сақталады",
],
[
"The selected move cannot be the main answer for this position",
"Выбранный ход не может быть основным ответом в этой позиции",
"Le coup sélectionné ne peut pas être la réponse principale pour cette position",
"Der ausgewählte Zug kann in dieser Stellung nicht der Hauptzug sein",
"La jugada seleccionada no puede ser la respuesta principal para esta posición",
"La mossa selezionata non può essere la risposta principale per questa posizione",
"O lance selecionado não pode ser a resposta principal para esta posição",
"Tanlangan yurish bu pozitsiyada asosiy javob bo‘la olmaydi",
"Таңдалған жүріс бұл позицияда негізгі жауап бола алмайды",
],
[
"The selected PGN branch cannot be disabled",
"Выбранную ветку PGN нельзя отключить",
"La variante PGN sélectionnée ne peut pas être désactivée",
"Der ausgewählte PGN-Zweig kann nicht deaktiviert werden",
"La variante PGN seleccionada no se puede desactivar",
"La variante PGN selezionata non può essere disattivata",
"A variante PGN selecionada não pode ser desativada",
"Tanlangan PGN variantini o‘chirish mumkin emas",
"Таңдалған PGN нұсқасын өшіру мүмкін емес",
],
[
"The selected PGN branch cannot be enabled",
"Выбранную ветку PGN нельзя включить",
"La variante PGN sélectionnée ne peut pas être activée",
"Der ausgewählte PGN-Zweig kann nicht aktiviert werden",
"La variante PGN seleccionada no se puede activar",
"La variante PGN selezionata non può essere attivata",
"A variante PGN selecionada não pode ser ativada",
"Tanlangan PGN variantini yoqish mumkin emas",
"Таңдалған PGN нұсқасын қосу мүмкін емес",
],
[
"Next due",
"Следующее повторение",
"Prochaine révision",
"Nächste Wiederholung",
"Próximo repaso",
"Prossimo ripasso",
"Próxima revisão",
"Keyingi takrorlash",
"Келесі қайталау",
],
[
"Response median",
"Медиана времени ответа",
"Médiane du temps de réponse",
"Median der Antwortzeit",
"Mediana del tiempo de respuesta",
"Mediana del tempo di risposta",
"Mediana do tempo de resposta",
"Javob vaqti medianasi",
"Жауап уақытының медианасы",
],
[
"Wrong moves",
"Ошибочные ходы",
"Coups erronés",
"Falsche Züge",
"Jugadas erróneas",
"Mosse errate",
"Lances errados",
"Noto‘g‘ri yurishlar",
"Қате жүрістер",
],
[
"Unknown move",
"Неизвестный ход",
"Coup inconnu",
"Unbekannter Zug",
"Jugada desconocida",
"Mossa sconosciuta",
"Lance desconhecido",
"Noma’lum yurish",
"Белгісіз жүріс",
],
// --- learning dashboard ---
[
"Learning dashboard",
@ -19496,6 +19749,7 @@ mod tests {
include_str!("learning_branches.rs"),
include_str!("learning_charts.rs"),
include_str!("learning_dashboard.rs"),
include_str!("repertoire_editor.rs"),
];
let mut chars = std::collections::BTreeSet::new();
for row in ROWS.iter() {
@ -19573,6 +19827,7 @@ mod tests {
include_str!("learning_branches.rs"),
include_str!("learning_charts.rs"),
include_str!("learning_dashboard.rs"),
include_str!("repertoire_editor.rs"),
include_str!("repertoire_ui.rs"),
include_str!("repertoire_training.rs"),
];

View file

@ -10,6 +10,7 @@ const WIDE_WIDTH: f32 = 900.0;
const HEADER_HEIGHT: f32 = 40.0;
const ROW_HEIGHT: f32 = 24.0;
const BODY_TEXT_SIZE: f32 = 14.0;
const WIDE_NUMERIC_WIDTHS: [f32; 9] = [56.0, 60.0, 80.0, 64.0, 108.0, 96.0, 88.0, 64.0, 136.0];
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct BranchSelection {
@ -161,7 +162,7 @@ fn show_wide(
.max_scroll_height(360.0)
.cell_layout(Layout::left_to_right(Align::Center))
.column(Column::remainder().at_least(120.0).clip(true));
for width in [30.0, 66.0, 70.0, 52.0, 72.0, 46.0, 68.0, 64.0, 136.0] {
for width in WIDE_NUMERIC_WIDTHS {
table = table.column(Column::exact(width).clip(true));
}
table
@ -280,42 +281,39 @@ fn show_details(
("Accuracy", format_percent(row.summary.accuracy_percent)),
("Last trained", format_time(row.last_independent_at)),
];
egui::Grid::new("learning_branches_details")
.num_columns(2)
.spacing([12.0, 5.0])
.show(ui, |ui| {
for (label, value) in details {
ui.add(
egui::Label::new(RichText::new(tr(label)).weak().size(BODY_TEXT_SIZE)).wrap(),
);
ui.add(egui::Label::new(RichText::new(value).size(BODY_TEXT_SIZE)).wrap());
ui.end_row();
}
show_details_rows(ui, &details);
}
fn show_details_rows(ui: &mut Ui, details: &[(&'static str, String)]) {
let label_width = (ui.available_width() * 0.36).clamp(110.0, 160.0);
TableBuilder::new(ui)
.id_salt("learning_branches_details")
.vscroll(false)
.cell_layout(Layout::left_to_right(Align::Min))
.column(Column::exact(label_width).clip(true))
.column(Column::remainder().at_least(80.0).clip(true))
.body(|body| {
body.rows(ROW_HEIGHT * 1.5, details.len(), |mut row| {
let (label, value) = &details[row.index()];
row.col(|ui| {
ui.add(
egui::Label::new(RichText::new(tr(label)).weak().size(BODY_TEXT_SIZE))
.wrap(),
);
});
row.col(|ui| {
ui.add(egui::Label::new(RichText::new(value).size(BODY_TEXT_SIZE)).wrap());
});
});
});
}
fn header_cell(ui: &mut Ui, text: &str, numeric: bool) -> egui::Response {
let text = RichText::new(text).strong().size(BODY_TEXT_SIZE);
if numeric {
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
ui.add(egui::Label::new(text).wrap())
})
.inner
} else {
ui.add(egui::Label::new(text).wrap())
}
fn header_cell(ui: &mut Ui, text: &str, _numeric: bool) -> egui::Response {
ui.add(egui::Label::new(RichText::new(text).strong().size(BODY_TEXT_SIZE)).wrap())
}
fn text_cell(ui: &mut Ui, text: &str, numeric: bool) -> egui::Response {
let text = RichText::new(text).size(BODY_TEXT_SIZE);
if numeric {
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
ui.add(egui::Label::new(text).truncate())
})
.inner
} else {
ui.add(egui::Label::new(text).truncate())
}
fn text_cell(ui: &mut Ui, text: &str, _numeric: bool) -> egui::Response {
ui.add(egui::Label::new(RichText::new(text).size(BODY_TEXT_SIZE)).truncate())
}
fn format_percent(value: Option<f64>) -> String {
@ -535,7 +533,7 @@ mod tests {
fn wide_and_narrow_layouts_stay_in_bounds_in_light_and_dark() {
let fixture = fixture();
for visuals in [egui::Visuals::light(), egui::Visuals::dark()] {
for (width, height) in [(1200.0, 800.0), (640.0, 480.0)] {
for (width, height) in [(1400.0, 900.0), (960.0, 600.0), (640.0, 480.0)] {
let ctx = egui::Context::default();
ctx.set_visuals(visuals.clone());
let mut selected = None;
@ -592,6 +590,99 @@ mod tests {
}
}
#[test]
fn wide_headers_fit_accepted_matrix_in_russian_and_german() {
let cases = [
[
"Ветка",
"Итого",
"Новый",
"Изучается",
"Изучено",
"Не подтверждено",
"К повторению",
"Точность",
"Изучено %",
"Последняя тренировка",
],
[
"Variante",
"Gesamt",
"Neu",
"Lernen",
"Gelernt",
"Unsicher",
"Fällig",
"Genauigkeit",
"Gelernt %",
"Letztes Training",
],
];
for visuals in [egui::Visuals::light(), egui::Visuals::dark()] {
for (width, height) in [(960.0, 600.0), (1400.0, 900.0)] {
for headers in &cases {
let ctx = egui::Context::default();
ctx.set_visuals(visuals.clone());
let output = ctx.run_ui(
egui::RawInput {
screen_rect: Some(egui::Rect::from_min_size(
egui::Pos2::ZERO,
egui::vec2(width, height),
)),
..Default::default()
},
|ui| {
let mut table = TableBuilder::new(ui)
.id_salt("learning_branches_wide_header_test")
.cell_layout(Layout::left_to_right(Align::Center))
.column(Column::remainder().at_least(120.0).clip(true));
for width in WIDE_NUMERIC_WIDTHS {
table = table.column(Column::exact(width).clip(true));
}
table.header(HEADER_HEIGHT, |mut header| {
for (index, key) in headers.iter().enumerate() {
header.col(|ui| {
header_cell(ui, tr(key), index > 0);
});
}
});
},
);
let shapes = output.shapes.clone();
output.drop_without_applying_deltas();
assert_bounds(&shapes, width, height);
for expected in headers {
let (rect, clip, lines) = shapes
.iter()
.find_map(|clipped| match &clipped.shape {
egui::Shape::Text(text)
if text.galley.text().replace('\n', " ") == *expected =>
{
Some((
egui::Rect::from_min_size(text.pos, text.galley.size()),
clipped.clip_rect,
text.galley.text().lines().count(),
))
}
_ => None,
})
.unwrap_or_else(|| {
panic!("missing full header {expected} at {width}x{height}")
});
assert!(lines <= 2, "header wraps too much: {expected}");
assert!(
rect.min.x >= clip.min.x - 0.1
&& rect.min.y >= clip.min.y - 0.1
&& rect.max.x <= clip.max.x + 0.1
&& rect.max.y <= clip.max.y + 0.1,
"clipped header {expected} at {width}x{height}: {rect:?} {clip:?}"
);
}
}
}
}
}
#[test]
fn narrow_details_are_visible_and_click_selects_the_branch() {
let fixture = fixture();
@ -637,6 +728,78 @@ mod tests {
}
}
#[test]
fn narrow_details_keep_long_labels_readable_at_all_widths() {
let cases: Vec<Vec<(&str, String)>> = vec![
vec![
("Новый", "2".to_owned()),
("Изучается", "1".to_owned()),
("Изучено", "4".to_owned()),
("Не подтверждено", "1".to_owned()),
("К повторению", "3".to_owned()),
("Точность", "75 %".to_owned()),
("Последняя тренировка", "2026-11-04 08:26".to_owned()),
],
vec![
("Neu", "2".to_owned()),
("Wird gelernt", "1".to_owned()),
("Gelernt", "4".to_owned()),
("Nicht bestätigt", "1".to_owned()),
("Fällig", "3".to_owned()),
("Genauigkeit", "75 %".to_owned()),
("Zuletzt trainiert", "2026-11-04 08:26".to_owned()),
],
];
for visuals in [egui::Visuals::light(), egui::Visuals::dark()] {
for width in [320.0, 360.0, 420.0, 640.0] {
for details in &cases {
let ctx = egui::Context::default();
ctx.set_visuals(visuals.clone());
let mut expected_label_width = 0.0;
let output = ctx.run_ui(
egui::RawInput {
screen_rect: Some(egui::Rect::from_min_size(
egui::Pos2::ZERO,
egui::vec2(width, 700.0),
)),
..Default::default()
},
|ui| {
egui::CentralPanel::default().show(ui, |ui| {
expected_label_width =
(ui.available_width() * 0.36).clamp(110.0, 160.0);
show_details_rows(ui, details);
});
},
);
let shapes = output.shapes.clone();
output.drop_without_applying_deltas();
assert_bounds(&shapes, width, 700.0);
for (label, _) in details {
let (clip, lines) = shapes
.iter()
.find_map(|clipped| match &clipped.shape {
egui::Shape::Text(text)
if text.galley.text().replace('\n', " ") == *label =>
{
Some((clipped.clip_rect, text.galley.text().lines().count()))
}
_ => None,
})
.unwrap_or_else(|| panic!("missing full label {label} at {width}"));
assert!(
(clip.width() - expected_label_width).abs() < 0.1,
"label column at {width}: {clip:?}, expected {expected_label_width}: {label}"
);
assert!(lines <= 2, "label wraps too much at {width}: {label}");
}
assert!(has_text(&shapes, "2026-11-04 08:26"));
assert!(has_text(&shapes, "75 %"));
}
}
}
}
#[test]
fn null_accuracy_and_last_training_render_as_dashes() {
let fixture = fixture();

View file

@ -11,8 +11,9 @@ use trainer::repertoire::{
BranchLearningAnalytics, LearningAggregate, LearningItemKey, LearningSide, LearningSnapshot,
LearningStore, LearningStoreData, Library, LocalDatePolicy, MoveLearningStatus,
PersistedLearningSnapshot, RepertoireId, RepertoireTree, ScheduledBuckets, SequenceHistograms,
SrsSettings, StatsScope, aggregate_scope, branch_learning_analytics, scheduled_buckets,
scoped_move_learning_analytics, sequence_histograms,
SrsSettings, StatsScope, aggregate_scope, branch_learning_analytics,
log_global_total_invariant, scheduled_buckets, scoped_move_learning_analytics,
sequence_histograms,
};
use crate::i18n::{tr, trf};
@ -68,6 +69,24 @@ struct DashboardData {
labels: HashMap<(RepertoireId, Vec<String>), Vec<String>>,
}
#[cfg(test)]
std::thread_local! {
static GLOBAL_TOTAL_INVARIANT_CALLS: std::cell::Cell<usize> =
const { std::cell::Cell::new(0) };
}
fn log_dashboard_global_total_invariant(global_total: usize, summary: &[SummaryRow]) {
log_global_total_invariant(
global_total,
summary
.iter()
.filter(|row| row.id.is_some())
.map(|row| row.summary.total),
);
#[cfg(test)]
GLOBAL_TOTAL_INVARIANT_CALLS.with(|calls| calls.set(calls.get() + 1));
}
struct MoveRow {
key: LearningItemKey,
san: String,
@ -597,11 +616,13 @@ impl DashboardData {
});
views.push(view);
}
let global_total = global_summary.total;
summary.push(SummaryRow {
id: None,
name: String::new(),
summary: global_summary,
});
log_dashboard_global_total_invariant(global_total, &summary);
Ok(Self {
side,
as_of,
@ -784,9 +805,22 @@ fn error_body(ui: &mut Ui, error: &str) {
);
}
const SUMMARY_HEADER_HEIGHT: f32 = 40.0;
fn summary_number_width(ui: &Ui) -> f32 {
let available_width = ui.available_width();
if available_width < 700.0 {
60.0
} else {
(available_width / 9.0)
.min(108.0)
.min((available_width - 80.0 - 8.0 * ui.spacing().item_spacing.x) / 8.0)
}
}
fn show_summary(ui: &mut Ui, data: &DashboardData, view: &DashboardView) {
let compact = ui.available_width() < 700.0;
let number_width = 60.0;
let number_width = summary_number_width(ui);
let headers = [
"Name",
"Total",
@ -808,7 +842,7 @@ fn show_summary(ui: &mut Ui, data: &DashboardData, view: &DashboardView) {
table = table.column(Column::exact(number_width).clip(true));
}
table
.header(if compact { 40.0 } else { 30.0 }, |mut header| {
.header(SUMMARY_HEADER_HEIGHT, |mut header| {
for (index, key) in headers.into_iter().enumerate() {
header.col(|ui| {
let response = if index == 0 {
@ -1716,6 +1750,25 @@ mod tests {
);
}
#[test]
fn global_total_invariant_runs_on_empty_build_without_changing_data() {
GLOBAL_TOTAL_INVARIANT_CALLS.with(|calls| calls.set(0));
let dashboard = build(&Library::default(), &LearningStoreData::default()).unwrap();
assert_eq!(GLOBAL_TOTAL_INVARIANT_CALLS.with(|calls| calls.get()), 1);
assert_eq!(dashboard.side, LearningSide::White);
assert_eq!(dashboard.as_of, BASE);
assert_eq!(dashboard.timezone, LocalDatePolicy::UTC);
assert_eq!(dashboard.summary.len(), 1);
assert!(dashboard.summary[0].id.is_none());
assert_eq!(dashboard.summary[0].summary, LearningAggregate::default());
assert_eq!(dashboard.views.len(), 1);
assert_eq!(dashboard.views[0].summary, LearningAggregate::default());
assert!(dashboard.names.is_empty());
assert!(dashboard.labels.is_empty());
}
#[test]
fn empty_scope_has_no_false_percentages_or_buckets() {
let dashboard = build(&Library::default(), &LearningStoreData::default()).unwrap();
@ -1919,6 +1972,143 @@ mod tests {
assert_eq!(store.load().unwrap().snapshots.len(), 1);
}
#[test]
fn accepted_summary_headers_fit_full_russian_and_german_words() {
let cases = [
[
"Название",
"Итого",
"Новый",
"Изучается",
"Изучено",
"Не подтверждено",
"К повторению",
"Изучено %",
"Надёжно изучено",
],
[
"Name",
"Gesamt",
"Neu",
"Lernen",
"Gelernt",
"Unsicher",
"Fällig",
"Gelernt %",
"Bestätigt %",
],
];
for visuals in [egui::Visuals::light(), egui::Visuals::dark()] {
for (width, height) in [(960.0, 600.0), (1400.0, 900.0)] {
for headers in &cases {
let ctx = egui::Context::default();
ctx.set_visuals(visuals.clone());
let mut expected_number_width = 0.0;
let output = ctx.run_ui(
egui::RawInput {
screen_rect: Some(egui::Rect::from_min_size(
egui::Pos2::ZERO,
egui::vec2(width, height),
)),
..Default::default()
},
|ui| {
expected_number_width = summary_number_width(ui);
let number_width = expected_number_width;
let mut table = TableBuilder::new(ui)
.id_salt("learning_dashboard_summary_header_test")
.cell_layout(Layout::left_to_right(Align::Center))
.column(Column::remainder().at_least(80.0).clip(true));
for _ in 1..headers.len() {
table = table.column(Column::exact(number_width).clip(true));
}
table.header(SUMMARY_HEADER_HEIGHT, |mut header| {
for (index, key) in headers.iter().enumerate() {
header.col(|ui| {
if index == 0 {
header_cell(ui, tr(key), false)
} else {
summary_metric_header(ui, tr(key), false)
}
.on_hover_text(tr(key));
});
}
});
},
);
let shapes = output.shapes.clone();
output.drop_without_applying_deltas();
for clipped in &shapes {
let bounds = clipped.shape.visual_bounding_rect();
if bounds.is_finite() && bounds.is_positive() {
assert!(
bounds.min.x >= -0.1
&& bounds.min.y >= -0.1
&& bounds.max.x <= width + 0.1
&& bounds.max.y <= height + 0.1,
"summary shape outside {width}x{height}: {bounds:?}"
);
}
}
for (index, &expected) in headers.iter().enumerate() {
let (rect, clip, lines) = shapes
.iter()
.find_map(|clipped| match &clipped.shape {
egui::Shape::Text(text)
if text.galley.text().replace('\n', " ") == expected =>
{
Some((
egui::Rect::from_min_size(text.pos, text.galley.size()),
clipped.clip_rect,
text.galley.text().lines().count(),
))
}
_ => None,
})
.unwrap_or_else(|| {
panic!("missing full summary header {expected} at {width}x{height}")
});
assert!(lines <= 2, "summary header wraps too much: {expected}");
assert!(
text_lines_have_complete_words(&shapes, expected),
"summary header has a one-character fragment: {expected}"
);
assert!(
rect.min.x >= clip.min.x - 0.1
&& rect.min.y >= clip.min.y - 0.1
&& rect.max.x <= clip.max.x + 0.1
&& rect.max.y <= clip.max.y + 0.1,
"clipped summary header {expected}: {rect:?} {clip:?}"
);
assert!(clip.height() >= SUMMARY_HEADER_HEIGHT);
if index == 0 {
assert!(clip.width() >= 80.0);
} else {
assert!(
(clip.width() - expected_number_width).abs() < 0.1,
"numeric width at {width}: {clip:?}"
);
}
}
}
}
}
}
fn text_lines_have_complete_words(
shapes: &[egui::epaint::ClippedShape],
expected: &str,
) -> bool {
shapes.iter().any(|clipped| match &clipped.shape {
egui::Shape::Text(text) if text.galley.text().replace('\n', " ") == expected => text
.galley
.text()
.lines()
.all(|line| line.chars().count() > 1),
_ => false,
})
}
#[test]
fn every_tab_renders_at_both_window_sizes() {
let dir = TestDir::new("layout");
@ -1953,7 +2143,7 @@ mod tests {
loaded_dashboard(library, dir.store(), ScopeSelection::Repertoire(id), data);
let settings = Settings::default();
let ctx = egui::Context::default();
for (width, height) in [(1400.0, 900.0), (640.0, 480.0)] {
for (width, height) in [(1400.0, 900.0), (960.0, 600.0), (640.0, 480.0)] {
for tab in [
DashboardTab::Summary,
DashboardTab::Branches,

View file

@ -407,21 +407,21 @@ impl LearningTrainingUi {
}
}
self.ready_since = None;
if !self.board_shown {
self.board_position = match parse_position(&current) {
Ok(position) => position,
Err(error) => {
self.error = Some(error);
return;
}
};
self.last_move = None;
self.playback = None;
self.pending_automatic = Some(steps);
let Some(first) = steps.front() else {
self.error = Some("automatic context has no visual step".to_owned());
return;
}
self.pending_automatic = None;
self.start_next_automatic(steps, now, 0);
};
self.board_position = match parse_position(&first.from) {
Ok(position) => position,
Err(error) => {
self.error = Some(error);
return;
}
};
self.board_shown = false;
self.pending_automatic = Some(steps);
self.playback = None;
self.last_move = None;
return;
}
self.pending_automatic = None;
@ -923,6 +923,9 @@ impl LearningTrainingUi {
}
fn board_animation_seconds(&self, settings: &Settings) -> f32 {
if self.pending_automatic.is_some() {
return 0.0;
}
match &self.playback {
Some(Playback::Automatic { duration, .. }) => duration.as_secs_f32(),
_ => settings.animation.seconds(),
@ -1216,6 +1219,10 @@ impl LearningTrainingUi {
.playback_deadline()
.map_or(started, |deadline| deadline.max(started));
self.tick_at(at, Duration::ZERO, now());
if self.pending_automatic.is_some() {
self.board_shown = true;
self.tick_at(at, Duration::ZERO, now());
}
if matches!(self.playback, Some(Playback::Wrong { .. })) {
let until = self.playback_deadline().unwrap_or(at);
self.tick_at(until, Duration::ZERO, now());
@ -1224,7 +1231,7 @@ impl LearningTrainingUi {
pub fn debug_hint(&mut self) {
if self.needs_prepare {
self.tick_at(Instant::now(), Duration::ZERO, now());
self.debug_settle();
}
let id = unique_id(self.session.id());
self.request_hint_with_id_at(id, Instant::now(), now());
@ -1232,7 +1239,7 @@ impl LearningTrainingUi {
pub fn debug_moves(&mut self, moves: &str) {
if self.needs_prepare {
self.tick_at(Instant::now(), Duration::ZERO, now());
self.debug_settle();
}
for text in moves.split_whitespace() {
match text {
@ -1516,7 +1523,7 @@ mod tests {
fn answer_current(f: &mut Fixture, at: Instant, happened_at: i64, id: &str) {
let expected = f.ui.session.current_expected_uci().unwrap().to_owned();
assert!(f.ui.play_uci_with_id_at(&expected, id.to_owned(), at, happened_at,));
f.ui.tick_at(at, Duration::ZERO, happened_at);
tick_with_prime(&mut f.ui, at, Duration::ZERO, happened_at);
}
#[test]
@ -1603,6 +1610,35 @@ mod tests {
.drop_without_applying_deltas();
}
fn tick_with_prime(
ui: &mut LearningTrainingUi,
at: Instant,
animation: Duration,
happened_at: i64,
) {
ui.tick_at(at, animation, happened_at);
if ui.pending_automatic.is_none() {
return;
}
let ctx = egui::Context::default();
let settings = Settings::default();
ctx.run_ui(
egui::RawInput {
screen_rect: Some(egui::Rect::from_min_size(
egui::Pos2::ZERO,
egui::vec2(800.0, 800.0),
)),
time: Some(0.0),
..Default::default()
},
|root| ui.board_ui(root, &settings),
)
.drop_without_applying_deltas();
assert!(ui.board_shown);
assert!(ui.board.animation_at(0.0).is_none());
ui.tick_at(at, animation, happened_at);
}
fn automatic_duration(f: &Fixture) -> Duration {
match &f.ui.playback {
Some(Playback::Automatic { duration, .. }) => *duration,
@ -1653,7 +1689,7 @@ mod tests {
assert_current_slide(f, 0.01, first, Square::E2, Square::E4);
assert!(f.ui.message.is_none());
f.ui.tick_at(start + first, normal(), NOW);
tick_with_prime(&mut f.ui, start + first, normal(), NOW);
let last = automatic_duration(f);
assert_eq!(last.as_millis(), last_ms);
assert_eq!(f.ui.session.context_index, 1);
@ -1661,7 +1697,7 @@ mod tests {
assert_current_slide(f, 0.02, last, Square::E7, Square::E5);
assert!(f.ui.message.is_none());
f.ui.tick_at(start + first + last, normal(), NOW);
tick_with_prime(&mut f.ui, start + first + last, normal(), NOW);
assert_eq!(f.ui.session.context_index, 2);
assert!(f.ui.can_input());
board_frame(f, &ctx, 10.0, &settings);
@ -1697,6 +1733,100 @@ mod tests {
assert_adaptive_board_slides(&mut slow, 1000, 1000);
}
#[test]
fn next_target_primes_a_new_automatic_sequence_without_reverse_slide() {
fn settle_to_input(f: &mut Fixture, at: Instant) {
let mut at = at;
for _ in 0..32 {
if f.ui.can_input() {
return;
}
let next = f.ui.playback_deadline().unwrap_or(at);
tick_with_prime(&mut f.ui, next, normal(), NOW);
at = next;
}
panic!("training did not reach independent input");
}
let mut f = Fixture::new(
"1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 *",
LearningSide::Black,
&["e7e5", "b8c6", "a7a6"],
"next-target-prime",
);
f.ui.session.context_policy.use_fixed_piece_speed = false;
f.ui.session.context_policy.move_speed_adjustment = 0.0;
let start = Instant::now();
settle_to_input(&mut f, start);
assert_eq!(f.ui.session.current_expected_uci(), Some("e7e5"));
answer_current(
&mut f,
start + Duration::from_secs(1),
NOW,
"first-target-e5",
);
settle_to_input(&mut f, start + Duration::from_secs(1) + normal());
assert_eq!(f.ui.session.current_expected_uci(), Some("b8c6"));
answer_current(
&mut f,
start + Duration::from_secs(3),
NOW + 1,
"second-target-nc6",
);
let prime_at = start + Duration::from_secs(3) + normal();
f.ui.tick_at(prime_at, normal(), NOW);
assert!(f.ui.pending_automatic.is_some());
assert!(!f.ui.board_shown);
let ctx = egui::Context::default();
let settings = Settings::default();
board_frame(&mut f, &ctx, 10.0, &settings);
assert!(
f.ui.board.animation_at(10.0).is_none(),
"prime must not animate the previous target backwards"
);
f.ui.tick_at(prime_at, normal(), NOW);
let duration = automatic_duration(&f);
assert_eq!(duration, Duration::from_millis(1000));
board_frame(&mut f, &ctx, 10.01, &settings);
assert_current_slide(&f, 10.01, duration, Square::E2, Square::E4);
let (_, slides, _) = f.ui.board.animation_at(10.01).unwrap();
assert!(
slides
.iter()
.all(|(_, from, to)| !(*from == Square::F3 && *to == Square::G1)),
"next target started with a reverse slide: {slides:?}"
);
assert!(matches!(
f.ui.playback,
Some(Playback::Automatic { total: 5, .. })
));
}
#[test]
fn debug_moves_settles_prime_between_targets() {
let mut f = Fixture::new(
"1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 *",
LearningSide::Black,
&["e7e5", "b8c6", "a7a6"],
"debug-prime-between-targets",
);
f.ui.debug_moves("e7e5 settle b8c6 settle");
assert!(f.ui.can_input());
assert_eq!(f.ui.session.current_expected_uci(), Some("a7a6"));
f.ui.debug_moves("a7a6 settle");
assert!(f.ui.is_finished());
assert_eq!(
f.attempts()
.iter()
.filter(|attempt| attempt.event_type.is_independent())
.count(),
3
);
}
#[test]
fn reinforcement_does_not_count_as_completed_main_target() {
let mut f = Fixture::new(
@ -1707,7 +1837,7 @@ mod tests {
);
f.ui.session.context_policy.consider_leadup_moves = true;
let start = Instant::now();
f.ui.tick_at(start, Duration::ZERO, NOW);
tick_with_prime(&mut f.ui, start, Duration::ZERO, NOW);
assert_eq!(
f.ui.session.phase,
LearningSessionPhase::AwaitingContextIndependent
@ -1734,25 +1864,25 @@ mod tests {
"context-normal",
);
let start = Instant::now();
f.ui.tick_at(start, normal(), NOW);
tick_with_prime(&mut f.ui, start, normal(), NOW);
assert_eq!(f.ui.visual_log, ["e2e4"]);
assert_eq!(f.ui.session.context_index, 0);
assert!(!f.ui.can_input());
f.ui.tick_at(start + Duration::from_millis(249), normal(), NOW);
tick_with_prime(&mut f.ui, start + Duration::from_millis(249), normal(), NOW);
assert_eq!(f.ui.session.context_index, 0);
assert!(f.attempts().is_empty());
f.ui.tick_at(start + normal(), normal(), NOW);
tick_with_prime(&mut f.ui, start + normal(), normal(), NOW);
assert_eq!(f.ui.session.context_index, 1);
assert_eq!(f.ui.visual_log, ["e2e4", "e7e5"]);
f.ui.tick_at(start + normal(), normal(), NOW);
tick_with_prime(&mut f.ui, start + normal(), normal(), NOW);
assert_eq!(f.ui.session.context_index, 1);
f.ui.tick_at(start + normal() * 2, normal(), NOW);
tick_with_prime(&mut f.ui, start + normal() * 2, normal(), NOW);
assert_eq!(f.ui.session.context_index, 2);
assert_eq!(f.ui.visual_log, ["e2e4", "e7e5", "g1f3"]);
f.ui.tick_at(start + normal() * 3, normal(), NOW);
tick_with_prime(&mut f.ui, start + normal() * 3, normal(), NOW);
assert_eq!(f.ui.session.context_index, 3);
assert_eq!(
f.ui.session.phase,
@ -1775,8 +1905,8 @@ mod tests {
"pause-after-second",
);
let start = Instant::now();
f.ui.tick_at(start, normal(), NOW);
f.ui.tick_at(start + normal(), normal(), NOW);
tick_with_prime(&mut f.ui, start, normal(), NOW);
tick_with_prime(&mut f.ui, start + normal(), normal(), NOW);
assert_eq!(f.ui.session.context_index, 1);
assert_eq!(f.ui.visual_log, ["e2e4", "e7e5"]);
@ -1784,24 +1914,24 @@ mod tests {
assert!(f.ui.pause_requested);
assert!(matches!(f.ui.playback, Some(Playback::Automatic { .. })));
assert_eq!(f.attempts().len(), 1);
f.ui.tick_at(start + normal() * 2, normal(), NOW);
tick_with_prime(&mut f.ui, start + normal() * 2, normal(), NOW);
assert!(f.ui.autoplay_paused());
assert_eq!(f.ui.session.context_index, 2);
assert_eq!(f.ui.visual_log, ["e2e4", "e7e5"]);
assert_eq!(f.attempts().len(), 2);
assert!(!f.ui.can_input());
f.ui.tick_at(start + normal() * 10, normal(), NOW);
tick_with_prime(&mut f.ui, start + normal() * 10, normal(), NOW);
assert_eq!(f.ui.session.context_index, 2);
assert_eq!(f.attempts().len(), 2);
assert!(f.ui.continue_autoplay(start + normal() * 20));
assert_eq!(f.ui.visual_log, ["e2e4", "e7e5", "g1f3"]);
assert_eq!(f.ui.session.context_index, 2);
assert_eq!(f.attempts().len(), 2);
f.ui.tick_at(start + normal() * 20, normal(), NOW);
tick_with_prime(&mut f.ui, start + normal() * 20, normal(), NOW);
assert_eq!(f.attempts().len(), 2);
f.ui.tick_at(start + normal() * 21, normal(), NOW);
tick_with_prime(&mut f.ui, start + normal() * 21, normal(), NOW);
assert_eq!(f.ui.session.context_index, 3);
assert_eq!(f.attempts().len(), 3);
assert!(f.ui.can_input());
@ -1817,7 +1947,7 @@ mod tests {
"autoplay-keyboard-stop",
);
let start = Instant::now();
f.ui.tick_at(start, normal(), NOW);
tick_with_prime(&mut f.ui, start, normal(), NOW);
let ctx = egui::Context::default();
let press = |key: Key,
training: &mut LearningTrainingUi,
@ -1843,7 +1973,7 @@ mod tests {
assert!(f.ui.pause_requested);
assert!(actions.is_empty());
f.ui.tick_at(start + normal(), normal(), NOW);
tick_with_prime(&mut f.ui, start + normal(), normal(), NOW);
assert!(f.ui.autoplay_paused());
assert_eq!(f.attempts().len(), 1);
press(Key::Space, &mut f.ui, &mut actions);
@ -1857,7 +1987,7 @@ mod tests {
assert!(f.ui.playback.is_none());
assert!(!f.ui.can_input());
assert_eq!(f.ui.visual_log, ["e2e4", "e7e5"]);
f.ui.tick_at(start + normal() * 20, normal(), NOW);
tick_with_prime(&mut f.ui, start + normal() * 20, normal(), NOW);
assert_eq!(f.attempts().len(), 1);
let data = f.store.load().unwrap();
assert_eq!(data.learning.attempts.len(), 1);
@ -1877,7 +2007,7 @@ mod tests {
&["b8c6"],
"context-off",
);
f.ui.tick_at(Instant::now(), Duration::ZERO, NOW);
tick_with_prime(&mut f.ui, Instant::now(), Duration::ZERO, NOW);
assert_eq!(f.ui.visual_log, ["e2e4", "e7e5", "g1f3"]);
assert_eq!(f.ui.session.context_index, 3);
assert!(f.ui.can_input());
@ -1905,7 +2035,7 @@ mod tests {
"autoplay-input",
);
let start = Instant::now();
f.ui.tick_at(start, normal(), NOW);
tick_with_prime(&mut f.ui, start, normal(), NOW);
assert!(!f.ui.play_uci_with_id_at(
"e7e5",
"blocked-input".to_owned(),
@ -1921,7 +2051,7 @@ mod tests {
fn wrong_answer_replays_without_a_second_independent_error() {
let mut f = Fixture::new("1. e4 *", LearningSide::White, &["e2e4"], "wrong-replay");
let start = Instant::now();
f.ui.tick_at(start, normal(), NOW);
tick_with_prime(&mut f.ui, start, normal(), NOW);
assert!(f.ui.play_uci_with_id_at(
"d2d4",
"wrong-d4".to_owned(),
@ -1929,7 +2059,8 @@ mod tests {
NOW,
));
assert!(matches!(f.ui.playback, Some(Playback::Wrong { .. })));
f.ui.tick_at(
tick_with_prime(
&mut f.ui,
start + Duration::from_millis(1500) + WRONG_SHOWN,
normal(),
NOW,
@ -1950,14 +2081,24 @@ mod tests {
NOW,
));
assert_eq!(f.attempts().len(), 1);
f.ui.tick_at(start + Duration::from_secs(3) + WRONG_SHOWN, normal(), NOW);
tick_with_prime(
&mut f.ui,
start + Duration::from_secs(3) + WRONG_SHOWN,
normal(),
NOW,
);
assert!(f.ui.play_uci_with_id_at(
"e2e4",
"replay-e4".to_owned(),
start + Duration::from_secs(4),
NOW,
));
f.ui.tick_at(start + Duration::from_secs(4) + normal(), normal(), NOW);
tick_with_prime(
&mut f.ui,
start + Duration::from_secs(4) + normal(),
normal(),
NOW,
);
assert!(f.ui.is_finished());
let attempts = f.attempts();
assert_eq!(attempts.len(), 2);
@ -1984,7 +2125,7 @@ mod tests {
fn preview_is_idempotent_and_shown_move_is_not_success() {
let mut f = Fixture::new("1. e4 *", LearningSide::White, &["e2e4"], "preview");
let start = Instant::now();
f.ui.tick_at(start, normal(), NOW);
tick_with_prime(&mut f.ui, start, normal(), NOW);
assert!(f.ui.request_hint_with_id_at(
"preview-e4".to_owned(),
start + Duration::from_millis(100),
@ -2003,7 +2144,12 @@ mod tests {
start + Duration::from_secs(1),
NOW,
));
f.ui.tick_at(start + Duration::from_secs(1) + normal(), normal(), NOW);
tick_with_prime(
&mut f.ui,
start + Duration::from_secs(1) + normal(),
normal(),
NOW,
);
assert!(f.ui.is_finished());
assert!(
f.ui.message
@ -2038,7 +2184,7 @@ mod tests {
"duplicate",
);
let start = Instant::now();
f.ui.tick_at(start, normal(), NOW);
tick_with_prime(&mut f.ui, start, normal(), NOW);
assert!(f.ui.advance_context_with_id_at(
"duplicate-context".to_owned(),
start + normal(),
@ -2062,7 +2208,7 @@ mod tests {
fn store_error_is_visible_blocking_and_retryable() {
let mut f = Fixture::new("1. e4 *", LearningSide::White, &["e2e4"], "store-error");
let start = Instant::now();
f.ui.tick_at(start, normal(), NOW);
tick_with_prime(&mut f.ui, start, normal(), NOW);
let valid_store = f.ui.store.clone();
f.ui.store = LearningStore::with_legacy(valid_store.path(), valid_store.path());
assert!(f.ui.play_uci_with_id_at(
@ -2087,7 +2233,12 @@ mod tests {
f.ui.retry_pending(start + Duration::from_millis(300));
assert!(!f.ui.has_unsaved());
assert!(matches!(f.ui.playback, Some(Playback::Accepted { .. })));
f.ui.tick_at(start + Duration::from_millis(300) + normal(), normal(), NOW);
tick_with_prime(
&mut f.ui,
start + Duration::from_millis(300) + normal(),
normal(),
NOW,
);
assert!(f.ui.is_finished());
assert_eq!(f.attempts().len(), 1);
}
@ -2096,7 +2247,7 @@ mod tests {
fn reload_resumes_preview_and_partially_presented_context() {
let mut preview = Fixture::new("1. e4 *", LearningSide::White, &["e2e4"], "resume-preview");
let start = Instant::now();
preview.ui.tick_at(start, normal(), NOW);
tick_with_prime(&mut preview.ui, start, normal(), NOW);
preview
.ui
.request_hint_with_id_at("resume-preview-event".to_owned(), start, NOW);
@ -2120,8 +2271,8 @@ mod tests {
&["b8c6"],
"resume-context",
);
context.ui.tick_at(start, normal(), NOW);
context.ui.tick_at(start + normal(), normal(), NOW);
tick_with_prime(&mut context.ui, start, normal(), NOW);
tick_with_prime(&mut context.ui, start + normal(), normal(), NOW);
assert_eq!(context.ui.session.context_index, 1);
let id = context.ui.session_id().to_owned();
drop(context.ui);
@ -2136,8 +2287,7 @@ mod tests {
.unwrap();
assert_eq!(resumed.session_id(), id);
assert_eq!(resumed.session.context_index, 1);
resumed.board_shown = true;
resumed.tick_at(start + normal() * 2, Duration::ZERO, NOW);
tick_with_prime(&mut resumed, start + normal() * 2, Duration::ZERO, NOW);
assert_eq!(resumed.session.context_index, 3);
assert_eq!(context.store.load().unwrap().learning.attempts.len(), 3);
}
@ -2171,7 +2321,7 @@ mod tests {
true,
);
let start = Instant::now();
f.ui.tick_at(start, Duration::ZERO, NOW);
tick_with_prime(&mut f.ui, start, Duration::ZERO, NOW);
assert!(f.ui.request_hint_with_id_at(
"preview-before-new-introduction".to_owned(),
start,
@ -2217,7 +2367,7 @@ mod tests {
LearningPriority::DepthFirst,
);
let start = Instant::now();
f.ui.tick_at(start, Duration::ZERO, NOW);
tick_with_prime(&mut f.ui, start, Duration::ZERO, NOW);
answer_current(
&mut f,
start + Duration::from_millis(10),
@ -2281,7 +2431,7 @@ mod tests {
"g1f3"
);
let start = Instant::now();
f.ui.tick_at(start, Duration::ZERO, NOW);
tick_with_prime(&mut f.ui, start, Duration::ZERO, NOW);
assert!(f.ui.can_input());
assert!(f.ui.playback.is_none());
assert!(f.ui.visual_log.is_empty());
@ -2379,7 +2529,7 @@ mod tests {
LearningPriority::MainLinesFirst,
);
let start = Instant::now();
f.ui.tick_at(start, Duration::ZERO, NOW);
tick_with_prime(&mut f.ui, start, Duration::ZERO, NOW);
answer_current(&mut f, start, NOW, "priority-review-first");
let review_id = f.ui.session_id().to_owned();
assert_eq!(f.ui.session.current_index, 1);

View file

@ -947,6 +947,10 @@ impl RepertoireUi {
pub fn show(&mut self, ui: &mut Ui, settings: &mut Settings) -> Vec<RepertoireAction> {
self.poll(settings);
let mut actions = Vec::new();
let available = ui.available_rect_before_wrap();
let background = ui.visuals().window_fill();
ui.painter_at(available)
.rect_filled(available, 0.0, background);
#[cfg(test)]
{
self.debug_layout.editor = None;

View file

@ -348,6 +348,55 @@ fn dashboard_uses_the_full_workspace_at_both_window_sizes() {
}
}
#[test]
fn early_paths_paint_opaque_window_background_without_allocating() {
for visuals in [egui::Visuals::light(), egui::Visuals::dark()] {
for (width, height) in [(1400.0, 900.0), (960.0, 600.0), (640.0, 480.0)] {
for editor in [false, true] {
let mut f = Fixture::new();
if editor {
f.ui.open_editor();
} else {
f.ui.open_dashboard();
}
let ctx = egui::Context::default();
ctx.set_visuals(visuals.clone());
let mut available = None;
let mut content = None;
let output = ctx.run_ui(
egui::RawInput {
screen_rect: Some(egui::Rect::from_min_size(
egui::Pos2::ZERO,
egui::vec2(width, height),
)),
..Default::default()
},
|ui| {
egui::CentralPanel::default().show(ui, |ui| {
available = Some(ui.available_rect_before_wrap());
let actions = f.ui.show(ui, &mut f.settings);
assert!(actions.is_empty());
content = Some(ui.min_rect());
});
},
);
let shapes = output.shapes.clone();
output.drop_without_applying_deltas();
let available = available.unwrap();
assert_rect_inside(available, content.unwrap());
assert!(shapes.iter().any(|clipped| {
matches!(&clipped.shape, egui::Shape::Rect(shape) if shape.rect == available && shape.fill == visuals.window_fill() && shape.fill.a() == 255)
}));
if editor {
assert!(f.ui.debug_layout.editor.is_some());
} else {
f.ui.dashboard.as_mut().unwrap().wait_until_idle_for_test();
}
}
}
}
}
#[test]
fn creating_an_empty_repertoire_selects_it_in_the_workspace() {
let mut f = Fixture::new();