feat(appearance): M91 —— 外观下层三键 + win32 整窗 α FFI + unsafe 落点门禁
core(D36/D37/D38 的键与范围)
- appearance.window_opacity(0.08..=1.0,默认 1.0,越界钳位且不报错;下限 D36 定案)
- appearance.titlebar_mode(auto|always|never,默认 auto;判定逻辑不在本 mission)
- appearance.palette_source(background-image|wallpaper|preset,与 design 的 Level::code() 同名)
- schema 1.3.0 → 1.4.0:纯增量、不加迁移步骤(新键出厂值 = 老文件缺键)
- appearance 拆成目录 mod/modes/tests(单文件 ≤400 行),非法枚举由 diagnostics() 给可读回落说明
presenter(只读语义,不破 M89 零 UI 门禁)
- AppearanceBase { window_opacity, titlebar_mode, palette_source } + from_document()
- 单测:缺键→出厂值、越界→钳位、非法枚举→回落且合法值照读
app-iced(D36 唯一 unsafe 落点)
- platform::effective_window_alpha(backend, requested) 纯函数:≤0/非有限 → None(拒绝整窗穿透),
其余夹到 0.08..=1.0;CPU 档同样允许窗口级 α(D36 对 D27 的修订),4 组真值表测试
- platform/win32/transparency.rs:SetLayeredWindowAttributes(LWA_ALPHA) 的 FFI +
alpha_byte 量化 + apply_window_alpha;非 Windows 同签名空实现返回 Unsupported
CI
- guards.yml 新增 unsafe-scope job:全仓 allow(unsafe_code) 文件集合必须恰好等于
crates/app-iced/src/platform/win32/transparency.rs(集合相等,不是黑名单命中)
版本号绊线
- isolation_keys / java_install_keys:字面量 1.3.0 → 1.4.0(绊线保留字面量)
- store / document 的两个关系夹具改成相对 launcher_version() 构造(「更高 minor 只读」/
「同 minor 更高 patch 保留 $schema」),下次 bump 不再假绿或假红
This commit is contained in:
1 parent
006eb6869a
commit
7406785325
15 files changed
+902
-18
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
use serde_json::{json, Value};
|
||||
use unlucky_core::setting::document::LoadProblem;
|
||||
use unlucky_core::setting::keys::launcher_schema;
|
||||
use unlucky_core::setting::keys::{launcher_schema, launcher_version};
|
||||
use unlucky_core::setting::schema::{
|
||||
FileAccess, SchemaCompat, SchemaId, SchemaRef, SchemaVersion, SCHEMA_KEY, SCHEMA_VERSION_KEY,
|
||||
};
|
||||
@@ -124,8 +124,9 @@ fn corrupt_file_is_backed_up_before_overwrite() {
|
||||
#[test]
|
||||
fn newer_minor_is_read_only_and_keeps_its_schema() {
|
||||
let temp = TempDir::new("store-readonly");
|
||||
// 比当前 schema(1.3.0)更高的 minor:只读且保留原 $schema。
|
||||
let url = schema_url(SchemaVersion::new(1, 4, 0));
|
||||
// 比当前 schema 高一个 minor(**相对构造**:版本号涨了这条也不会假绿):只读且保留原 $schema。
|
||||
let current = launcher_version();
|
||||
let url = schema_url(SchemaVersion::new(current.major, current.minor + 1, 0));
|
||||
temp.write(
|
||||
"config/launcher.json",
|
||||
&json!({ SCHEMA_KEY: url, "download": { "concurrency": 32 } }).to_string(),
|
||||
@@ -148,12 +149,10 @@ fn newer_minor_is_read_only_and_keeps_its_schema() {
|
||||
store.save_forced().expect("用户确认强写");
|
||||
assert_eq!(store.access(), FileAccess::ReadWrite);
|
||||
let raw = read_json(&temp, "config/launcher.json");
|
||||
assert!(
|
||||
raw[SCHEMA_KEY]
|
||||
.as_str()
|
||||
.expect("$schema")
|
||||
.ends_with("launcher/1.4.0"),
|
||||
"更 minor 的文件强写后也要保留原 $schema"
|
||||
assert_eq!(
|
||||
raw[SCHEMA_KEY].as_str().expect("$schema"),
|
||||
url,
|
||||
"更 minor 的文件强写后也要保留原 $schema(与构造出来的那个 url 逐字相同)"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user