Expose whisper store warnings and keep settings actions clickable

This commit is contained in:
omar committed 2026-11-26 18:25:30 +03:00
1 parent d314dbc312
commit 034f7c0198
12 files changed
+346 -5

No files matched your search

+2
View File
@@ -2,6 +2,8 @@
## Unreleased ## Unreleased
- Whisper settings now explain read-only and damaged files. Failed list deletion preserves assigned
shortcuts, and Settings action buttons retain a clickable width on desktop.
- A delayed global shortcut release can no longer stop a newly held local push-to-talk or whisper - A delayed global shortcut release can no longer stop a newly held local push-to-talk or whisper
binding, or fire a local release-triggered action after the binding profile changes. binding, or fire a local release-triggered action after the binding profile changes.
- Channel and server edit dialogs read current values before editing, retain drafts after rejection, - Channel and server edit dialogs read current values before editing, retain drafts after rejection,
+1
View File
@@ -59,6 +59,7 @@
воспроизводимые тесты подтверждают исправление пути `Audio worker stalled` в коде; сценарий на воспроизводимые тесты подтверждают исправление пути `Audio worker stalled` в коде; сценарий на
реальном WASAPI-устройстве независимо не наблюдался, готовность сборки и приёмка не подтверждены. реальном WASAPI-устройстве независимо не наблюдался, готовность сборки и приёмка не подтверждены.
- Два CLI-клиента прошли `duplex_qa -- --whisper` на закрытом beta14; 15 тестов ядра с фильтром `whisper` прошли. Проверены разрешение и запрет приёма, восстановление приёма и отбрасывание устаревшего кадра без передачи в обычный канал. Стенд остановлен. Проверка не включает окно настроек, системный ввод или физическое аудио. - Два CLI-клиента прошли `duplex_qa -- --whisper` на закрытом beta14; 15 тестов ядра с фильтром `whisper` прошли. Проверены разрешение и запрет приёма, восстановление приёма и отбрасывание устаревшего кадра без передачи в обычный канал. Стенд остановлен. Проверка не включает окно настроек, системный ввод или физическое аудио.
- Нативная проверка `whisper-settings`: `target/evidence/pc5232-whisper-settings-03/result.json` и 5 кадров. Подтверждены `deny_all`, сохранение списков после перезапуска runtime, предупреждения для повреждённого файла и файла новой версии, отсутствие запуска аудио. `whisper_list_workflows` проверил отмену и подтверждение удаления, сохранность несвязанных сочетаний и восстановление при ошибке записи. В About возврат фокуса к лицензии и выпуску проверен повторной активацией через Enter. Эти проверки не подтверждают визуальное совпадение с официальным клиентом.
- На изолированном официальном beta 14 ядро получило только пустой S3-каталог в режиме чтения. - На изолированном официальном beta 14 ядро получило только пустой S3-каталог в режиме чтения.
Отдельный PUT/list/GET напрямую в хранилище не доказывает передачу или изменение файлов через Отдельный PUT/list/GET напрямую в хранилище не доказывает передачу или изменение файлов через
TeamSpeak. Открыты визуальный паритет, положительные S3-операции через TeamSpeak, HTTPFT, TeamSpeak. Открыты визуальный паритет, положительные S3-операции через TeamSpeak, HTTPFT,
+2
View File
@@ -2108,6 +2108,8 @@
"settings.whisper.receive": "Receive whispers", "settings.whisper.receive": "Receive whispers",
"settings.whisper.receive.all": "Allow All", "settings.whisper.receive.all": "Allow All",
"settings.whisper.receive.deny": "Deny All", "settings.whisper.receive.deny": "Deny All",
"settings.whisper.warning.read_only": "Whisper settings are read-only because they were saved by a newer version. The original file has not been changed.",
"settings.whisper.warning.recovery": "Some saved Whisper settings could not be loaded. The original file has not been changed.",
"settings.whisper.title.activity": "Manage Whisper Lists", "settings.whisper.title.activity": "Manage Whisper Lists",
"settings.whisper.type.clients_channel": "Clients & Channels", "settings.whisper.type.clients_channel": "Clients & Channels",
"universal.disconnected": "Disconnected", "universal.disconnected": "Disconnected",
+2
View File
@@ -2123,6 +2123,8 @@
"settings.whisper.receive": "Получать шепоты", "settings.whisper.receive": "Получать шепоты",
"settings.whisper.receive.all": "Разрешить все", "settings.whisper.receive.all": "Разрешить все",
"settings.whisper.receive.deny": "Запретить все", "settings.whisper.receive.deny": "Запретить все",
"settings.whisper.warning.read_only": "Настройки шепотов сохранены в более новой версии и доступны только для чтения. Исходный файл не изменён.",
"settings.whisper.warning.recovery": "Не удалось загрузить часть сохранённых настроек шепотов. Исходный файл не изменён.",
"settings.whisper.title.activity": "Управление списками шепотов", "settings.whisper.title.activity": "Управление списками шепотов",
"settings.whisper.type.clients_channel": "Клиенты и каналы", "settings.whisper.type.clients_channel": "Клиенты и каналы",
"universal.disconnected": "Отключен(-а)", "universal.disconnected": "Отключен(-а)",
@@ -21,6 +21,7 @@ pub fn project(ctx:&RuntimeServices,view:&ViewState)->Result<SettingsSnapshot>{
let lists=profile.whispers.list_ids();snapshot.key_conflicts.clear(); let lists=profile.whispers.list_ids();snapshot.key_conflicts.clear();
for item in &profile.keybinds.get().profiles{for conflict in keybinds::conflicts(&item.bindings,ptt,Some(&lists)){snapshot.key_conflicts.insert(conflict.id,match conflict.reason{keybinds::ConflictReason::Duplicate{with}=>format!("Shortcut conflicts with {with}"),keybinds::ConflictReason::Ptt=>"Shortcut conflicts with push-to-talk".into(),keybinds::ConflictReason::SelectList=>"Choose an existing whisper list".into()});}} for item in &profile.keybinds.get().profiles{for conflict in keybinds::conflicts(&item.bindings,ptt,Some(&lists)){snapshot.key_conflicts.insert(conflict.id,match conflict.reason{keybinds::ConflictReason::Duplicate{with}=>format!("Shortcut conflicts with {with}"),keybinds::ConflictReason::Ptt=>"Shortcut conflicts with push-to-talk".into(),keybinds::ConflictReason::SelectList=>"Choose an existing whisper list".into()});}}
snapshot.whispers=Some(profile.whispers.get().clone());snapshot.audio.migration.clear(); snapshot.whispers=Some(profile.whispers.get().clone());snapshot.audio.migration.clear();
snapshot.whisper_recovery = !profile.whispers.get().read_only && profile.whispers.diagnostic.is_some();
if let Some(migration)=&profile.migration{for(kind,ids)in [(DeviceKind::Input,migration.unmapped_devices.input.clone()),(DeviceKind::Output,migration.unmapped_devices.output.clone()),(DeviceKind::Notification,migration.unmapped_devices.notification.iter().cloned().collect())]{snapshot.audio.migration.extend(profile.prefs.unresolved_devices(kind,&ids).into_iter().map(|legacy|MigrationDevice{kind,legacy}));}} if let Some(migration)=&profile.migration{for(kind,ids)in [(DeviceKind::Input,migration.unmapped_devices.input.clone()),(DeviceKind::Output,migration.unmapped_devices.output.clone()),(DeviceKind::Notification,migration.unmapped_devices.notification.iter().cloned().collect())]{snapshot.audio.migration.extend(profile.prefs.unresolved_devices(kind,&ids).into_iter().map(|legacy|MigrationDevice{kind,legacy}));}}
snapshot.audio.input_level=ctx.audio.input_level(); snapshot.audio.input_level=ctx.audio.input_level();
snapshot.video.policy=if prefs["hardwareVideoDecode"]==true{"Hardware permitted with software fallback"}else{"Software only"}.into(); snapshot.video.policy=if prefs["hardwareVideoDecode"]==true{"Hardware permitted with software fallback"}else{"Software only"}.into();
+2
View File
@@ -18,6 +18,8 @@ fn run() -> Result<(), teamspeach_native::AppError> {
println!("Test build only:\n --smoke offline-ui|migration|media-loopback --profile-dir <absolute path> --output <fresh absolute directory>"); println!("Test build only:\n --smoke offline-ui|migration|media-loopback --profile-dir <absolute path> --output <fresh absolute directory>");
#[cfg(all(feature="test-harness", not(any(target_os="android",target_os="ios"))))] #[cfg(all(feature="test-harness", not(any(target_os="android",target_os="ios"))))]
println!(" --smoke pc-parity --profile-dir <absolute path> --output <fresh absolute directory>\n Requires TEAMSPEACH_PC_PARITY_FIXTURE=<absolute fixture-data.json>"); println!(" --smoke pc-parity --profile-dir <absolute path> --output <fresh absolute directory>\n Requires TEAMSPEACH_PC_PARITY_FIXTURE=<absolute fixture-data.json>");
#[cfg(all(feature="test-harness", not(any(target_os="android",target_os="ios"))))]
println!(" --smoke whisper-settings --profile-dir <absolute path> --output <fresh absolute directory>");
return Ok(()) return Ok(())
} }
if !arguments.is_empty() { if !arguments.is_empty() {
+4 -1
View File
@@ -5,6 +5,7 @@ mod focus;
#[cfg(not(any(target_os="android",target_os="ios")))] mod headless; #[cfg(not(any(target_os="android",target_os="ios")))] mod headless;
#[cfg(not(any(target_os="android",target_os="ios")))] mod identities; #[cfg(not(any(target_os="android",target_os="ios")))] mod identities;
#[cfg(not(any(target_os="android",target_os="ios")))] mod parity; #[cfg(not(any(target_os="android",target_os="ios")))] mod parity;
#[cfg(not(any(target_os="android",target_os="ios")))] mod whisper;
#[cfg(feature="webrtc")] pub mod media; #[cfg(feature="webrtc")] pub mod media;
use std::{cell::RefCell, fs, path::PathBuf, rc::Rc, sync::Arc, time::{Duration, Instant}}; use std::{cell::RefCell, fs, path::PathBuf, rc::Rc, sync::Arc, time::{Duration, Instant}};
use serde_json::{Value, json}; use serde_json::{Value, json};
@@ -16,7 +17,7 @@ pub(crate) struct Prepared { scenario:String, profile:PathBuf, output:PathBuf, m
fn error(error:impl ToString)->AppError { AppError::Smoke(error.to_string()) } fn error(error:impl ToString)->AppError { AppError::Smoke(error.to_string()) }
pub(crate) fn prepare(scenario:&str, profile:PathBuf, output:PathBuf)->Result<Prepared,AppError> { pub(crate) fn prepare(scenario:&str, profile:PathBuf, output:PathBuf)->Result<Prepared,AppError> {
if !matches!(scenario,"offline-ui"|"migration"|"media-loopback") if !matches!(scenario,"offline-ui"|"migration"|"media-loopback")
&& !(matches!(scenario,"pc-parity"|"identity-workflows") && cfg!(not(any(target_os="android",target_os="ios")))) { && !(matches!(scenario,"pc-parity"|"identity-workflows"|"whisper-settings") && cfg!(not(any(target_os="android",target_os="ios")))) {
return Err(error("unknown native smoke scenario")) return Err(error("unknown native smoke scenario"))
} }
if !profile.is_absolute() || !output.is_absolute() { return Err(error("smoke requires absolute profile and output paths")) } if !profile.is_absolute() || !output.is_absolute() { return Err(error("smoke requires absolute profile and output paths")) }
@@ -43,6 +44,8 @@ pub fn run(scenario:&str,profile:PathBuf,output:PathBuf)->Result<(),AppError> {
if prepared.scenario=="pc-parity" { return parity::run(prepared).map_err(error) } if prepared.scenario=="pc-parity" { return parity::run(prepared).map_err(error) }
#[cfg(not(any(target_os="android",target_os="ios")))] #[cfg(not(any(target_os="android",target_os="ios")))]
if prepared.scenario=="identity-workflows" { return identities::run(prepared).map_err(error) } if prepared.scenario=="identity-workflows" { return identities::run(prepared).map_err(error) }
#[cfg(not(any(target_os="android",target_os="ios")))]
if prepared.scenario=="whisper-settings" { return whisper::run(prepared).map_err(error) }
let runtime=AppRuntime::start(AppConfig::isolated(prepared.profile.clone()))?; let runtime=AppRuntime::start(AppConfig::isolated(prepared.profile.clone()))?;
run_prepared(runtime,0,prepared) run_prepared(runtime,0,prepared)
} }
+318
View File
@@ -0,0 +1,318 @@
//! Offscreen desktop acceptance of Whisper Settings through actual Slint controls.
use super::{Prepared, SmokeResult, headless, identities::{run_ui, wait}, screenshot};
use crate::{AppConfig, AppRuntime, AppWindow, SettingsBridge, ShellBridge,
app::runtime::model::{BootstrapState, Snapshot},
services::{profile::ProfileServices, profile_import::initialize_native_root, whisper::ReceiveMode},
ui::{settings::Category, shell::Destination}};
use i_slint_core::{accessibility::AccessibleStringProperty as Property,
item_tree::ItemRc, items::{AccessibleRole, TextInput}, window::WindowInner};
use serde_json::{Value, json};
use slint::{ComponentHandle, LogicalPosition, PhysicalSize, SharedString,
platform::{Key, PointerEventButton, WindowEvent}};
use std::{cell::RefCell, fs, path::Path, rc::Rc};
const SEED: &str = "Existing targets";
const RENAMED_SEED: &str = "Renamed targets";
const SEED_ID: &str = "abcdef01-2345-4abc-8def-0123456789ab";
const CLIENT: &str = "Fixture client";
const CHANNEL: &str = "Fixture lobby/Fixture stage";
const CREATED: &str = "Created in Whispers";
const RENAMED: &str = "Renamed in Whispers";
const RECEIVE: &str = "settings.whisper.receive";
const LIST: &str = "settings.whisper.list";
const NEW_LIST: &str = "settings.whisper.list.new";
const RENAME: &str = "universal.rename";
fn check(ok: bool, error: &str) -> SmokeResult<()> {
if ok { Ok(()) } else { Err(error.into()) }
}
fn seed(root: &Path, bytes: &[u8]) -> SmokeResult<()> {
initialize_native_root(root).map_err(|e| e.to_string())?;
ProfileServices::open(root).and_then(|profile| profile.identities.onboard("Whisper QA"))
.map_err(|e| e.to_string())?;
fs::write(root.join("whisper.json"), bytes).map_err(|e| e.to_string())
}
// Accessible containers do not enumerate their own descendants through the shallow role iterator.
fn find_label(ui: &AppWindow, root: ItemRc, label: &str, matches: impl Fn(&ItemRc) -> bool) -> Option<ItemRc> {
let mut stack = vec![root];
for _ in 0..16_384 {
let item = stack.pop()?;
if matches(&item) && item.accessible_string_property(Property::Label).is_some_and(|value| value == label)
&& headless::visible_bounds(ui.window(), &item).is_some() {
return Some(item);
}
if let Some(sibling) = item.next_sibling() { stack.push(sibling); }
if let Some(child) = item.first_child() { stack.push(child); }
}
None
}
fn rendered(ui: &AppWindow, label: &str, matches: impl Fn(&ItemRc) -> bool) -> Option<ItemRc> {
let window = WindowInner::from_pub(ui.window());
window.ensure_tree_instantiated();
let root = ItemRc::new_root(window.try_component()?);
find_label(ui, root, label, matches)
}
fn role(ui: &AppWindow, label: &str, role: AccessibleRole) -> Option<ItemRc> {
rendered(ui, label, |item| item.accessible_role() == role)
}
fn field(ui: &AppWindow, label: &str) -> Option<ItemRc> {
rendered(ui, label, |item| item.downcast::<TextInput>().is_some())
}
fn dispatch(ui: &AppWindow, event: WindowEvent) -> SmokeResult<()> {
ui.window().dispatch_event_with_result(event).map(|_| ()).map_err(|e| e.to_string())
}
fn click(ui: &AppWindow, item: &ItemRc) -> SmokeResult<()> {
headless::visible_bounds(ui.window(), item).ok_or("Whisper control is not visible")?;
// Slint's embedded ComboBox popup has its own coordinate space.
let center = item.map_to_native_window(item.geometry().center());
let position = LogicalPosition::new(center.x, center.y);
let button = PointerEventButton::Left;
for event in [WindowEvent::PointerMoved { position }, WindowEvent::PointerPressed { position, button },
WindowEvent::PointerReleased { position, button }] {
dispatch(ui, event)?;
}
Ok(())
}
fn key(ui: &AppWindow, text: impl Into<SharedString>) -> SmokeResult<()> {
let text = text.into();
dispatch(ui, WindowEvent::KeyPressed { text: text.clone() })?;
dispatch(ui, WindowEvent::KeyReleased { text })
}
async fn receipt(runtime: &AppRuntime, serial: u64, operation: &str) -> SmokeResult<()> {
wait(runtime, operation, |s| (s.settings_completed >= serial && s.settings.pending.is_empty()).then(|| {
if s.settings_completed == serial && s.last_error.is_none() { Ok(()) }
else { Err(format!("{operation}: expected successful receipt {serial}, got {} and {:?}",
s.settings_completed, s.last_error.as_ref().map(|e| (&e.code, &e.message)))) }
})).await?
}
async fn open(runtime: &AppRuntime, ui: &AppWindow) -> SmokeResult<()> {
ui.window().set_size(PhysicalSize::new(1280, 1000));
let settings = wait(runtime, "desktop Settings control after isolated startup", |s| {
if s.bootstrap != BootstrapState::Ready || !s.settings.loaded { return None; }
role(ui, &s.catalog.text("native.navigation.settings"), AccessibleRole::Button)
}).await?;
click(ui, &settings)?;
let category = wait(runtime, "Whispers category button", |s| {
if s.destination != Destination::Settings || ui.global::<ShellBridge>().get_destination() != 3 { return None; }
role(ui, &s.catalog.text(Category::Whispers.key()), AccessibleRole::Button)
}).await?;
let serial = runtime.snapshot().settings_completed + 1;
click(ui, &category)?;
receipt(runtime, serial, "open Whispers category").await?;
wait(runtime, "rendered Whispers settings", |s| (s.settings_view.category == Category::Whispers
&& role(ui, &s.catalog.text(Category::Whispers.key()), AccessibleRole::Groupbox).is_some()).then_some(())).await
}
async fn select_list(runtime: &AppRuntime, ui: &AppWindow, name: &str, id: &str) -> SmokeResult<()> {
let label = runtime.snapshot().catalog.text(LIST);
let selector = wait(runtime, "rendered Whisper list picker", |_| role(ui, &label, AccessibleRole::Combobox)).await?;
click(ui, &selector)?;
let option = wait(runtime, &format!("Whisper list popup option {name}"), |_| {
let window = WindowInner::from_pub(ui.window());
window.active_popups().iter().rev().find_map(|popup| {
find_label(ui, ItemRc::new_root(popup.component.clone()), name, |_| true)
})
}).await?;
let serial = runtime.snapshot().settings_completed + 1;
click(ui, &option)?;
receipt(runtime, serial, "select Whisper list").await?;
check(runtime.snapshot().settings_view.whisper_list.as_deref() == Some(id), "picker selected the wrong list UUID")?;
wait(runtime, "selected Whisper list label", |_| role(ui, &label, AccessibleRole::Combobox)
.filter(|item| item.accessible_string_property(Property::Value).is_some_and(|value| value == name))).await?;
Ok(())
}
async fn edit_text(runtime: &AppRuntime, ui: &AppWindow, label: &str, before: &str, after: &str) -> SmokeResult<()> {
let input = wait(runtime, &format!("Whisper text field {label}"), |_| field(ui, label).filter(|item| {
item.downcast::<TextInput>().is_some_and(|input| input.as_pin_ref().text() == before)
})).await?;
click(ui, &input)?;
check(WindowInner::from_pub(ui.window()).text_input_focused(), "Whisper text field did not take focus")?;
if !before.is_empty() {
key(ui, Key::End)?;
for _ in before.chars() { key(ui, Key::Backspace)?; }
}
key(ui, after)?;
check(input.downcast::<TextInput>().is_some_and(|input| input.as_pin_ref().text() == after),
"Whisper text field did not accept synthetic input")
}
async fn rename(runtime: &AppRuntime, ui: &AppWindow, before: &str, after: &str) -> SmokeResult<()> {
let label = runtime.snapshot().catalog.text(RENAME);
edit_text(runtime, ui, &label, before, after).await?;
let serial = runtime.snapshot().settings_completed + 1;
key(ui, Key::Return)?;
receipt(runtime, serial, "save Whisper list rename").await
}
async fn observe_entries(runtime: &AppRuntime, ui: &AppWindow) -> SmokeResult<()> {
let deny = runtime.snapshot().catalog.text("settings.whisper.receive.deny");
let receive = runtime.snapshot().catalog.text(RECEIVE);
wait(runtime, "saved deny mode and both visible Whisper entries", |s| {
let combo = role(ui, &receive, AccessibleRole::Combobox)?;
(s.settings.whispers.as_ref()?.receive_mode == ReceiveMode::DenyAll
&& combo.accessible_string_property(Property::Value).is_some_and(|value| value == deny.as_str())
&& role(ui, CLIENT, AccessibleRole::Text).is_some()
&& role(ui, CHANNEL, AccessibleRole::Text).is_some()).then_some(())
}).await
}
fn disk(root: &Path) -> SmokeResult<Value> {
let bytes = fs::read(root.join("whisper.json")).map_err(|e| e.to_string())?;
serde_json::from_slice(&bytes).map_err(|e| e.to_string())
}
fn silence(s: &Snapshot) -> Value {
json!({"audio_input_starts":s.audio_input_starts, "audio_output_starts":s.audio_output_starts,
"audio_input_active":s.audio_input_active, "audio_output_active":s.audio_output_active,
"active_connections":s.connections.connections.iter().filter(|c| c.is_connected()).count()})
}
async fn diagnostic(runtime: &AppRuntime, ui: &AppWindow, output: &Path, root: &Path,
source: &[u8], read_only: bool,
) -> SmokeResult<Value> {
open(runtime, ui).await?;
let s = runtime.snapshot();
let key = if read_only { "settings.whisper.warning.read_only" } else { "settings.whisper.warning.recovery" };
let message = s.catalog.text(key);
let receive = s.catalog.text(RECEIVE);
let create = s.catalog.text(NEW_LIST);
check(s.catalog.contains(key) && s.settings.whispers.as_ref().is_some_and(|state| state.read_only == read_only),
"Whisper diagnostics fixture did not load with the expected write policy")?;
let (combo, button, editor) = wait(runtime, "rendered Whisper file warning and controls", |_| {
role(ui, &message, AccessibleRole::Text)?;
Some((role(ui, &receive, AccessibleRole::Combobox)?, role(ui, &create, AccessibleRole::Button)?, field(ui, &create)?))
}).await?;
let enabled = if read_only { "false" } else { "true" };
check([&combo, &button].iter().all(|item| item.accessible_string_property(Property::Enabled).is_some_and(|value| value == enabled))
&& editor.downcast::<TextInput>().is_some_and(|item| item.as_pin_ref().enabled() != read_only),
"Whisper warning did not expose the expected enabled state")?;
if read_only {
click(ui, &combo)?;
click(ui, &editor)?;
click(ui, &button)?;
// Give the UI and worker time to publish any accidental dispatch before checking the serial.
let (send, recv) = tokio::sync::oneshot::channel();
slint::Timer::single_shot(std::time::Duration::from_millis(80), move || { let _ = send.send(()); });
recv.await.map_err(|_| "read-only input observation timer stopped")?;
let window = WindowInner::from_pub(ui.window());
check(runtime.snapshot().settings_completed == s.settings_completed
&& !window.text_input_focused() && window.active_popups().is_empty(),
"read-only Whisper controls accepted input")?;
}
check(fs::read(root.join("whisper.json")).map_err(|e| e.to_string())? == source,
"observing the Whisper warning modified the source file")?;
let filename = if read_only { "whisper-read-only.png" } else { "whisper-recovery.png" };
Ok(json!({"warning":message,"read_only":read_only,"write_controls_enabled":!read_only,
"pointer_attempts_on_disabled_controls":read_only,"source_unchanged":true,
"render":screenshot(ui, output, filename)?,"silence":silence(&runtime.snapshot())}))
}
pub(super) fn run(prepared: Prepared) -> SmokeResult<()> {
let output = prepared.output;
let root = prepared.profile;
let entries = json!([
{"type":1,"uuid":"fixture-client-uid","name":CLIENT},
{"type":2,"uuid":"fixture-server-uid","name":CHANNEL}
]);
let source = serde_json::to_vec(&json!({"version":1,"receiveMode":"deny_all","lists":[{
"list_uuid":SEED_ID.to_uppercase(),"name":SEED,"type":1,
"whisper_entry_list":[entries[0],entries[1],entries[0],entries[1]]
}]})).map_err(|e| e.to_string())?;
let config = AppConfig::isolated(root.clone());
let checks = Rc::new(RefCell::new(Vec::<Value>::new()));
let result: SmokeResult<()> = (|| {
seed(&root, &source)?;
let phase_root = root.clone();
let phase_output = output.clone();
let phase_checks = checks.clone();
let saved_entries = entries.clone();
let id = run_ui(&config, async move |runtime, ui| {
open(runtime, ui).await?;
select_list(runtime, ui, SEED, SEED_ID).await?;
observe_entries(runtime, ui).await?;
check(ui.global::<SettingsBridge>().get_error().is_empty(), "valid Whisper settings showed a warning")?;
check(fs::read(phase_root.join("whisper.json")).map_err(|e| e.to_string())? == source,
"opening valid Whisper Settings changed the source file")?;
phase_checks.borrow_mut().push(json!({"operation":"open saved Whispers", "receive_mode":"deny_all",
"selected_id":SEED_ID,"visible_entries":[CLIENT,CHANNEL],"source_unchanged":true,
"render":screenshot(ui, &phase_output, "whisper-saved.png")?,"silence":silence(&runtime.snapshot())}));
rename(runtime, ui, SEED, RENAMED_SEED).await?;
let label = runtime.snapshot().catalog.text(NEW_LIST);
edit_text(runtime, ui, &label, "", CREATED).await?;
let create = wait(runtime, "rendered New Whisperlist button", |_| role(ui, &label, AccessibleRole::Button)).await?;
let serial = runtime.snapshot().settings_completed + 2; // Companion draft, then Create.
click(ui, &create)?;
receipt(runtime, serial, "create Whisper list via Slint").await?;
let snapshot = runtime.snapshot();
let id = snapshot.settings_view.whisper_list.clone().filter(|id| id != SEED_ID)
.ok_or("new Whisper list was not selected")?;
check(uuid::Uuid::parse_str(&id).is_ok_and(|uid| uid.get_version_num() == 4 && uid.to_string() == id),
"new Whisper list UUID is not normalized v4")?;
check(disk(&phase_root)?["lists"].as_array().is_some_and(|lists| lists.iter().any(|item| item["list_uuid"] == id
&& item["name"] == CREATED)), "Create did not persist the named list at its selected UUID")?;
rename(runtime, ui, CREATED, RENAMED).await?;
let data = disk(&phase_root)?;
let lists = data["lists"].as_array().ok_or("saved Whisper file has no lists")?;
check(data["version"] == 1 && data["receiveMode"] == "deny_all" && lists.len() == 2
&& lists.iter().any(|item| item["list_uuid"] == SEED_ID && item["name"] == RENAMED_SEED && item["whisper_entry_list"] == saved_entries)
&& lists.iter().any(|item| item["list_uuid"] == id && item["name"] == RENAMED && item["whisper_entry_list"] == json!([])),
"Whisper edits did not preserve receive mode, exact list UUIDs and deduplicated client/channel entries")?;
phase_checks.borrow_mut().push(json!({"operation":"create and save", "created_name":CREATED, "saved_name":RENAMED,
"created_id":id,"renamed_seed_id":SEED_ID,"saved_seed_name":RENAMED_SEED,"exact_deduplicated_entries":saved_entries,
"silence":silence(&runtime.snapshot())}));
Ok(id)
})?;
let phase_output = output.clone();
let phase_checks = checks.clone();
run_ui(&config, async move |runtime, ui| {
open(runtime, ui).await?;
select_list(runtime, ui, RENAMED_SEED, SEED_ID).await?;
observe_entries(runtime, ui).await?;
let restored = screenshot(ui, &phase_output, "whisper-restart-targets.png")?;
select_list(runtime, ui, RENAMED, &id).await?;
let label = runtime.snapshot().catalog.text(RENAME);
wait(runtime, "restored name in the Whisper rename field", |_| field(ui, &label).filter(|item|
item.downcast::<TextInput>().is_some_and(|input| input.as_pin_ref().text() == RENAMED))).await?;
phase_checks.borrow_mut().push(json!({"operation":"restart runtime and reopen Whispers", "selected_id":id,
"restored_name":RENAMED,"restored_entries":[CLIENT,CHANNEL],"receive_mode":"deny_all",
"renders":[restored,screenshot(ui, &phase_output, "whisper-restart-edited.png")?], "silence":silence(&runtime.snapshot())}));
Ok(())
})?;
for (read_only, source) in [(true, br#"{"version":2,"receiveMode":"deny_all","lists":[],"futureMetadata":"untouched"}"#.as_slice()),
(false, br#"{"version":1,"#.as_slice())] {
let temp = tempfile::Builder::new().prefix("whisper-warning-").tempdir_in(&output).map_err(|e| e.to_string())?;
let directory = temp.path().join("profile");
seed(&directory, source)?;
let phase_output = output.clone();
let config = AppConfig::isolated(directory.clone());
let receipt = run_ui(&config, async move |runtime, ui| {
diagnostic(runtime, ui, &phase_output, &directory, source, read_only).await
})?;
checks.borrow_mut().push(receipt);
}
Ok(())
})();
let report = json!({"schema":1,"engine":"rust-slint","scenario":"whisper-settings","passed":result.is_ok(),
"error":result.as_ref().err(),"version":env!("CARGO_PKG_VERSION"),"target":env!("TEAMSPEACH_BUILD_TARGET"),
"profile_dir":root,"network_enabled":false,"os_actions_enabled":false,"physical_capture_enabled":false,
"checks":checks.take(),"limitations":["Runtime shutdown and restart in one harness process, not a process relaunch.",
"Client and channel targets are seeded on disk; no connected add, stale target, or delivery is exercised.",
"Dark English desktop only; no official-frame comparison."]});
let bytes = serde_json::to_vec_pretty(&report).map_err(|e| e.to_string())?;
let temporary = output.join("result.json.tmp");
fs::write(&temporary, bytes).map_err(|e| e.to_string())?;
fs::rename(temporary, output.join("result.json")).map_err(|e| e.to_string())?;
result
}
+10 -1
View File
@@ -311,5 +311,14 @@ pub fn build(s:&SettingsSnapshot,v:&ViewState,c:&Catalog)->Presentation {
if readonly{for row in &mut b.rows{let navigation=match &row.intent{Intent::None=>true,Intent::Invoke(Operation::Navigate(_)|Operation::WhisperOverlay(_))=>true,Intent::Select(ops)=>ops.iter().all(|op|matches!(op,Operation::Navigate(_))),_=>false};row.enabled&=navigation;}} if readonly{for row in &mut b.rows{let navigation=match &row.intent{Intent::None=>true,Intent::Invoke(Operation::Navigate(_)|Operation::WhisperOverlay(_))=>true,Intent::Select(ops)=>ops.iter().all(|op|matches!(op,Operation::Navigate(_))),_=>false};row.enabled&=navigation;}}
let about = (v.category == Category::About).then(|| v.page()); let about = (v.category == Category::About).then(|| v.page());
let show_slint = matches!(about.as_ref(), Some(Page::Root)) || matches!(about.as_ref(), Some(Page::License(id)) if id == crate::services::about::SLINT_LICENSE_ID); let show_slint = matches!(about.as_ref(), Some(Page::Root)) || matches!(about.as_ref(), Some(Page::License(id)) if id == crate::services::about::SLINT_LICENSE_ID);
Presentation{category:v.category,title:c.text(v.category.key()),categories:Category::ALL.iter().map(|x|c.text(x.key())).collect(),category_groups:["ui.user","ui.application","ui.information"].into_iter().map(|k|c.text(k)).collect(),rows:b.rows,panel_open:v.panel_open,subpage:!v.pages.is_empty(),show_slint,focus_row:v.about_focus.clone(),about_page:about.map(|page|format!("{page:?}")).unwrap_or_default(),status:if !s.loaded&&s.status.is_empty(){c.text("files.loading")}else{s.status.clone()},error:s.error.clone(),back:c.text("clientMenu.back"),apply:c.text("ui.save"),cancel:c.text("ui.cancel"),loading:!s.loaded,capturing:s.capture.active,decrease_template:c.text("files.settings.decrease"),increase_template:c.text("files.settings.increase")} let error = if v.category != Category::Whispers || !s.error.is_empty() {
s.error.clone()
} else if readonly {
c.text("settings.whisper.warning.read_only")
} else if s.whisper_recovery {
c.text("settings.whisper.warning.recovery")
} else {
String::new()
};
Presentation{category:v.category,title:c.text(v.category.key()),categories:Category::ALL.iter().map(|x|c.text(x.key())).collect(),category_groups:["ui.user","ui.application","ui.information"].into_iter().map(|k|c.text(k)).collect(),rows:b.rows,panel_open:v.panel_open,subpage:!v.pages.is_empty(),show_slint,focus_row:v.about_focus.clone(),about_page:about.map(|page|format!("{page:?}")).unwrap_or_default(),status:if !s.loaded&&s.status.is_empty(){c.text("files.loading")}else{s.status.clone()},error,back:c.text("clientMenu.back"),apply:c.text("ui.save"),cancel:c.text("ui.cancel"),loading:!s.loaded,capturing:s.capture.active,decrease_template:c.text("files.settings.decrease"),increase_template:c.text("files.settings.increase")}
} }
+1 -1
View File
@@ -164,7 +164,7 @@ pub struct AboutView {
pub struct SettingsSnapshot { pub struct SettingsSnapshot {
pub loaded:bool, pub prefs:Value, pub identities:Vec<IdentityView>,pub audio:AudioView,pub video:VideoView, pub loaded:bool, pub prefs:Value, pub identities:Vec<IdentityView>,pub audio:AudioView,pub video:VideoView,
pub keybinds:Option<KeybindState>,pub key_read_only:bool,pub key_conflicts:HashMap<String,String>,pub key_status:String,pub capture:CaptureView, pub keybinds:Option<KeybindState>,pub key_read_only:bool,pub key_conflicts:HashMap<String,String>,pub key_status:String,pub capture:CaptureView,
pub whispers:Option<WhisperState>,pub servers:Vec<WhisperServer>,pub input_session:Option<SessionKey>,pub pending_whisper:Option<(SessionKey,WhisperEntry)>,pub whisper_targets:Vec<(String,String)>, pub whispers:Option<WhisperState>,pub whisper_recovery:bool,pub servers:Vec<WhisperServer>,pub input_session:Option<SessionKey>,pub pending_whisper:Option<(SessionKey,WhisperEntry)>,pub whisper_targets:Vec<(String,String)>,
pub files:Option<FileSettingsValue>,pub download_location:String,pub recording_location:String, pub files:Option<FileSettingsValue>,pub download_location:String,pub recording_location:String,
pub themes:Vec<ThemeView>,pub theme_warnings:Vec<String>,pub theme_preview:Option<String>, pub themes:Vec<ThemeView>,pub theme_warnings:Vec<String>,pub theme_preview:Option<String>,
pub os:OsView,pub about:AboutView,pub status:String,pub error:String, pub os:OsView,pub about:AboutView,pub status:String,pub error:String,
+2 -1
View File
@@ -10,12 +10,13 @@ export component ActionButton inherits Rectangle {
in property <bool> dialog-action: false; in property <bool> dialog-action: false;
in property <bool> busy: false; in property <bool> busy: false;
out property <bool> has-focus: focus.has-focus; out property <bool> has-focus: focus.has-focus;
out property <length> natural-width: max(Theme.touch-controls ? 44px : 22px, label.preferred-width + 2 * root.horizontal-inset);
forward-focus: focus; forward-focus: focus;
private property <length> horizontal-inset: Theme.touch-controls ? 12px : (root.primary ? 20px : 0px); private property <length> horizontal-inset: Theme.touch-controls ? 12px : (root.primary ? 20px : 0px);
private property <length> action-height: Theme.touch-controls ? Theme.touch-target : (root.dialog-action ? 30px : Theme.button-height); private property <length> action-height: Theme.touch-controls ? Theme.touch-target : (root.dialog-action ? 30px : Theme.button-height);
private property <color> plain-text: root.destructive ? Theme.error-light : Theme.tint-secondary; private property <color> plain-text: root.destructive ? Theme.error-light : Theme.tint-secondary;
min-height: max(root.action-height, label.preferred-height + (root.primary ? 8px : 0px)); min-height: max(root.action-height, label.preferred-height + (root.primary ? 8px : 0px));
min-width: max(Theme.touch-controls ? 44px : 22px, label.preferred-width + 2 * root.horizontal-inset); min-width: self.natural-width;
preferred-width: self.min-width; preferred-width: self.min-width;
preferred-height: self.min-height; preferred-height: self.min-height;
border-radius: root.primary ? self.height / 2 : 4px; border-radius: root.primary ? self.height / 2 : 4px;
+1 -1
View File
@@ -385,7 +385,7 @@ component SettingCell inherits Rectangle {
alignment: root.compact ? stretch : (root.inline ? end : start); alignment: root.compact ? stretch : (root.inline ? end : start);
ActionButton { ActionButton {
text: root.setting.title; enabled: root.setting.enabled; destructive: root.setting.destructive; text: root.setting.title; enabled: root.setting.enabled; destructive: root.setting.destructive;
min-width: 0px; max-width: editor.width; min-width: 0px; preferred-width: self.natural-width; max-width: editor.width;
min-height: root.control-height; preferred-height: root.control-height; min-height: root.control-height; preferred-height: root.control-height;
private property <bool> restore-focus: root.focus-action && self.enabled; private property <bool> restore-focus: root.focus-action && self.enabled;
init => { if self.restore-focus { self.focus(); } } init => { if self.restore-focus { self.focus(); } }