修正 UI 工作流源资源枚举校验
工作流源图校验与 fixture 统一使用 UiDesign。 更新失败提示中的 manifest kind 名称。
This commit is contained in:
@@ -20,6 +20,7 @@ use image::GenericImageView as _;
|
||||
use nalgebra::Vector2;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::{Digest as _, Sha256};
|
||||
use shared_contracts::game_creation_app::GameCreationAppAssetKind;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
@@ -534,8 +535,8 @@ fn validate_source_asset(
|
||||
root: &Path,
|
||||
asset: &GameCreationAppAssetManifestEntry,
|
||||
) -> Result<(), String> {
|
||||
if asset.kind != "ui-prototype" || !asset.media_type.starts_with("image/") {
|
||||
return Err("ui.workflow.run sourceAssetId 必须是已登记的 ui-prototype 图片".to_string());
|
||||
if asset.kind != GameCreationAppAssetKind::UiDesign || !asset.media_type.starts_with("image/") {
|
||||
return Err("ui.workflow.run sourceAssetId 必须是已登记的 ui-design 图片".to_string());
|
||||
}
|
||||
validate_image_asset_file(root, asset, "UI 原型图")
|
||||
}
|
||||
@@ -1606,7 +1607,7 @@ mod tests {
|
||||
let design_path = root.join("assets/home.png");
|
||||
fixture_png(&source_path);
|
||||
fixture_png(&design_path);
|
||||
let source = fixture_asset(root, "assets/ui-prototype.png", "ui-prototype", "source-ui");
|
||||
let source = fixture_asset(root, "assets/ui-prototype.png", "ui-design", "source-ui");
|
||||
let design = fixture_asset(root, "assets/home.png", "ui-design", "design-home");
|
||||
let page = |operation| UiWorkflowRunInput {
|
||||
operation,
|
||||
@@ -1657,7 +1658,7 @@ mod tests {
|
||||
fixture_png(&root.join("assets/ui-prototype.png"));
|
||||
fixture_png(&root.join("assets/home.png"));
|
||||
fixture_png(&root.join("assets/start-button.png"));
|
||||
let source = fixture_asset(root, "assets/ui-prototype.png", "ui-prototype", "source-ui");
|
||||
let source = fixture_asset(root, "assets/ui-prototype.png", "ui-design", "source-ui");
|
||||
let design = fixture_asset(root, "assets/home.png", "ui-design", "design-home");
|
||||
let sprite = fixture_asset(root, "assets/start-button.png", "ui-icon", "start-button");
|
||||
let font_path = root.join("assets/ui-font.ttf");
|
||||
|
||||
Reference in New Issue
Block a user