mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-25 19:43:43 +08:00
Labs deep links: hex://labs/<feature> (#693)
* Labs deep links: hex://labs/<feature>, hex://settings/<pane>, hex labs link * Golden: mac-labs-link dark * Golden: mac-labs-link light
This commit is contained in:
@@ -68,6 +68,7 @@ hex
|
||||
│ ├── send <capture> [--to <session>] [--always] send it to an OpenCode session
|
||||
│ └── route <capture> [--ask-jev] what routing sees and decides; sends nothing
|
||||
├── labs [on|off <feature>] list Labs features or turn one on/off; edits settings.json (features/labs.md)
|
||||
│ └── link <feature> macOS: print hex://labs/<feature>, the link that opens Hex's Labs page at that row
|
||||
├── check-for-updates check for an update now
|
||||
├── launch-at-login [on|off] report or change Launch at Login (macOS: installed Hex.app only; Windows Run key; Linux XDG autostart)
|
||||
└── logs [--process] [-n N] [-f] tail live.ndjson (or process.log); no running Hex needed
|
||||
|
||||
@@ -580,7 +580,7 @@ latency measurement.
|
||||
Sidebar // settings.nav
|
||||
├── General, Output, History, then each feature that is on: Meetings and
|
||||
│ Voice Filter (Labs toggles), Annotate, Playground (Labs, an item)
|
||||
└── Labs -> one flat page of toggles, each off by default (labs.md)
|
||||
└── Labs -> one flat page of toggles, each off by default; hex://labs/<feature> opens it at a row (labs.md)
|
||||
// Command-1…9 follow the panes' order (labs::order)
|
||||
|
||||
General // settings
|
||||
|
||||
@@ -36,6 +36,11 @@ Feature Pane Toggle (settings.json, hex settings) On: what it doe
|
||||
|
||||
Settings › Labs // labs.page
|
||||
├── "Try unfinished features. They may change or break." + Send feedback -> https://github.com/anomalyco/hex/issues/new
|
||||
├── Opened by a link (macOS) -> hex://labs opens this page; hex://labs/<feature> also scrolls to the
|
||||
│ feature's row (centred) and pulses it for ~1.4 s (layer_02 fill, then back); it never turns the
|
||||
│ feature on. An unknown or absent name -> the page opens and process.log notes it. hex://settings/<pane>
|
||||
│ (general, output, history, meetings, voice-filter) opens a main pane; one Hex doesn't show -> General.
|
||||
│ Links over 2048 bytes are ignored; a test build's scheme is hex-test://
|
||||
├── One row per feature this OS has -> press flips it, saved at once
|
||||
│ ├── A pane feature on -> its pane is a normal top-level sidebar item; off -> hidden entirely
|
||||
│ └── Voice Filter while its driver is installed -> on, disabled, "Uninstall the driver in Voice Filter to turn it off."
|
||||
@@ -43,6 +48,7 @@ Settings › Labs // labs.page
|
||||
|
||||
hex labs // labs.cli; edits settings.json, no running Hex
|
||||
├── (list) -> every feature: name, on/off, description, its hex settings key
|
||||
├── link <feature> -> macOS: prints hex://labs/<feature> (hex-test:// in a test build); no Copy link on the rows, 20 of them would only add noise
|
||||
├── on <feature> | off <feature> -> a running Hex saves and applies it (hex settings set); otherwise settings.json
|
||||
├── off voice-filter with the driver installed -> refused: uninstall the driver
|
||||
└── hex experiments … -> points at hex labs
|
||||
@@ -50,6 +56,9 @@ hex labs // labs.cli; edits settings.json, no ru
|
||||
hex settings set labs.live_text true // macOS: through the running Hex
|
||||
```
|
||||
|
||||
Checks: `rune_ui::deep_link` tests (parser, every feature's link reads back);
|
||||
`a_labs_link_*` in tests/panes.rs and the `mac-labs-link` golden (Linux).
|
||||
|
||||
Settings saved before this model may carry `labs.enabled`; it is read and
|
||||
ignored, and every feature keeps its own toggle. `hex status` lists the
|
||||
features on (`Labs` line on macOS, `labs` array in the macOS and Linux JSON,
|
||||
|
||||
+31
-11
@@ -437,31 +437,37 @@ pub enum LabsCommand {
|
||||
On { feature: String },
|
||||
/// Turn a Labs feature off.
|
||||
Off { feature: String },
|
||||
/// Print the link that opens Hex's Labs page at a feature's row (macOS).
|
||||
#[cfg(target_os = "macos")]
|
||||
Link { feature: String },
|
||||
}
|
||||
|
||||
/// `hex labs`: edits `settings.json`; a running Hex applies most changes
|
||||
/// when it next starts.
|
||||
pub fn run(command: Option<&LabsCommand>) -> Result<()> {
|
||||
#[cfg(target_os = "macos")]
|
||||
if let Some(LabsCommand::Link { feature }) = command {
|
||||
println!(
|
||||
"{}",
|
||||
crate::rune_ui::deep_link::labs_link(
|
||||
crate::rune_ui::story_link::scheme(),
|
||||
available_feature(feature)?
|
||||
)
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
let mut settings = AppSettings::load()?;
|
||||
let (name, on) = match command {
|
||||
None | Some(LabsCommand::List) => {
|
||||
print!("{}", list(&settings));
|
||||
return Ok(());
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
Some(LabsCommand::Link { .. }) => unreachable!("handled above"),
|
||||
Some(LabsCommand::On { feature }) => (feature, true),
|
||||
Some(LabsCommand::Off { feature }) => (feature, false),
|
||||
};
|
||||
let feature = Feature::from_name(name)
|
||||
.filter(|feature| feature.on_this_os())
|
||||
.ok_or_else(|| {
|
||||
eyre!(
|
||||
"unknown Labs feature {name:?}; this Hex has: {}",
|
||||
Feature::available()
|
||||
.map(Feature::name)
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
)
|
||||
})?;
|
||||
let feature = available_feature(name)?;
|
||||
if feature == Feature::VoiceFilter && !on && crate::hex_microphone::driver_bundle_installed() {
|
||||
return Err(eyre!(
|
||||
"voice-filter stays on while the Hex Microphone driver is installed; uninstall the driver in its pane to turn it off"
|
||||
@@ -491,6 +497,20 @@ pub fn run(command: Option<&LabsCommand>) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn available_feature(name: &str) -> Result<Feature> {
|
||||
Feature::from_name(name)
|
||||
.filter(|feature| feature.on_this_os())
|
||||
.ok_or_else(|| {
|
||||
eyre!(
|
||||
"unknown Labs feature {name:?}; this Hex has: {}",
|
||||
Feature::available()
|
||||
.map(Feature::name)
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn list(settings: &AppSettings) -> String {
|
||||
let width = Feature::available()
|
||||
.map(|feature| feature.name().len())
|
||||
|
||||
@@ -874,6 +874,13 @@ mod tests {
|
||||
Ok(Some(Command::Control(ControlCli::Labs { command: None })))
|
||||
));
|
||||
assert!(Cli::try_parse_from(["hex", "labs", "off"]).is_err());
|
||||
#[cfg(target_os = "macos")]
|
||||
assert!(matches!(
|
||||
Cli::try_parse_from(["hex", "labs", "link", "live-text"]).map(|cli| cli.command),
|
||||
Ok(Some(Command::Control(ControlCli::Labs {
|
||||
command: Some(LabsCommand::Link { feature })
|
||||
}))) if feature == "live-text"
|
||||
));
|
||||
assert!(matches!(
|
||||
Cli::try_parse_from(["hex", "experiments", "enable", "live-text"])
|
||||
.map(|cli| cli.command),
|
||||
|
||||
+24
-1
@@ -13,6 +13,8 @@ mod activity;
|
||||
#[cfg(hex_capture)]
|
||||
pub(crate) mod capture_capsule;
|
||||
mod controls;
|
||||
#[cfg(target_os = "macos")]
|
||||
pub(crate) mod deep_link;
|
||||
mod explainer;
|
||||
mod fun;
|
||||
mod general;
|
||||
@@ -210,7 +212,15 @@ pub(crate) fn app(connect: host::Connect) -> rune::App<Ui> {
|
||||
/// A `hex://` link the system opened with Hex: a story link opens the window
|
||||
/// on that playground story; anything else is ignored.
|
||||
#[cfg(target_os = "macos")]
|
||||
fn on_open_url(_: &mut Ui, link: &str, tx: &mut Tx) {
|
||||
fn on_open_url(ui: &mut Ui, link: &str, tx: &mut Tx) {
|
||||
if let Some(target) = deep_link::parse(link, story_link::scheme()) {
|
||||
match target {
|
||||
Ok(target) => deep_link::open(ui, target, tx),
|
||||
Err(why) => tracing::warn!(%why, "ignored a link opened with Hex"),
|
||||
}
|
||||
crate::macos_rune::bring_window_forward();
|
||||
return;
|
||||
}
|
||||
let link = match story_link::parse(link, story_link::scheme()) {
|
||||
Ok(link) => link,
|
||||
Err(why) => {
|
||||
@@ -750,6 +760,8 @@ pub(crate) struct Ui {
|
||||
advanced: Vec<Pane>,
|
||||
/// The Labs page shows in place of a pane.
|
||||
labs_open: bool,
|
||||
/// The Labs row a link just opened, pulsing until it is cleared.
|
||||
lab_flash: Option<(crate::labs::Feature, Instant)>,
|
||||
/// A scene previewing the badge of a build kind this binary is not.
|
||||
build_preview: Option<BuildKind>,
|
||||
capture: Capture,
|
||||
@@ -847,6 +859,7 @@ impl Ui {
|
||||
mic_level: general::MicLevel::default(),
|
||||
advanced: Vec::new(),
|
||||
labs_open: false,
|
||||
lab_flash: None,
|
||||
build_preview: None,
|
||||
capture: Capture::Idle,
|
||||
vocabulary,
|
||||
@@ -1264,6 +1277,7 @@ fn poll(ui: &mut Ui, clock: f64, tx: &mut Tx) -> bool {
|
||||
}
|
||||
let now = Instant::now();
|
||||
let mut changed = ui.save_drafts(now);
|
||||
changed |= labs::poll_flash(ui, now);
|
||||
// The OpenCode catalog is read only while the pane that uses it shows.
|
||||
changed |= ui.models.poll(
|
||||
ui.live()
|
||||
@@ -2416,6 +2430,15 @@ const SCENES: &[Scene] = &[
|
||||
}
|
||||
ui.labs_open = true;
|
||||
}),
|
||||
("mac-labs-link", |ui| {
|
||||
*ui = mac_fixture();
|
||||
ui.labs_open = true;
|
||||
// Far ahead, so the pulse holds for the render.
|
||||
ui.lab_flash = Some((
|
||||
crate::labs::Feature::VocabularyBiasing,
|
||||
Instant::now() + Duration::from_secs(3600),
|
||||
));
|
||||
}),
|
||||
("mac-production", |ui| {
|
||||
*ui = mac_fixture();
|
||||
ui.settings.meetings.enabled = false;
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
//! Links that open the window on a page: `hex://labs`,
|
||||
//! `hex://labs/<feature>` (`hex labs link <feature>` prints it), and
|
||||
//! `hex://settings/<pane>` (`hex-test://` in a test build). A Labs link
|
||||
//! scrolls to the feature's row and pulses it; it never turns the feature on.
|
||||
//! Story links live in `story_link`.
|
||||
|
||||
use rune::Tx;
|
||||
|
||||
use super::story_link::{MAX_LINK, percent_decode};
|
||||
use super::{Pane, Ui};
|
||||
|
||||
/// Where a link opens the window.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum Target {
|
||||
/// The Labs page, at a feature's row when it names one. The name is
|
||||
/// checked when the link opens, so an unknown one still opens Labs.
|
||||
Labs(Option<String>),
|
||||
/// A main pane, by its link name.
|
||||
Settings(String),
|
||||
}
|
||||
|
||||
/// The main panes a `hex://settings/<pane>` link names.
|
||||
const PANES: [(&str, Pane); 5] = [
|
||||
("general", Pane::General),
|
||||
("output", Pane::Output),
|
||||
("history", Pane::History),
|
||||
("meetings", Pane::Meetings),
|
||||
("voice-filter", Pane::VoiceFilter),
|
||||
];
|
||||
|
||||
/// Reads `scheme://labs[/<feature>]` and `scheme://settings/<pane>`. `None`
|
||||
/// means it is not one of these (a story link, or not ours), for the caller
|
||||
/// to read another way.
|
||||
pub(crate) fn parse(link: &str, scheme: &str) -> Option<Result<Target, String>> {
|
||||
if link.len() > MAX_LINK {
|
||||
return None;
|
||||
}
|
||||
let url = url::Url::parse(link).ok()?;
|
||||
if url.scheme() != scheme {
|
||||
return None;
|
||||
}
|
||||
let host = url.host_str()?;
|
||||
if host != "labs" && host != "settings" {
|
||||
return None;
|
||||
}
|
||||
let segments: Option<Vec<String>> = url
|
||||
.path_segments()
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.filter(|segment| !segment.is_empty())
|
||||
.map(percent_decode)
|
||||
.collect();
|
||||
let Some(segments) = segments else {
|
||||
return Some(Err("the link isn't valid UTF-8".into()));
|
||||
};
|
||||
let name = segments.join("/").to_ascii_lowercase();
|
||||
Some(match (host, name.is_empty()) {
|
||||
("labs", true) => Ok(Target::Labs(None)),
|
||||
("labs", false) => Ok(Target::Labs(Some(name))),
|
||||
(_, true) => Err("the link names no settings pane".into()),
|
||||
(_, false) => Ok(Target::Settings(name)),
|
||||
})
|
||||
}
|
||||
|
||||
/// The link that opens Labs at `feature`'s row.
|
||||
pub(crate) fn labs_link(scheme: &str, feature: crate::labs::Feature) -> String {
|
||||
format!("{scheme}://labs/{}", feature.name())
|
||||
}
|
||||
|
||||
/// Opens the window's page for `target`; the caller brings the window forward.
|
||||
pub(crate) fn open(ui: &mut Ui, target: Target, tx: &mut Tx) {
|
||||
match target {
|
||||
Target::Labs(name) => super::labs::reveal(ui, name.as_deref(), tx),
|
||||
Target::Settings(name) => {
|
||||
let pane = PANES
|
||||
.iter()
|
||||
.find(|(known, _)| *known == name)
|
||||
.map(|(_, p)| *p);
|
||||
match pane {
|
||||
Some(pane) if pane.shown(ui) => {
|
||||
super::show(ui, super::Destination::Settings, tx);
|
||||
ui.select_pane(pane, tx);
|
||||
}
|
||||
_ => {
|
||||
tracing::warn!(pane = %name, "a settings link named no pane this Hex shows");
|
||||
super::show(ui, super::Destination::Settings, tx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::labs::Feature;
|
||||
|
||||
fn read(link: &str) -> Option<Result<Target, String>> {
|
||||
parse(link, "hex")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reads_labs_links() {
|
||||
assert_eq!(read("hex://labs"), Some(Ok(Target::Labs(None))));
|
||||
assert_eq!(read("hex://labs/"), Some(Ok(Target::Labs(None))));
|
||||
assert_eq!(
|
||||
read("hex://labs/live-text"),
|
||||
Some(Ok(Target::Labs(Some("live-text".into()))))
|
||||
);
|
||||
assert_eq!(
|
||||
read("hex://labs/Live-Text/"),
|
||||
Some(Ok(Target::Labs(Some("live-text".into()))))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("hex-test://labs/meetings", "hex-test"),
|
||||
Some(Ok(Target::Labs(Some("meetings".into()))))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reads_settings_links() {
|
||||
assert_eq!(
|
||||
read("hex://settings/history"),
|
||||
Some(Ok(Target::Settings("history".into())))
|
||||
);
|
||||
assert!(matches!(read("hex://settings"), Some(Err(_))));
|
||||
assert!(matches!(read("hex://labs/%FF"), Some(Err(_))));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn leaves_other_links_alone() {
|
||||
for other in [
|
||||
"hex://story/hud/processing",
|
||||
"hex-test://labs/live-text",
|
||||
"https://labs/live-text",
|
||||
"hex://elsewhere",
|
||||
"not a link",
|
||||
"",
|
||||
] {
|
||||
assert_eq!(read(other), None, "{other}");
|
||||
}
|
||||
let long = format!("hex://labs/{}", "a".repeat(MAX_LINK));
|
||||
assert_eq!(read(&long), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_feature_has_a_link_that_reads_back() {
|
||||
for feature in Feature::ALL {
|
||||
let link = labs_link("hex", feature);
|
||||
assert_eq!(
|
||||
read(&link),
|
||||
Some(Ok(Target::Labs(Some(feature.name().into())))),
|
||||
"{link}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_pane_name_is_distinct() {
|
||||
let mut names: Vec<_> = PANES.iter().map(|(name, _)| *name).collect();
|
||||
names.sort_unstable();
|
||||
names.dedup();
|
||||
assert_eq!(names.len(), PANES.len());
|
||||
}
|
||||
}
|
||||
+43
-3
@@ -91,6 +91,40 @@ pub(super) fn nav(ui: &Ui, p: Paint) -> El {
|
||||
)
|
||||
}
|
||||
|
||||
/// How long a link's row pulses.
|
||||
const FLASH: std::time::Duration = std::time::Duration::from_millis(1400);
|
||||
|
||||
/// A deep link: the Labs page, scrolled to `name`'s row with a pulse. It
|
||||
/// never turns the feature on. An unknown name, or one this OS has no row
|
||||
/// for, opens the page and is logged.
|
||||
#[cfg_attr(not(any(target_os = "macos", test)), allow(dead_code))]
|
||||
pub(super) fn reveal(ui: &mut Ui, name: Option<&str>, tx: &mut Tx) {
|
||||
super::show(ui, super::Destination::Settings, tx);
|
||||
open(ui, tx);
|
||||
ui.lab_flash = None;
|
||||
let Some(name) = name else { return };
|
||||
match Feature::from_name(name).filter(|feature| rows(ui).iter().any(|r| r.feature == *feature))
|
||||
{
|
||||
Some(feature) => {
|
||||
ui.lab_flash = Some((feature, std::time::Instant::now()));
|
||||
tx.scroll_center(row_key(feature));
|
||||
tx.wake_after(FLASH);
|
||||
}
|
||||
None => tracing::warn!(feature = name, "a Labs link named no feature this Hex has"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Ends the pulse once it has run; true when the row changes back.
|
||||
pub(super) fn poll_flash(ui: &mut Ui, now: std::time::Instant) -> bool {
|
||||
match ui.lab_flash {
|
||||
Some((_, since)) if now.duration_since(since) >= FLASH => {
|
||||
ui.lab_flash = None;
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn open(ui: &mut Ui, tx: &mut Tx) {
|
||||
ui.select_pane(Pane::General, tx);
|
||||
ui.labs_open = true;
|
||||
@@ -346,7 +380,10 @@ pub(super) fn page(ui: &Ui, p: Paint) -> El {
|
||||
let mut cards: Vec<CardRow> = Vec::new();
|
||||
for row in rows(ui) {
|
||||
let unload_idle = row.feature == Feature::UnloadIdle && row.on;
|
||||
cards.push(feature_row(p, row));
|
||||
let flashing = ui
|
||||
.lab_flash
|
||||
.is_some_and(|(feature, _)| feature == row.feature);
|
||||
cards.push(feature_row(p, row, flashing));
|
||||
if unload_idle {
|
||||
cards.push(unload_after_row(ui, p));
|
||||
}
|
||||
@@ -359,7 +396,7 @@ pub(super) fn page(ui: &Ui, p: Paint) -> El {
|
||||
super::scroll_body("scroll", content)
|
||||
}
|
||||
|
||||
fn feature_row(p: Paint, row: Row) -> CardRow {
|
||||
fn feature_row(p: Paint, row: Row, flashing: bool) -> CardRow {
|
||||
let switch = if row.locked {
|
||||
rune_kit::Switch::new(true)
|
||||
.disabled(true)
|
||||
@@ -369,7 +406,7 @@ fn feature_row(p: Paint, row: Row) -> CardRow {
|
||||
} else {
|
||||
row_switch(p, row.on)
|
||||
};
|
||||
let item = icon_row(
|
||||
let mut item = icon_row(
|
||||
p,
|
||||
row_key(row.feature),
|
||||
row.icon,
|
||||
@@ -377,6 +414,9 @@ fn feature_row(p: Paint, row: Row) -> CardRow {
|
||||
Some(row.about),
|
||||
switch,
|
||||
);
|
||||
if flashing {
|
||||
item = item.fill(p.k.c.layer_02);
|
||||
}
|
||||
if row.locked {
|
||||
return item.into();
|
||||
}
|
||||
|
||||
@@ -182,6 +182,7 @@ const PATHS: &[(&str, &str)] = &[
|
||||
),
|
||||
("mac-hud-lab", "Window/HUD Lab/HUD Lab"),
|
||||
("mac-labs", "Window/General/Labs"),
|
||||
("mac-labs-link", "Window/General/Labs link"),
|
||||
("mac-production", "Window/General/Production build"),
|
||||
("mac-activity", "Window/Activity/Activity"),
|
||||
("mac-onboarding", "Window/Onboarding tour/Welcome"),
|
||||
|
||||
@@ -12,7 +12,7 @@ pub(crate) const PLAYGROUND_OFF: &str = "the playground is in Labs; turn it on w
|
||||
`hex labs on playground` and restart Hex";
|
||||
|
||||
/// Longer links are ignored: they come from outside Hex.
|
||||
const MAX_LINK: usize = 2048;
|
||||
pub(super) const MAX_LINK: usize = 2048;
|
||||
|
||||
/// A story to open in the playground.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@@ -95,7 +95,7 @@ fn story_name(story: &str) -> String {
|
||||
playground::alias(&story).unwrap_or(story)
|
||||
}
|
||||
|
||||
fn percent_decode(segment: &str) -> Option<String> {
|
||||
pub(super) fn percent_decode(segment: &str) -> Option<String> {
|
||||
let bytes = segment.as_bytes();
|
||||
let mut out = Vec::with_capacity(bytes.len());
|
||||
let mut i = 0;
|
||||
|
||||
@@ -2064,6 +2064,7 @@ fn goldens() {
|
||||
check_golden("portal", dark, GOLDEN_SIZE);
|
||||
for scene in [
|
||||
"history",
|
||||
"mac-labs-link",
|
||||
"output",
|
||||
"modes",
|
||||
"modes-picker",
|
||||
|
||||
@@ -1628,6 +1628,32 @@ fn labs_is_one_flat_list_of_toggles_off_by_default() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_labs_link_opens_labs_pulses_its_row_and_leaves_it_off() {
|
||||
use crate::labs::Feature;
|
||||
let mut rt = runtime("mac-settings", true, (980.0, 2000.0));
|
||||
let feature = Feature::VocabularyBiasing;
|
||||
assert!(!feature.on(&rt.state.settings));
|
||||
rt.update(|ui, tx| super::super::labs::reveal(ui, Some(feature.name()), tx));
|
||||
settle(&mut rt);
|
||||
assert!(rt.state.labs_open);
|
||||
assert_eq!(rt.state.lab_flash.map(|(f, _)| f), Some(feature));
|
||||
assert!(rt.find("lab-vocabulary-biasing").is_some());
|
||||
assert!(!feature.on(&rt.state.settings), "a link never flips it");
|
||||
let later = std::time::Instant::now() + std::time::Duration::from_secs(5);
|
||||
assert!(super::super::labs::poll_flash(&mut rt.state, later));
|
||||
assert!(rt.state.lab_flash.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_labs_link_to_an_unknown_name_opens_labs_without_a_pulse() {
|
||||
let mut rt = runtime("mac-settings", true, (980.0, 2000.0));
|
||||
rt.update(|ui, tx| super::super::labs::reveal(ui, Some("no-such-lab"), tx));
|
||||
settle(&mut rt);
|
||||
assert!(rt.state.labs_open);
|
||||
assert!(rt.state.lab_flash.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn labs_run_setup_again_opens_the_first_run() {
|
||||
let mut rt = runtime("mac-labs", true, (980.0, 2000.0));
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 193 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 194 KiB |
Reference in New Issue
Block a user