Evan's Blog
EvanZhu0721 / 公开仓库

SBMS

镜像已同步

SBMS complete the calculation rules for the default logical desktop topology relationship and the physical dimensions of the displays in the Windows multi-screen collaboration system.

上游 GitHub
READ-ONLY MIRROR

README、源码与 Release 已保存到本站;源码视图固定到 commit a37d6c4b。

main/ root / tests
a37d6c4b· 固定源码快照
tests/theme_contract.rs1.6 KB
1const THEME_SOURCE: &str = include_str!("../ui/theme.slint");
2
3#[test]
4fn platform_palette_only_selects_the_color_scheme() {
5 let palette_references = THEME_SOURCE
6 .lines()
7 .filter(|line| line.contains("Palette."))
8 .collect::<Vec<_>>();
9
10 assert_eq!(
11 palette_references,
12 [
13 " private property <bool> dark-color-scheme: Palette.color-scheme == ColorScheme.dark;"
14 ]
15 );
16}
17
18#[test]
19fn semantic_brushes_use_fixed_light_and_dark_pairs() {
20 let expected_pairs = [
21 ("surface", "#2a282d", "#f8f3f9"),
22 ("on-surface", "#e6e1e5", "#1c1b1f"),
23 ("surface-container", "#1c1b1f", "#fffbfe"),
24 ("on-surface-variant", "#e6e1e5", "#1c1b1f"),
25 ("primary", "#cacaca", "#343236"),
26 ("on-primary", "#343236", "#ffffff"),
27 ("primary-container", "#4f378b", "#eaddff"),
28 ("on-primary-container", "#eaddff", "#21005d"),
29 ("error", "#ffb4ab", "#ba1a1a"),
30 ("error-container", "#93000a", "#ffdad6"),
31 ("on-error-container", "#ffdad6", "#410002"),
32 ("success-container", "#173824", "#d5f5df"),
33 ("on-success-container", "#8fdaa5", "#155c2d"),
34 ("outline-variant", "#938f99", "#79747e"),
35 ];
36
37 for (role, dark, light) in expected_pairs {
38 let declaration =
39 format!("out property <brush> {role}: dark-color-scheme ? {dark} : {light};");
40 assert!(
41 THEME_SOURCE.contains(&declaration),
42 "missing stable theme declaration: {declaration}"
43 );
44 }
45
46 assert_eq!(THEME_SOURCE.matches("out property <brush>").count(), 14);
47}
48