diff --git a/blocksuite/crates/playground/src/edgeless/present.rs b/blocksuite/crates/playground/src/edgeless/present.rs
index 0536659e0b..1f40abaf19 100644
--- a/blocksuite/crates/playground/src/edgeless/present.rs
+++ b/blocksuite/crates/playground/src/edgeless/present.rs
@@ -299,7 +299,7 @@ impl PlaygroundView {
}
// Source: PresentationIcon in @blocksuite/icons 2.2.17.
-pub const PRESENTATION_ICON: &[u8] = br#""#;
+pub const PRESENTATION_ICON: &[u8] = crate::theme::icons::PRESENTATION.svg.as_bytes();
#[cfg(test)]
mod tests {
@@ -723,4 +723,42 @@ mod tests {
assert_eq!(*events.borrow(), [true, false]);
}
}
+
+ #[test]
+ fn presentation_production_code_has_no_inline_svg_and_matches_legacy_mask() {
+ use ui::{DevicePixels, HeadlessPlatform, SvgSize, size};
+
+ let source = include_str!("present.rs");
+ let (production, _) = source
+ .split_once("\n#[cfg(test)]\n")
+ .expect("present.rs must contain #[cfg(test)] module");
+ assert!(
+ !production.contains(""#;
+ let platform = HeadlessPlatform::new(64, 64, 1.0);
+ let app = ui::Application::with_platform(platform).run_embedded(|_| {});
+ let renderer = app.update(|cx| cx.svg_renderer());
+ let alpha_mask = |svg_bytes: &[u8]| -> Vec {
+ let parsed = renderer.parse_svg(svg_bytes).expect("parse icon svg");
+ let image = renderer
+ .render_parsed(
+ &parsed,
+ SvgSize::ExactSize(size(DevicePixels(48), DevicePixels(48))),
+ )
+ .expect("rasterize icon svg");
+ image
+ .as_bytes(0)
+ .expect("rendered frame bytes")
+ .chunks_exact(4)
+ .map(|bgra| bgra[3])
+ .collect()
+ };
+ assert_eq!(
+ alpha_mask(PRESENTATION_ICON),
+ alpha_mask(LEGACY_PRESENTATION)
+ );
+ }
}
diff --git a/packages/frontend/scripts/check-invariants.sh b/packages/frontend/scripts/check-invariants.sh
index 0ef517f89e..f21c52f545 100755
--- a/packages/frontend/scripts/check-invariants.sh
+++ b/packages/frontend/scripts/check-invariants.sh
@@ -73,8 +73,9 @@ for pkg in meta["packages"]:
if pkg["id"] not in members:
continue
for target in pkg["targets"]:
- if target_kinds.intersection(target["kind"]) and "harness" in target.get("required-features", []):
- targets.add(target["name"])
+ if "harness" in target.get("required-features", []):
+ for kind in target_kinds.intersection(target["kind"]):
+ targets.add((pkg["name"], kind, target["name"]))
test_dir = Path(pkg["manifest_path"]).parent / "tests"
for path in test_dir.rglob("*.rs"):
if any(
@@ -83,7 +84,11 @@ for pkg in meta["packages"]:
):
integration_tests.add(path.relative_to(repo_root).as_posix())
-expected_targets = {"bs-harness", "desktop-harness", "mobile-harness"}
+expected_targets = {
+ ("playground", "bin", "bs-harness"),
+ ("affine-desktop", "bin", "desktop-harness"),
+ ("affine-mobile", "bin", "mobile-harness"),
+}
expected_integration_tests = {
"packages/ui/ui/tests/bidi_multiline_controls.rs",
"packages/ui/ui/tests/metal_atlas_fence.rs",
diff --git a/packages/frontend/scripts/check-snapshot-prefixes.mjs b/packages/frontend/scripts/check-snapshot-prefixes.mjs
index 731052e01b..fe6b61c2d1 100644
--- a/packages/frontend/scripts/check-snapshot-prefixes.mjs
+++ b/packages/frontend/scripts/check-snapshot-prefixes.mjs
@@ -85,6 +85,9 @@ export const ZERO_IN_PRODUCTION = Object.freeze([
'desktop.trash.restore.',
'desktop.trash.delete.',
'desktop.inspector.journal.day.',
+ 'desktop.app_tabs.tab.',
+ 'desktop.split.resize.',
+ 'desktop.explorer.group.',
]);
const WASM_MAGIC = new Uint8Array([0x00, 0x61, 0x73, 0x6d]);
diff --git a/packages/frontend/scripts/check-snapshot-prefixes.test.mjs b/packages/frontend/scripts/check-snapshot-prefixes.test.mjs
index f9fc407846..aba50de812 100644
--- a/packages/frontend/scripts/check-snapshot-prefixes.test.mjs
+++ b/packages/frontend/scripts/check-snapshot-prefixes.test.mjs
@@ -38,6 +38,9 @@ const NEW_DESKTOP_PREFIXES = [
'desktop.trash.restore.',
'desktop.trash.delete.',
'desktop.inspector.journal.day.',
+ 'desktop.app_tabs.tab.',
+ 'desktop.split.resize.',
+ 'desktop.explorer.group.',
];
/**
@@ -138,15 +141,15 @@ test('rejects bare snapshot container IDs in Wasm Data segments', () => {
}
});
-test('verifies all 65 live prefixes including desktop production sources', () => {
- assert.equal(ZERO_IN_PRODUCTION.length, 65);
+test('verifies all 68 live prefixes including desktop production sources', () => {
+ assert.equal(ZERO_IN_PRODUCTION.length, 68);
const result = verifySourcePrefixes();
assert.equal(
result.ok,
true,
`Missing prefixes in repo: ${result.missing.join(', ')}`
);
- assert.equal(Object.keys(result.counts).length, 65);
+ assert.equal(Object.keys(result.counts).length, 68);
for (const prefix of [...DESKTOP_PREFIXES, ...NEW_DESKTOP_PREFIXES]) {
assert.ok(
result.counts[prefix] >= 1,
@@ -270,7 +273,7 @@ test('fails CLI gate on desktop prefixes in Section 11 and ignores custom/code s
encoding: 'utf8',
});
assert.equal(passRun.status, 0, passRun.stderr);
- assert.match(passRun.stdout, /65\/65 prefixes at 0/);
+ assert.match(passRun.stdout, /68\/68 prefixes at 0/);
} finally {
rmSync(dir, { recursive: true, force: true });
}
diff --git a/packages/ui/tokens/extract-tokens.mjs b/packages/ui/tokens/extract-tokens.mjs
index d32731a7db..6b2cb81d9e 100644
--- a/packages/ui/tokens/extract-tokens.mjs
+++ b/packages/ui/tokens/extract-tokens.mjs
@@ -122,6 +122,7 @@ const CORE_ICONS = [
['LAYER', 'LayerIcon'],
['STOP_AI', 'StopAiIcon'],
['EXPAND_CLOSE', 'ExpandCloseIcon'],
+ ['PRESENTATION', 'PresentationIcon'],
];
/**
@@ -1123,6 +1124,7 @@ mod tests {
assert_eq!(icon_by_name("LayerIcon"), Some(&LAYER));
assert_eq!(icon_by_name("StopAiIcon"), Some(&STOP_AI));
assert_eq!(icon_by_name("ExpandCloseIcon"), Some(&EXPAND_CLOSE));
+ assert_eq!(icon_by_name("PresentationIcon"), Some(&PRESENTATION));
}
#[test]
diff --git a/packages/ui/tokens/icons.rs b/packages/ui/tokens/icons.rs
index 5fa914c5bc..148591c8c7 100644
--- a/packages/ui/tokens/icons.rs
+++ b/packages/ui/tokens/icons.rs
@@ -533,6 +533,11 @@ pub const EXPAND_CLOSE: IconDef = IconDef {
svg: "",
};
+pub const PRESENTATION: IconDef = IconDef {
+ name: "PresentationIcon",
+ svg: "",
+};
+
pub const ALL_ICONS: &[IconDef] = &[
ADD_TEXT,
ALL_DOCS,
@@ -608,6 +613,7 @@ pub const ALL_ICONS: &[IconDef] = &[
PAGE,
PEN,
PLUS,
+ PRESENTATION,
QUOTE,
REDO,
RIGHT_TAB,
@@ -689,6 +695,7 @@ mod tests {
assert_eq!(icon_by_name("LayerIcon"), Some(&LAYER));
assert_eq!(icon_by_name("StopAiIcon"), Some(&STOP_AI));
assert_eq!(icon_by_name("ExpandCloseIcon"), Some(&EXPAND_CLOSE));
+ assert_eq!(icon_by_name("PresentationIcon"), Some(&PRESENTATION));
}
#[test]