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
@@ -125,7 +125,7 @@ fn appearance_keys_are_all_ai_writable_and_registered() {
|
||||
|
||||
#[test]
|
||||
fn schema_registration_shape_is_right() {
|
||||
assert_eq!(launcher_version().minor, 3, "1.3.0 登记外观键");
|
||||
assert_eq!(launcher_version().minor, 4, "1.4.0 登记外观下层三键");
|
||||
let schema = launcher_schema();
|
||||
assert_eq!(
|
||||
schema.spec("appearance.bg_fill").unwrap().kind,
|
||||
|
||||
@@ -145,8 +145,9 @@ fn schema_version_mirror_mismatch_is_reported_but_schema_wins() {
|
||||
|
||||
#[test]
|
||||
fn newer_patch_preserves_original_schema_string() {
|
||||
// 同 minor、更高 patch(launcher schema 当前 1.3.0)。
|
||||
let newer = SchemaVersion::new(1, 3, 7);
|
||||
// 同 minor、更高 patch(**相对构造**:版本号涨了这条也不会假绿)。
|
||||
let current = launcher_version();
|
||||
let newer = SchemaVersion::new(current.major, current.minor, current.patch + 1);
|
||||
let url = schema_url(newer);
|
||||
let (doc, _) = loaded(json!({ SCHEMA_KEY: url.clone() }));
|
||||
assert_eq!(
|
||||
|
||||
@@ -128,8 +128,8 @@ fn overrides_key_is_an_enum_whitelist() {
|
||||
|
||||
#[test]
|
||||
fn schema_versions_register_the_new_keys_without_migration() {
|
||||
// 1.3.0 登记 D17 的「外观(高级)」键(1.2.0 是 D23 的 JDK 落点/优先级键)。
|
||||
assert_eq!(launcher_version(), SchemaVersion::new(1, 3, 0));
|
||||
// 1.4.0 登记 M91 的外观下层三键(1.3.0 是 D17 的「外观(高级)」键,1.2.0 是 D23 的 JDK 落点/优先级键)。
|
||||
assert_eq!(launcher_version(), SchemaVersion::new(1, 4, 0));
|
||||
assert_eq!(instance_version(), SchemaVersion::new(1, 1, 0));
|
||||
assert_eq!(launcher_schema().id(), SchemaId::LAUNCHER);
|
||||
// major 仍是 1:迁移链(按 major 走)不需要新步骤,老文件缺键即默认值。
|
||||
|
||||
@@ -66,7 +66,7 @@ fn install_root_accepts_a_path_and_keeps_empty_as_unset() {
|
||||
|
||||
#[test]
|
||||
fn schema_version_bumps_minor_only_so_no_migration_step_is_needed() {
|
||||
assert_eq!(launcher_version(), SchemaVersion::new(1, 3, 0));
|
||||
assert_eq!(launcher_version(), SchemaVersion::new(1, 4, 0));
|
||||
assert_eq!(
|
||||
launcher_version().major,
|
||||
1,
|
||||
|
||||
@@ -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