完善绑定区域值类型约束

为 BindingArea 增加 Eq 以支持分离区域比较
This commit is contained in:
2026-09-10 11:03:01 +08:00
parent 22d9958d18
commit 989440173f
2 changed files with 13 additions and 7 deletions
@@ -1,4 +1,4 @@
use super::model::{SeparationNode, SeparationNote, TextMaskArea};
use super::model::SeparationNode;
use base64::Engine as _;
use std::path::Path;
use std::path::PathBuf;
@@ -246,6 +246,7 @@ fn draw_brush(
#[cfg(test)]
mod tests {
use super::*;
use crate::ui_editor::commands::separation::{SeparationNote, TextMaskArea};
#[test]
fn draw_frame_adds_green_cross_corner_lines() {
@@ -287,10 +288,15 @@ mod tests {
height_px: 6,
note: SeparationNote::default(),
text_mask_areas: vec![TextMaskArea {
global_pos_x_px: 2,
global_pos_y_px: 3,
width_px: 2,
height_px: 2,
global_pos_x_px: 0,
global_pos_y_px: 0,
width_px: 1,
height_px: 1,
}, TextMaskArea {
global_pos_x_px: 1,
global_pos_y_px: 1,
width_px: 1,
height_px: 1,
}],
children: vec![],
rework_count: 0,
@@ -316,7 +322,7 @@ mod tests {
8,
8,
);
assert_eq!(*image.get_pixel(2, 4), PURPLE_FILL);
assert_eq!(*image.get_pixel(0, 0), PURPLE_FILL);
assert_eq!(*image.get_pixel(1, 1), image::Rgba([0, 255, 0, 255]));
}
}
@@ -2,7 +2,7 @@ use crate::ui_editor::utils::NodeId;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize, JsonSchema)]
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, JsonSchema)]
#[schemars(deny_unknown_fields)]
pub struct BindingArea {
pub global_pos_x_px: u32,